NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · MCP TypeScript SDK

CVE-2026-25536: @modelcontextprotocol/sdk has cross-client data leak via shared server/transport instance reuse

highCVSS 3.1 7.1GHSA-345p-7cg4-v4c7

The MCP TypeScript SDK (@modelcontextprotocol/sdk) 1.10.0 through 1.25.3 can send one client's data to another client when a server reuses a single transport or a single McpServer instance across clients. Stateless HTTP servers are the usual case. Version 1.26.0 turns the silent misrouting into an error, so servers that reuse instances must be changed.

Published Feb 4, 2026 · Updated Feb 9, 2026 · Analysis Nov 1, 2026

What an attacker can do

There are two related problems. In the first, one StreamableHTTPServerTransport handles many clients. It keeps a requestId-to-stream map, and the SDK client numbers messages from 0, so two clients produce the same IDs. The second client's entry overwrites the first, and a response goes to the wrong HTTP connection. This affects tools/call, resources/read, prompts/get and every other request type.

In the second, one McpServer or Server is connect()ed to several transports. Protocol overwrites its internal this._transport. Progress notifications, sampling and elicitation requests sent during a tool run, and spontaneous server notifications, go to whichever client connected last. Final responses are mostly routed correctly unless a request arrives on the old transport after the overwrite, in which case the client times out.

The attacker is a second, authenticated client of the same server who sends requests at the same time. They can receive another user's tool output, notifications or sampling prompts. Single-client setups such as one local IDE are not affected.

Who is affected

@modelcontextprotocol/sdk from 1.10.0 through 1.25.3, in servers that share instances between clients. From the advisory:

  • A new McpServer and transport per request or per session: not affected.
  • Stateless mode reusing both transport and server: affected by both issues.
  • Stateless mode with a new transport per request but one shared server: Issue 2 only, safe if tools send no progress, sampling or elicitation messages.
  • Stateful mode (sessionIdGenerator) with a shared server: Issue 2 only.

Check the installed version:

npm ls @modelcontextprotocol/sdk

@modelcontextprotocol/sdk

Ecosystem
npm
Affected
>= 1.10.0, <= 1.25.3
Fixed in
1.26.0
Check
npm ls @modelcontextprotocol/sdk

How to fix it

Upgrade to @modelcontextprotocol/sdk 1.26.0.

npm install @modelcontextprotocol/[email protected]

The release adds three guards. Protocol.connect() throws if the protocol is already connected to a transport. A stateless StreamableHTTPServerTransport.handleRequest() throws if called a second time. In-flight handler abort controllers are cleaned up on close(), and sendNotification and sendRequest check the abort signal first. A server that reuses instances will now fail with a clear error and must be restructured.

The workaround, if you cannot upgrade: create a fresh McpServer and transport for each request in stateless mode, or for each session in stateful mode.

How to tell if you were hit

Read your server code for a module-level McpServer or StreamableHTTPServerTransport that is passed to connect() or handleRequest() on every request. On 1.26.0 and later, the guards raise errors for this pattern; an error from connect() about an already-connected transport, or from a second handleRequest() call, shows reuse. On older versions, symptoms are clients receiving responses to requests they did not make, request timeouts under concurrency, and notifications arriving at the wrong session. The sources give no log signature for exploitation.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

Cross-client data leak via two distinct issues: (1) reusing a single StreamableHTTPServerTransport across multiple client requests, and (2) reusing a single McpServer/Server instance across multiple transports. Both are most common in stateless deployments.

Impact

This advisory covers two related but distinct vulnerabilities. A deployment may be affected by one or both.

Issue 1: Transport re-use

What happens: When a single StreamableHTTPServerTransport instance handles multiple client requests, JSON-RPC message ID collisions cause responses to be routed to the wrong client's HTTP connection. The transport maintains an internal requestId → stream mapping, and since MCP client SDKs generate message IDs using an incrementing counter starting at 0, two clients produce identical IDs. The second client's request overwrites the first client's mapping entry, routing the response to the wrong HTTP stream.

What is affected: All request types — tools/call, resources/read, prompts/get, etc. No server-initiated features are required to trigger this.

