Vulnerabilities in pkg:pypi/mcp

PACKAGE
Advisory Identifier: GHSA-84m7-p3x7-pcfv
Advisory Summary

CVE-2026-59951 is a MODERATE (CVSS 7.5) remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting MCP Python SDK libraries in the PyPI ecosystem. The issue involves unbounded session accumulation in streamablehttp transport enables resource exhaustion. Remediation is available by upgrading affected packages to version 1.30.0, 2.2.0.

7 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/mcp

7 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/mcp. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-84m7-p3x7-pcfv CVE-2026-59951 MODERATE MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion
GHSA-vj7q-gjh5-988w CVE-2026-59950 HIGH MCP Python SDK: WebSocket server transport does not support Host/Origin validation
GHSA-jpw9-pfvf-9f58 CVE-2026-52869 HIGH MCP Python SDK: HTTP transports serve session requests without verifying the authenticated principal
GHSA-hvrp-rf83-w775 CVE-2026-52870 HIGH MCP Python SDK: Experimental task handlers allow any client to access and cancel other clients' tasks
GHSA-9h52-p55h-vw2f CVE-2025-66416 HIGH Model Context Protocol (MCP) Python SDK does not enable DNS rebinding protection by default
GHSA-3qhf-m339-9g5v CVE-2025-53366 HIGH MCP Python SDK vulnerability in the FastMCP Server causes validation error, leading to DoS
GHSA-j975-95f5-7wqh CVE-2025-53365 HIGH MCP Python SDK has Unhandled Exception in Streamable HTTP Transport, Leading to Denial of Service

CVE-2026-59951 at a Glance

CVE Identifier CVE-2026-59951
GHSA Identifier GHSA-84m7-p3x7-pcfv
Severity MODERATE
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product MCP Python SDK
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-59951

To remediate this vulnerability, upgrade all affected MCP Python SDK dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mcp fixed: 1.30.0
pip install mcp>=1.30.0
mcp fixed: 2.2.0
pip install mcp>=2.2.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mcp

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-59951, inspect your installed packages using pip:

pip show mcp

Analyze the terminal output to locate any version of MCP Python SDK in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.30.0), your application is affected.

Note: The pip show mcp command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In MCP Python SDK, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-59951 Affected MCP Python SDK Versions

2 component(s)
Fixed Versions:
1.30.02.2.0
Product / Package Ecosystem Affected Versions Fixed Version
mcp
PyPI
≥ 1.8.0
< 1.30.0
1.30.0
mcp
PyPI
≥ 2.0.0
< 2.2.0
2.2.0

References

Frequently Asked Questions

What is CVE-2026-59951?
CVE-2026-59951 is a security vulnerability in MCP Python SDK involving Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion under CWE-400: Uncontrolled Resource Consumption.
Which MCP Python SDK versions are affected?
Affected versions include releases prior to 1.30.0, 2.2.0 across affected packages: mcp.
What version fixes CVE-2026-59951?
Upgrading to 1.30.0, 2.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mcp affected?
Yes, mcp is affected in releases prior to 1.30.0, 2.2.0. Upgrade your dependency to 1.30.0, 2.2.0 or later.
What is the CVSS score of CVE-2026-59951?
CVE-2026-59951 has a CVSS v3.1 base score of 7.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-59951?
CVE-2026-59951 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2026-59951?
Run the dependency tree command: 'pip show mcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-84m7-p3x7-pcfv",
  "modified" : "2026-10-15T20:13:13Z",
  "published" : "2026-10-15T20:13:13Z",
  "aliases" : [ "CVE-2026-59951" ],
  "summary" : "MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion",
  "details" : "### Summary\nIn affected versions, a Streamable HTTP server in stateful mode (the default) never reclaimed session state:\n\n- sessions did not expire;\n- a client `DELETE` ended the session but left its entry registered;\n- a session whose first request was refused stayed registered with a running task.\n\nEach 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.\n\n### Am I affected?\nYes, 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:\n\n- `FastMCP` (1.x)\n- `MCPServer` and `Server.streamable_http_app()` (2.x)\n- `StreamableHTTPSessionManager`\n\nAffected versions: 1.8.0 through 1.29.1, and 2.0.0 through 2.1.1.\n\nNot affected:\n\n- servers on 1.12.0 or later passing `stateless_http=True` (no sessions are kept)\n- servers using only the stdio or SSE transports\n\nAuthentication limits who can open sessions, not how many a token holder can open.\n\n### Fix\nUpgrade to `mcp` 1.30.0 (1.x) or 2.2.0 (2.x) or later. In those versions:\n\n- 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;\n- at most `max_sessions` sessions exist at once (default 10000); a request that would open another is answered `503`;\n- a session is discarded as soon as it ends, whether by `DELETE`, expiry, or a refused opening request.\n\nBoth settings are keyword arguments on `FastMCP(...)` (1.x), `MCPServer.run()` / `streamable_http_app()` (2.x) and `StreamableHTTPSessionManager`; `None` disables them.\n\nThis 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.\n\nIf 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.8.0"
      }, {
        "fixed" : "1.30.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59951"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/pull/3395"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/pull/3426"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/commit/92120b4b0f50385af096592d7cee932fc1d994e7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/commit/d2290ca3434731b68ea3e2270bc06a6e6575931b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/modelcontextprotocol/python-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-770", "CWE-772" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-15T20:13:13Z",
    "nvd_published_at" : "2026-10-14T17:18:29Z"
  }
}