Skip to content

feat: add support for SSE MCP servers #5517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

04cfb1ed
Copy link
Contributor

@04cfb1ed 04cfb1ed commented May 5, 2025

Description

Add support for multiple MCP server types (stdio, sse, websocket) in the YAML configuration schema, ensuring backward compatibility with legacy configurations).

mcpServers:
   - name: Debug list
     type: stdio
     command: uv.exe
     args:
       - --directory
       - test-mcp-server
       - run
       - load-folders-mcp.py

   - name: Debug Local  MCP Python
     type: sse
     url: http://127.0.0.1:8000/sse

I just saw the #5511 I was working on this PR a few days ago, I leave here, but I don't know how to proceed

Closes #5359

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Testing instructions

[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change, including any relevant tests to run. ]

…t) in the YAML configuration schema, ensuring backward compatibility with legacy configurations
@04cfb1ed 04cfb1ed requested a review from a team as a code owner May 5, 2025 14:28
@04cfb1ed 04cfb1ed requested review from Patrick-Erichsen and removed request for a team May 5, 2025 14:28
Copy link

netlify bot commented May 5, 2025

Deploy Preview for continuedev ready!

Name Link
🔨 Latest commit 669fb03
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/6818cb15d09dfc00081998c4
😎 Deploy Preview https://deploy-preview-5517--continuedev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nejch
Copy link
Contributor

nejch commented May 5, 2025

Thanks @04cfb1ed I closed my PR to avoid confusion as it was just a quick draft I didn't spend much time on, and yours is more complete.

@enzoescipy
Copy link

Hi @04cfb1ed,

Following @nejch's suggestion on the now-closed PR #5511, I wanted to reach out here. Thank you for picking this up and creating a more complete implementation for SSE/WebSocket MCP server support! This is a feature I was really looking forward to for my own setup.

Since the original PR was a draft and I was eager to test this out, I quickly put together a working version (for my specific SSE use case) in my fork:
https://github.com/enzoescipy/continue/tree/sse-mcp-support

It mainly involved completing the URL handling in loadYaml.ts and ensuring the schema definition was correct, building upon the existing logic in MCPConnection.ts.

Please feel free to reference it if any part might be helpful for finalizing this PR (#5517). No pressure at all, just wanted to share my work in case it's useful.

Thanks again for implementing this much-needed feature, and looking forward to seeing this merged!

Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks solid, thanks for adding the tests as well! Just had a few small comments.

Is there an SSE server you could point me towards to test this locally?

@@ -378,21 +378,33 @@ prompts, context, and tool use. Continue supports any MCP server with the MCP co
**Properties:**

- `name` (**required**): The name of the MCP server.
- `type"` (**required**): The type of the MCP server. Can be "stdio", "sse", or "websocket.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `type"` (**required**): The type of the MCP server. Can be "stdio", "sse", or "websocket.
- `type"` (**required**): The type of the MCP server. Can be "stdio", "sse", or "websocket".

@@ -63,6 +80,17 @@ export const blockOrSchema = <T extends z.AnyZodObject>(
usesSchema: z.ZodTypeAny = defaultUsesSchema,
) => z.union([schema, blockItemWrapperSchema(schema, usesSchema)]);

export const blockOrDiscriminatedUnionSchema = <T extends z.ZodType>(
Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we can use the existing blockOrSchema instead of creating the new type? This will likely break typings in our repo for hub.continue.dev and in general will complicate things a lot.

Generally speaking I'd rather have a not-100%-perfect-schema rather than create a new wrapper here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this acceptable? (adding an optional parameter to change the override parameter)

export const blockOrSchema = <T extends z.AnyZodObject>(
  schema: T,
  usesSchema: z.ZodTypeAny = defaultUsesSchema,
  isDiscriminatedUnion?: boolean,
) => {
  if (isDiscriminatedUnion) {
    return z.union([schema, z.object({
      uses: usesSchema,
      with: z.record(z.string()).optional(),
      override: z.any().optional(),
    })]);
  }
  return z.union([schema, blockItemWrapperSchema(schema, usesSchema)]);
};

// Sample
mcpServers: z.array(blockOrSchema(mcpServerSchema as any, defaultUsesSchema, true)).optional(),

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs May 6, 2025
@AwaisBinKaleem
Copy link

@04cfb1ed waiting for your powers for this megical feature :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Cannot configure MCP to use SSE mode in YAML
5 participants