---
id: "CVE-2026-59951"
page: "https://infrastack.ai/live/CVE-2026-59951"
kind: "vulnerability"
aliases: ["CVE-2026-59951", "GHSA-84m7-p3x7-pcfv"]
title: "MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion"
severity: "high"
cvss: 7.5
epss: 0.00458
exploited: false
status: "open"
category: "ai-tooling"
products: [{"name": "mcp", "fixed": ["1.30.0"], "affected": ">= 1.8.0, < 1.30.0", "ecosystem": "pypi"}, {"name": "mcp", "fixed": ["2.2.0"], "affected": ">= 2.0.0, < 2.2.0", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["ai-tooling", "cwe-400", "cwe-770", "cwe-772", "fastmcp", "mcp", "python", "self-hosted", "streamable-http"]
not_affected_if: ["no-untrusted-clients", "stateless-http", "stdio-or-sse-only"]
published_at: "2026-09-30T20:53:30+00:00"
first_seen_at: "2026-11-09T22:53:24+00:00"
updated_at: "2026-11-09T22:59:25+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv", "first_seen_at": "2026-11-09T22:53:24+00:00"}, {"source": "ghsa", "url": "https://github.com/advisories/GHSA-84m7-p3x7-pcfv", "first_seen_at": "2026-11-09T22:57:50+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-59951", "first_seen_at": "2026-11-09T23:10:12+00:00"}]
exploit_sources: [{"type": "epss", "score": 0.00458, "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-59951"}]
---

# MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion

Link for people: https://infrastack.ai/live/CVE-2026-59951 (this .md is for agents)

The MCP Python SDK's Streamable HTTP transport in stateful mode (the default) never expires or frees sessions, so each new session stays in memory. A client that can reach the endpoint can use ordinary short requests to grow server memory until the process is restarted.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:mcp affected >= 1.8.0, < 1.30.0 fixed 1.30.0
- pypi:mcp affected >= 2.0.0, < 2.2.0 fixed 2.2.0

## How to check

- Run `pip show mcp` (or check the lockfile) and compare the version to the affected ranges: `1.8.0` through `1.29.1`, and `2.0.0` through `2.1.1`.
- Look for `FastMCP`, `MCPServer`, `Server.streamable_http_app()` or `StreamableHTTPSessionManager` in your server code and check whether `stateless_http=True` is passed.
- Confirm whether the MCP endpoint is reachable by clients you do not fully trust.

## Fix

- `mcp` 1.x: upgrade to `1.30.0` or later
- `mcp` 2.x: upgrade to `2.2.0` or later
- Until upgraded, pass `stateless_http=True` (1.12.0 or later) where no per-session state is needed, or restrict who can reach the endpoint.

## Timeline

- 2026-11-09T22:53:24+00:00 ghsa-repo https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv
- 2026-11-09T22:57:50+00:00 ghsa https://github.com/advisories/GHSA-84m7-p3x7-pcfv
- 2026-11-09T23:10:12+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-59951

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv
- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/modelcontextprotocol/python-sdk/security-advisories/GHSA-84m7-p3x7-pcfv
- [fix] Patch: github.com https://github.com/modelcontextprotocol/python-sdk/pull/3395
- [fix] Patch: github.com https://github.com/modelcontextprotocol/python-sdk/pull/3426
- [fix] Patch: github.com https://github.com/modelcontextprotocol/python-sdk/commit/92120b4b0f50385af096592d7cee932fc1d994e7
- [fix] Patch: github.com https://github.com/modelcontextprotocol/python-sdk/commit/d2290ca3434731b68ea3e2270bc06a6e6575931b
- [fix] Release notes: github.com https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0
- [fix] Release notes: github.com https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0

## From the sources

### Summary
In affected versions, a Streamable HTTP server in stateful mode (the default) never reclaimed session state:

- sessions did not expire;
- a client `DELETE` ended the session but left its entry registered;
- a session whose first request was refused stayed registered with a running task.

Each session also kept its parsed `initialize` parameters, and the number of sessions was unlimited. A client that could reach the endpoint could grow server memory without bound using ordinary short requests; only a restart reclaimed it.

### Am I affected?
Yes, if you serve MCP over Streamable HTTP in stateful mode and clients you do not fully trust can reach the endpoint. Stateful mode is the default for:

- `FastMCP` (1.x)
- `MCPServer` and `Server.streamable_http_app()` (2.x)
- `StreamableHTTPSessionManager`

Affected versions: 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1.

Not affected:

- servers on 1.12.0 or later passing `stateless_http=True` (no sessions are kept)
- servers using only the stdio or SSE transports

Authentication limits who can open sessions, not how many a token holder can open.

### Fix
Upgrade to `mcp` 1.30.0 (1.x) or 2.2.0 (2.x) or later. In those versions:

- a session with no request in flight for `session_idle_timeout` seconds (default 1800) is closed and its ID then answers `404`; open streams and in-progress requests keep it alive;
- at most `max_sessions` sessions exist at once (default 10000); a request that would open another is answered `503`;
- a session is discarded as soon as it ends, whether by `DELETE`, expiry, or a refused opening request.

Both settings are keyword arguments on `FastMCP(...)` (1.x), `MCPServer.run()` / `streamable_http_app()` (2.x) and `StreamableHTTPSessionManager`; `None` disables them.

This bounds retention rather than eliminating it: a live session still holds its `initialize` parameters (up to roughly twice the 4 MiB body limit), and an `initialize` with invalid parameters still opens a session that expires like any other. On a small host, lower `session_idle_timeout`, `max_sessions` and `max_request_body_size` to fit.

If you cannot upgrade yet, pass `stateless_http=True` (1.12.0 or later) where you need no per-session state, or restrict who can reach the endpoint.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
