Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MCP SSE Transport Server Implementation
Overview
This PR implements a Model Context Protocol (MCP) SSE transport server that enables Cursor to communicate with remote MCP servers over the network. The implementation follows the MCP specification for establishing and maintaining SSE connections, handling tool execution, and managing session state.
Changes
MCPStdioToSSEProxyclass to handle SSE transport layerMcp-Session-IdheaderTechnical Details
Testing
Limitations
Documentation
Checklist
sequenceDiagram participant Client participant Proxy as MCPStdioToSSEProxy participant Remote as Remote Server Note over Proxy: Initialize with remoteUrl loop Main Processing Loop Client->>Proxy: Read stdin line alt Handshake State: awaiting-initialize Proxy->>Remote: POST initialize request Remote-->>Proxy: Response with session-id Note over Proxy: Set handshakeState to awaiting-initialized else Handshake State: awaiting-initialized Proxy->>Remote: POST notifications/initialized Remote-->>Proxy: Response Note over Proxy: Set handshakeState to ready else Handshake State: ready Proxy->>Remote: POST message alt Response is SSE Remote-->>Proxy: Stream SSE events Proxy-->>Client: Write events to stdout else Response is JSON Remote-->>Proxy: JSON response Proxy-->>Client: Write response to stdout end end alt Session Lost (404) Note over Proxy: Reset session and restart handshake end end Note over Proxy: Error handling throughout