Skip to content

fix: create fresh transport+server per stateless request (CVE-2026-25536)#147

Open
georeith wants to merge 1 commit intovercel:mainfrom
georeith:fix/stateless-transport-reuse
Open

fix: create fresh transport+server per stateless request (CVE-2026-25536)#147
georeith wants to merge 1 commit intovercel:mainfrom
georeith:fix/stateless-transport-reuse

Conversation

@georeith
Copy link

@georeith georeith commented Mar 3, 2026

Summary

  • Creates a fresh StreamableHTTPServerTransport and McpServer per POST request in stateless mode, instead of reusing a singleton pair across all requests.
  • Widens the @modelcontextprotocol/sdk peer dependency from the pinned 1.25.2 to >=1.25.2 so consumers can use patched SDK versions.

Problem

@modelcontextprotocol/sdk >=1.26.0 added runtime guards to fix CVE-2026-25536, a High severity cross-client data leak where JSON-RPC message ID collisions cause responses to be routed to the wrong client's HTTP connection.

The guard enforces that a stateless StreamableHTTPServerTransport cannot be reused across requests:

Stateless transport cannot be reused across requests.
Create a new transport per request.

mcp-handler creates a single transport and server at module init time and reuses them for every POST request, which triggers this guard on SDK >=1.26.0 and returns a 500 to all requests after the first.

Fix

Moves the StreamableHTTPServerTransport and McpServer creation from module-level singletons into the POST handler, so a fresh instance of each is created per request. This matches the workaround recommended in the CVE advisory.

Test plan

  • Existing e2e tests pass (the one failing test in should read server capabilities is a pre-existing issue on main due to new SDK fields in the tool schema)
  • Verified with a real consumer project that was hitting the 500 after yarn dedupe unified the SDK to 1.27.0

@georeith georeith force-pushed the fix/stateless-transport-reuse branch from 230ac5f to c7cf335 Compare March 3, 2026 17:35
)

SDK >=1.26.0 prevents reuse of a stateless StreamableHTTPServerTransport.
Move transport and McpServer instantiation into the POST handler so each
request gets its own instances.

Also widen @modelcontextprotocol/sdk peerDep to >=1.25.2 and add a
regression test that sends two independent clients sequentially.

Made-with: Cursor
@georeith georeith force-pushed the fix/stateless-transport-reuse branch from c7cf335 to 38f71c9 Compare March 3, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant