-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Introduce a shared Transport abstraction to reduce stdio/SSE/WebSocket/HTTP duplication #1690
Copy link
Copy link
Open
Labels
breaking changeWill break existing deployments when updated without changesWill break existing deployments when updated without changesenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixesIdeas, requests and plans for v2 of the SDK which will incorporate major changes and fixes
Metadata
Metadata
Assignees
Labels
breaking changeWill break existing deployments when updated without changesWill break existing deployments when updated without changesenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixesIdeas, requests and plans for v2 of the SDK which will incorporate major changes and fixes
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
The SDK currently implements multiple server and client transports (stdio, SSE, WebSocket, Streamable HTTP). Each one has its own message loop, error handling, and resource management logic with significant duplication.
This makes it harder to:
A small
Transportabstraction could centralize most of the shared behavior.Problems
src/mcp/server/stdio.pysrc/mcp/server/sse.pysrc/mcp/server/websocket.pysrc/mcp/server/streamable_http.pyProposal
Define a
Transportprotocol/interfaceFor example:
Refactor sessions to depend on
TransportBaseSession(and server/client sessions) should operate on aTransportinstance rather than transport-specific primitives.Align behavior across transports
Standardize behavior for:
Incremental migration
Why this matters
Acceptance criteria
Transportinterface (or equivalent) is defined for server and client usage.