Elffuss BraidHub

kikocis/continue public

Merge pull request #5780 from continuedev/revert-5517-feature/add-mcp-sse-in-config-yaml

Revert "feat: add support for SSE MCP servers"
Changeset74358319424eef8c5b2a3868ed7d7f58361df3a84522dcb5f9fd60dd14205a49
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-05-21 12:41 -07:00
CommitterGitHub <noreply@github.com> · 2025-05-21 12:41 -07:00
Parents7d19f8698b5d, 932977ebc545

Browse the files at this changeset

7 files changed

modified core/config/workspace/workspaceBlocks.ts +0 −6
@@ -53,16 +53,10 @@
5353 configYaml.mcpServers = [
5454 {
5555 name: "New MCP server",
56- type: "stdio",
5756 command: "npx",
5857 args: ["-y", "<your-mcp-server>"],
5958 env: {},
6059 },
61- {
62- name: "New MCP server",
63- type: "sse",
64- url: "https://example.org/sse"
65- },
6660 ];
6761 break;
6862 }
deleted core/config/yaml/loadYaml.test.ts +0 −107
@@ -1,107 +0,0 @@
1-import { MCPServer } from "@continuedev/config-yaml";
2-import { convertYamlMcpToContinueMcp } from "./loadYaml";
3-
4-describe("MCP Server Configuration Tests", () => {
5- test("should convert stdio MCP server correctly", () => {
6- const stdioServer: MCPServer = {
7- name: "Test Stdio Server",
8- type: "stdio",
9- command: "uvx",
10- args: ["mcp-server-sqlite", "--db-path", "/test.db"],
11- env: { TEST_ENV: "value" },
12- connectionTimeout: 5000
13- };
14-
15- const result = convertYamlMcpToContinueMcp(stdioServer);
16-
17- expect(result).toEqual({
18- transport: {
19- type: "stdio",
20- command: "uvx",
21- args: ["mcp-server-sqlite", "--db-path", "/test.db"],
22- env: { TEST_ENV: "value" }
23- },
24- timeout: 5000
25- });
26- });
27-
28- test("should convert SSE MCP server correctly", () => {
29- const sseServer: MCPServer = {
30- name: "Test SSE Server",
31- type: "sse",
32- url: "http://localhost:8150/cosmos/mcp/v1/sse",
33- connectionTimeout: 3000
34- };
35-
36- const result = convertYamlMcpToContinueMcp(sseServer);
37-
38- expect(result).toEqual({
39- transport: {
40- type: "sse",
41- url: "http://localhost:8150/cosmos/mcp/v1/sse"
42- },
43- timeout: 3000
44- });
45- });
46-
47- test("should convert WebSocket MCP server correctly", () => {
48- const wsServer: MCPServer = {
49- name: "Test WebSocket Server",
50- type: "websocket",
51- url: "ws://localhost:8150/cosmos/mcp/v1/ws",
52- connectionTimeout: 10000
53- };
54-
55- const result = convertYamlMcpToContinueMcp(wsServer);
56-
57- expect(result).toEqual({
58- transport: {
59- type: "websocket",
60- url: "ws://localhost:8150/cosmos/mcp/v1/ws"
61- },
62- timeout: 10000
63- });
64- });
65-
66- test("should handle legacy MCP server format for backward compatibility", () => {
67- // Test with old format that doesn't have a type field
68- const legacyServer = {
69- name: "Legacy Server",
70- command: "old-command",
71- args: ["--legacy"],
72- connectionTimeout: 2000
73- } as any;
74-
75- const result = convertYamlMcpToContinueMcp(legacyServer);
76-
77- expect(result).toEqual({
78- transport: {
79- type: "stdio",
80- command: "old-command",
81- args: ["--legacy"],
82- env: undefined
83- },
84- timeout: 2000
85- });
86- });
87-
88- test("should handle missing optional fields", () => {
89- const minimalServer: MCPServer = {
90- name: "Minimal Server",
91- type: "stdio",
92- command: "minimal"
93- };
94-
95- const result = convertYamlMcpToContinueMcp(minimalServer);
96-
97- expect(result).toEqual({
98- transport: {
99- type: "stdio",
100- command: "minimal",
101- args: [],
102- env: undefined
103- },
104- timeout: undefined
105- });
106- });
107-});
No newline at the end of the file
modified core/config/yaml/loadYaml.ts +10 −34
@@ -62,42 +62,17 @@
6262 }
6363 }
6464
65-export function convertYamlMcpToContinueMcp(
65+function convertYamlMcpToContinueMcp(
6666 server: MCPServer,
6767 ): ExperimentalMCPOptions {
68- const transportConfig = (() => {
69- switch (server.type) {
70- case "stdio":
71- return {
72- type: "stdio" as const,
73- command: server.command,
74- args: server.args ?? [],
75- env: server.env,
76- };
77- case "sse":
78- return {
79- type: "sse" as const,
80- url: server.url,
81- };
82- case "websocket":
83- return {
84- type: "websocket" as const,
85- url: server.url,
86- };
87- default:
88- // Default to stdio for backward compatibility
89- return {
90- type: "stdio" as const,
91- command: (server as any).command,
92- args: (server as any).args ?? [],
93- env: (server as any).env,
94- };
95- }
96- })();
97-
9868 return {
99- transport: transportConfig,
100- timeout: server.connectionTimeout
69+ transport: {
70+ type: "stdio",
71+ command: server.command,
72+ args: server.args ?? [],
73+ env: server.env,
74+ },
75+ timeout: server.connectionTimeout,
10176 };
10277 }
10378
@@ -269,7 +244,7 @@
269244
270245 config.mcpServers?.forEach((mcpServer) => {
271246 const mcpArgVariables =
272- (mcpServer.type === "stdio" ? mcpServer.args?.filter((arg) => TEMPLATE_VAR_REGEX.test(arg)) : []) ?? [];
247+ mcpServer.args?.filter((arg) => TEMPLATE_VAR_REGEX.test(arg)) ?? [];
273248
274249 if (mcpArgVariables.length === 0) {
275250 return;
@@ -481,6 +456,7 @@
481456 id: server.name,
482457 name: server.name,
483458 transport: {
459+ type: "stdio",
484460 args: [],
485461 ...server,
486462 },
modified docs/docs/customize/deep-dives/mcp.mdx +0 −10
@@ -20,15 +20,11 @@
2020 ```yaml title="config.yaml"
2121 mcpServers:
2222 - name: My MCP Server
23- type: stdio
2423 command: uvx
2524 args:
2625 - mcp-server-sqlite
2726 - --db-path
2827 - /Users/NAME/test.db
29- - name: My MCP Server with SSE
30- type: sse
31- url: "https://example.com/mcp-server/sse"
3228 ```
3329 </TabItem>
3430 <TabItem value="json" label="JSON">
@@ -42,12 +38,6 @@
4238 "command": "uvx",
4339 "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
4440 }
45- },
46- {
47- "transport": {
48- "type": "sse",
49- "url": "https://example.com/mcp-server/sse"
50- }
5141 }
5242 ]
5343 }
modified docs/docs/reference.md +1 −13
@@ -379,33 +379,21 @@
379379 **Properties:**
380380
381381 - `name` (**required**): The name of the MCP server.
382-- `type"` (**required**): The type of the MCP server. Can be "stdio", "sse", or "websocket".
383-
384-**Stdio type**
385-
386382 - `command` (**required**): The command used to start the server.
387383 - `args`: An optional array of arguments for the command.
388384 - `env`: An optional map of environment variables for the server process.
389385 - `connectionTimeout`: An optional connection timeout number to the server in milliseconds.
390386
391-**SSE or Websocket type**
392-
393-- `url` (**required**): The URL of the MCP server.
394-
395387 **Example:**
396388
397389 ```yaml title="config.yaml"
398390 mcpServers:
399- - name: My MCP Server with stdio
400- type: stdio
391+ - name: My MCP Server
401392 command: uvx
402393 args:
403394 - mcp-server-sqlite
404395 - --db-path
405396 - /Users/NAME/test.db
406- - name: My MCP Server with SSE
407- type: sse
408- url: "https://example.com/mcp-server/sse"
409397 ```
410398
411399 ### `data`
modified packages/config-yaml/src/converter.ts +7 −41
@@ -128,48 +128,14 @@
128128
129129 function convertMcp(mcp: any): NonNullable<ConfigYaml["mcpServers"]>[number] {
130130 const { transport } = mcp;
131- const { type } = transport;
132-
133- // Common properties for all server types
134- const baseServer: any = {
135- name: mcp.name,
136- type: type,
131+ const { command, args, env, server_name } = transport;
132+
133+ return {
134+ command,
135+ args,
136+ env,
137+ name: server_name || "MCP Server",
137138 };
138-
139- if (mcp.faviconUrl) {
140- baseServer.faviconUrl = mcp.faviconUrl
141- }
142- if (mcp.connectionTimeout) {
143- baseServer.connectionTimeout = mcp.connectionTimeout
144- }
145-
146- // Type-specific properties
147- switch (type) {
148- case "stdio":
149- const stdioServer = {
150- ...baseServer,
151- command: transport.command,
152- };
153-
154- if (transport.args) {
155- stdioServer.args = transport.args
156- }
157- if (transport.env) {
158- stdioServer.env = transport.env
159- }
160-
161- return stdioServer;
162-
163- case "sse":
164- case "websocket":
165- return {
166- ...baseServer,
167- url: transport.url
168- };
169-
170- default:
171- throw new Error(`Unknown MCP server type: ${type}`);
172- }
173139 }
174140
175141 function convertDoc(
modified packages/config-yaml/src/schemas/index.ts +11 −38
@@ -9,31 +9,14 @@
99 params: z.any().optional(),
1010 });
1111
12-const mcpServerSchema = z.discriminatedUnion("type", [
13- z.object({
14- name: z.string(),
15- type: z.literal("stdio"),
16- command: z.string(),
17- faviconUrl: z.string().optional(),
18- args: z.array(z.string()).optional(),
19- env: z.record(z.string()).optional(),
20- connectionTimeout: z.number().gt(0).optional()
21- }),
22- z.object({
23- name: z.string(),
24- type: z.literal("sse"),
25- url: z.string(),
26- faviconUrl: z.string().optional(),
27- connectionTimeout: z.number().gt(0).optional()
28- }),
29- z.object({
30- name: z.string(),
31- type: z.literal("websocket"),
32- url: z.string(),
33- faviconUrl: z.string().optional(),
34- connectionTimeout: z.number().gt(0).optional()
35- })
36-]);
12+const mcpServerSchema = z.object({
13+ name: z.string(),
14+ command: z.string(),
15+ faviconUrl: z.string().optional(),
16+ args: z.array(z.string()).optional(),
17+ env: z.record(z.string()).optional(),
18+ connectionTimeout: z.number().gt(0).optional()
19+});
3720
3821 export type MCPServer = z.infer<typeof mcpServerSchema>;
3922
@@ -78,17 +61,7 @@
7861 export const blockOrSchema = <T extends z.AnyZodObject>(
7962 schema: T,
8063 usesSchema: z.ZodTypeAny = defaultUsesSchema,
81- isDiscriminatedUnion?: boolean,
82-) => {
83- if (isDiscriminatedUnion) {
84- return z.union([schema, z.object({
85- uses: usesSchema,
86- with: z.record(z.string()).optional(),
87- override: z.any().optional(),
88- })]);
89- }
90- return z.union([schema, blockItemWrapperSchema(schema, usesSchema)]);
91-};
64+) => z.union([schema, blockItemWrapperSchema(schema, usesSchema)]);
9265
9366 export const commonMetadataSchema = z.object({
9467 tags: z.string().optional(),
@@ -125,7 +98,7 @@
12598 .optional(),
12699 context: z.array(blockOrSchema(contextSchema)).optional(),
127100 data: z.array(blockOrSchema(dataSchema)).optional(),
128- mcpServers: z.array(blockOrSchema(mcpServerSchema as any, defaultUsesSchema, true)).optional(),
101+ mcpServers: z.array(blockOrSchema(mcpServerSchema)).optional(),
129102 rules: z
130103 .array(
131104 z.union([
@@ -250,4 +223,4 @@
250223 api_key: z.string().optional(),
251224 });
252225
253-export type Config = z.infer<typeof configSchema>;
No newline at the end of the file
226+export type Config = z.infer<typeof configSchema>;