Summary
- Creates a fresh
StreamableHTTPServerTransportandMcpServerper POST request in stateless mode, instead of reusing a singleton pair across all requests. - Widens the
@modelcontextprotocol/sdkpeer dependency from the pinned1.25.2to>=1.25.2so 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 capabilitiesis a pre-existing issue onmaindue to new SDK fields in the tool schema) - Verified with a real consumer project that was hitting the 500 after
yarn dedupeunified the SDK to 1.27.0