Conditions:

  • A single StreamableHTTPServerTransport instance is reused across multiple client requests (most common in stateless mode without sessionIdGenerator)
  • Two or more clients send requests concurrently
  • Clients generate overlapping JSON-RPC message IDs (the SDK's default client uses an incrementing counter starting at 0)

Issue 2: Server/Protocol re-use

What happens: When a single McpServer (or Server) instance is connect()ed to multiple transports (one per client), the Protocol's internal this._transport reference is silently overwritten. The final response to a request is routed correctly (the Protocol captures the transport reference at request time), but any server-to-client messages sent during request handling use the shared this._transport reference, which may point to a different client's transport.

What is affected: This depends on what features your server uses:

  • Final responses (the return value from a tool/resource/prompt handler): Affected in most cases. The Protocol captures this._transport at request-handling time, not the transport that delivered the request. This means:
  • If a request is already in-flight when a second connect() occurs (i.e., the request arrived before the transport was overwritten), the captured reference is correct and the response routes properly.
  • If a request arrives on the old transport after a second connect() has overwritten this._transport, the captured reference points to the new transport, and the response is mis-routed. The requesting client will time out.
  • Progress notifications sent during tool execution via sendNotification: Affected. These are dispatched through this._transport. When the transport has been overwritten and message IDs collide on the new transport, notifications are routed to the wrong client's HTTP stream.
  • Sampling (createMessage) and elicitation requests sent during tool execution via sendRequest: Affected. Same mechanism — the request is sent to the wrong client.
  • Spontaneous server-initiated notifications (outside any request handler): Affected. These are sent to whichever client's transport was most recently connected.

Conditions:

  • A single McpServer/Server instance is connect()ed to multiple transports across requests or sessions
  • Two or more clients connect concurrently
  • For in-request notifications/requests: message ID collision on the other transport is required for silent data leaking (the SDK's default client uses an incrementing counter starting at 0). Without collision, the transport will throw an error rather than misroute.
  • For spontaneous notifications: no collision needed, messages are always sent to the last-connected client's transport

How to tell if you're affected

  • You use `sessionIdGenerator` (stateful mode) with a new `McpServer` per session → not affected by either issue. Each session has its own transport and server instance.
  • You use `sessionIdGenerator` but share a single `McpServer` across sessions → not affected by Issue 1 (transport re-use), but affected by Issue 2 (server re-use) if your tools send progress notifications, sampling, or elicitation during execution.
  • You are in stateless mode and reuse both a transport and a server across requests → affected by both issues; all request types can leak.
  • You are in stateless mode and create a new transport per request, but reuse the server → affected by Issue 2 only; safe if your tools only return results without sending progress notifications, sampling, or elicitation during execution.
  • You create a new server + transport per request → not affected.
  • Single-client environments (e.g., local development with one IDE) → not affected.

Patches

The fix (v1.26.0) adds runtime guards that turn silent data misrouting into immediate, actionable errors:

  1. Protocol.connect() now throws if the protocol is already connected to a transport, preventing silent transport overwriting (addresses Issue 2)
  2. Stateless StreamableHTTPServerTransport.handleRequest() now throws if called more than once, enforcing one-request-per-transport in stateless mode (addresses Issue 1)
  3. In-flight request handler abort controllers are cleaned up on close(), and sendNotification/sendRequest in handler extras check the abort signal before sending, preventing messages from leaking after a transport is replaced

Servers that were incorrectly reusing instances will now receive a clear error message directing them to create separate instances per connection.

Workarounds

If you cannot upgrade immediately, ensure your server creates fresh McpServer and transport instances for each request (stateless) or session (stateful):

// Stateless mode: create new server + transport per request
app.post('/mcp', async (req, res) => {
  const server = new McpServer({ name: 'my-server', version: '1.0.0' });
  // ... register tools, resources, etc.
  const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
  await server.connect(transport);
  await transport.handleRequest(req, res);
});

// Stateful mode: create new server + transport per session
const sessions = new Map();
app.post('/mcp', async (req, res) => {
  const sessionId = req.headers['mcp-session-id'];
  if (sessions.has(sessionId)) {
    await sessions.get(sessionId).transport.handleRequest(req, res);
  } else {
    const server = new McpServer({ name: 'my-server', version: '1.0.0' });
    // ... register tools, resources, etc.
    const transport = new StreamableHTTPServerTransport({
      sessionIdGenerator: () => randomUUID()
    });
    await server.connect(transport);
    sessions.set(transport.sessionId, { server, transport });
    await transport.handleRequest(req, res);
  }
});

Credited to gh-arpeet, ahabian.

Questions

Does my local MCP server in an IDE need this fix?

The advisory lists single-client environments, such as local development with one IDE, as not affected. Exposure needs two or more clients connected at the same time.

Will 1.26.0 break my server?

It can, if the server reuses a transport or server instance. The new guards throw an error that tells you to create separate instances for each connection.

Is stateful mode safe?

Only with a new McpServer for each session. Sharing one server across sessions avoids Issue 1 but still allows Issue 2 when tools send progress notifications, sampling or elicitation.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More MCP TypeScript SDK vulnerabilities

All MCP TypeScript SDK entries