Skip to content
GitHub Security Advisories·Indexed by this site · Originally publishedSelectedAttention45

MCP TypeScript server SDK: sharing a transport or server instance delivers one HTTP client's messages to another client

MCP TypeScript server SDK: Shared transport or server instances delivered one HTTP client's messages to another

AI summary

A GitHub security advisory discloses that versions of @modelcontextprotocol/server from 2.0.0 to before 2.3.0, when serving over HTTP, may deliver one client's responses and notifications to another client. The cause is that messages are matched to connections only by JSON-RPC id, while SDK clients number requests starting from 0, so ids collide in normal use; it is triggered when multiple clients share a stateless transport, or share one McpServer or Server instance. The fixed version is 2.3.0, and code changes are also required: pass a factory to createMcpHandler() that creates a new McpServer per call, create a new server and transport per request inside the request handler, or set sessionIdGenerator to keep one instance per session.

Why it was selected

The advisory states that sharing a transport or server instance causes one client's messages to be delivered to another client, and gives per-request or per-session isolation as the fix.

Read originalgithub.com