{"record":{"id":"03fc876647002e91","repo":"siyuan-note/siyuan","slug":"unsupported-server-type-s","errorCode":null,"errorMessage":"unsupported server type: %s","messagePattern":"unsupported server type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/mcp/client/mcp.go","lineNumber":444,"sourceCode":"\t}\n}\n\nfunc connectServer(ctx context.Context, server conf.MCPServer, interactive bool) (*mcp.ClientSession, *exec.Cmd, *mcpOAuthHandler, error) {\n\tc := mcp.NewClient(&mcp.Implementation{Name: \"siyuan\", Version: \"3.0\"}, &mcp.ClientOptions{\n\t\tToolListChangedHandler: func(context.Context, *mcp.ToolListChangedRequest) {\n\t\t\tlogging.LogInfof(\"mcp: server [%s] tool list changed, reconnecting\", server.Name)\n\t\t\tgo reconnectMCPServer(server.ID)\n\t\t},\n\t})\n\n\tswitch server.Type {\n\tcase \"stdio\":\n\t\tsession, cmd, err := connectStdio(ctx, c, server)\n\t\treturn session, cmd, nil, err\n\tcase \"http\":\n\t\treturn connectHTTP(ctx, c, server, interactive)\n\tdefault:\n\t\treturn nil, nil, nil, fmt.Errorf(\"unsupported server type: %s\", server.Type)\n\t}\n}\n\nfunc connectStdio(ctx context.Context, client *mcp.Client, server conf.MCPServer) (*mcp.ClientSession, *exec.Cmd, error) {\n\tif server.Command == \"\" {\n\t\treturn nil, nil, fmt.Errorf(\"command is required for stdio server\")\n\t}\n\n\tcmd := exec.Command(server.Command, server.Args...)\n\tcmdEnv, err := buildStdioEnvironment(server, os.LookupEnv, func(value string) string {\n\t\tif model.Conf == nil {\n\t\t\treturn value\n\t\t}\n\t\treturn conf.ResolveSecretsVars(model.Conf.Secrets, model.Conf.Variables, value)\n\t}, runtime.GOOS)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"environment: %w\", err)\n\t}","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/mcp/client/mcp.go#L426-L462","documentation":"Returned by the MCP client connector's `switch server.Type` when the configured server type is neither `\"stdio\"` nor `\"http\"`. These are the only transports the kernel supports for outbound MCP connections; any other value falls through to the default case and yields this error.","triggerScenarios":"An MCP server entry in config whose `type` field is missing, misspelled (e.g. `stdio\\n`, `STDIO`, `sse`, `ws`), or set to an unsupported value. The switch is case-sensitive on the exact strings `stdio` and `http`.","commonSituations":"Hand-editing the MCP server config with a typo; copying a config snippet that used a type from a different MCP client; uppercase or whitespace in the type string; using `sse` when only `http` (streamable) is supported.","solutions":["Set `type` to exactly `\"stdio\"` for command-based servers or `\"http\"` for streamable HTTP servers.","Check for surrounding whitespace or hidden characters in the config value.","Re-add the server through the kernel's MCP config UI/API to get a canonical entry."],"exampleFix":"// before\n{ \"name\": \"myserver\", \"type\": \"STDIO\", \"command\": \"./srv\" }\n// after\n{ \"name\": \"myserver\", \"type\": \"stdio\", \"command\": \"./srv\" }","handlingStrategy":"validation","validationCode":"// Validate the server type at config-load time:\nswitch server.Type {\ncase \"stdio\", \"http\":\ndefault:\n    return fmt.Errorf(\"unsupported server type: %s\", server.Type)\n}","typeGuard":"func isValidServerType(t string) bool {\n    return t == \"stdio\" || t == \"http\"\n}","tryCatchPattern":null,"preventionTips":["Use exactly \"stdio\" or \"http\" (lowercase, no whitespace) in MCP server config.","Validate config entries at load time and reject invalid types early.","Re-add servers via the kernel UI/API to obtain canonical entries."],"tags":["mcp","config","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}