{"id":"CVE-2026-59951","kind":"vulnerability","aliases":["CVE-2026-59951","GHSA-84m7-p3x7-pcfv"],"related":[],"title":"MCP Python SDK: Unbounded Session Accumulation in StreamableHTTP Transport Enables Resource Exhaustion","description":"### 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.","summary":"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.","severity":"high","cvss":7.5,"epss":0.00458,"exploited":false,"exploited_at":null,"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"],"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`.\n- Look for `FastMCP`, `MCPServer`, `Server.streamable_http_app()` or `StreamableHTTPSessionManager` in your server code and check whether `stateless_http=True` is passed.\n- 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\n- `mcp` 2.x: upgrade to `2.2.0` or later\n- 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.","status":"open","published_at":"2026-09-30T20:53:30+00:00","first_seen_at":"2026-11-09T22:53:24+00:00","triaged_at":"2026-11-09T22:59:25+00:00","updated_at":"2026-11-09T22:59:25+00:00","category":"ai-tooling","confidence":0.9,"triage":{"at":"2026-11-09T22:59:25Z","model":"claude-haiku-5-5","output":{"fix":"- `mcp` 1.x: upgrade to `1.30.0` or later\n- `mcp` 2.x: upgrade to `2.2.0` or later\n- 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.","reach":"internet","title":"MCP Python SDK: unbounded sessions let remote clients exhaust server memory","impact":"medium","summary":"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.","audience":"developers","category":"ai-tooling","nicknames":[],"who_cares":["mcp","python","streamable-http","fastmcp","self-hosted"],"confidence":0.9,"fix_status":"available","needs_auth":"no","worst_case":"remote clients exhaust server memory until the process restarts","analyst_note":"","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`.\n- Look for `FastMCP`, `MCPServer`, `Server.streamable_http_app()` or `StreamableHTTPSessionManager` in your server code and check whether `stateless_http=True` is passed.\n- Confirm whether the MCP endpoint is reachable by clients you do not fully trust.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["stdio-or-sse-only","stateless-http","no-untrusted-clients"],"who_is_affected":"Servers that run the MCP Python SDK over Streamable HTTP in stateful mode, which is the default, and where clients you do not fully trust can reach the endpoint. Authentication limits who can open sessions but not how many a token holder can open. Servers using only stdio or SSE transports, or stateless Streamable HTTP on 1.12.0 or later, are not affected.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"yes","severity_if_unknown":"unknown"},"cost_usd":0.000949,"input_tokens":5591,"output_tokens":779,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':14A,22A '-400':30B '-59951':15A,23A '-770':32B '-772':34B '1':204C,265C,352C '1.12.0':227C,430C '1.29.1':218C '1.30.0':264C '1.8.0':216C '10000':317C '1800':289C '2':211C,269C,358C '2.0.0':220C '2.1.1':222C '2.2.0':268C '4':385C '404':297C '503':326C '84m7':18A 'accumul':6A 'affect':92C,174C,214C,224C 'ai':27B 'ai-tool':26B 'aliv':307C 'also':137C 'anoth':323C 'answer':296C,325C 'app':210C,357C 'argument':349C 'authent':246C 'bodi':387C,417C 'bound':162C,366C 'cannot':423C 'client':70B,112C,151C,187C 'close':291C 'could':153C,157C 'cve':13A,21A 'cwe':29B,31B,33B 'default':56B,102C,201C,288C,316C 'delet':113C,338C 'disabl':363C 'discard':330C 'elimin':370C 'enabl':10A 'end':114C,335C 'endpoint':75B,156C,196C,447C 'entri':120C 'exhaust':12A 'exist':313C 'expir':58B,110C,400C 'expiri':339C 'fastmcp':35B,203C,351C 'first':125C 'fit':420C 'fix':260C 'flight':282C 'free':60B 'fulli':191C 'ghsa':17A 'ghsa-84m7-p3x7-pcfv':16A 'grow':82B,158C 'hold':376C 'holder':257C 'host':40B,407C 'http':43B,50B,96C,182C,209C,232C,356C,428C 'id':294C 'idl':285C,410C 'in-progress':301C 'initi':141C,378C,391C 'invalid':393C 'keep':305C 'kept':138C,237C 'keyword':348C 'later':229C,272C,432C 'left':118C 'like':401C 'limit':247C,388C 'live':373C 'lower':408C 'mani':254C 'max':310C,412C,415C 'mcp':1A,24A,25A,36B,45B,179C,263C 'mcpserver':206C 'mcpserver.run':354C 'memori':68B,84B,160C 'mib':386C 'mode':54B,100C,185C,198C 'need':435C 'never':57B,103C 'new':64B 'none':362C 'number':145C 'open':250C,259C,298C,322C,343C,396C 'ordinari':78B,164C 'p3x7':19A 'paramet':142C,379C,394C 'pars':140C 'pass':230C,426C 'pcfv':20A 'per':438C 'per-sess':437C 'process':87B 'progress':303C 'python':2A,37B,46B 'rather':368C 'reach':73B,154C,194C,445C 'reclaim':104C,170C 'refus':128C,342C 'regist':121C,130C 'request':80B,126C,166C,280C,304C,319C,344C,416C 'resourc':11A 'restart':89B,169C 'restrict':442C 'retent':367C 'rough':382C 'run':133C 'sdk':3A,47B 'second':287C 'self':39B 'self-host':38B 'serv':178C 'server':83B,97C,159C,225C,238C 'server.streamable':208C 'session':5A,61B,65B,105C,107C,116C,123C,136C,147C,235C,251C,277C,284C,311C,312C,328C,374C,398C,409C,413C,439C 'set':346C 'short':79B,165C 'size':418C 'small':406C 'soon':332C 'sse':244C 'state':53B,99C,106C,184C,197C,440C 'stateless':231C,427C 'stay':66B,129C 'stdio':242C 'still':375C,395C 'stream':299C 'streamabl':42B,49B,95C,181C,355C 'streamable-http':41B 'streamablehttp':8A 'streamablehttpsessionmanag':213C,361C 'summari':90C 'task':134C 'timeout':286C,411C 'token':256C 'tool':28B 'transport':9A,51B,245C 'true':233C,429C 'trust':192C 'twice':383C 'unbound':4A 'unlimit':149C 'upgrad':261C,424C 'use':77B,163C,239C 'version':93C,215C,275C 'whether':336C 'whose':124C 'without':161C 'would':321C 'x':205C,212C,266C,270C,353C,359C 'yes':175C 'yet':425C","nicknames":[],"mitigations":[],"who_affected":"Servers that run the MCP Python SDK over Streamable HTTP in stateful mode, which is the default, and where clients you do not fully trust can reach the endpoint. Authentication limits who can open sessions but not how many a token holder can open. Servers using only stdio or SSE transports, or stateless Streamable HTTP on 1.12.0 or later, are not affected.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["mcp"],"ptokens":["mcp"],"labels":["aitooling","cwe400","cwe770","cwe772","fastmcp","high","mcp","pypi","python","selfhosted","streamablehttp"],"campaign_type":null,"search_a":"'-2026':14A,22A '-59951':15A,23A '84m7':18A 'accumul':6A 'cve':13A,21A 'enabl':10A 'exhaust':12A 'ghsa':17A 'ghsa-84m7-p3x7-pcfv':16A 'mcp':1A,24A,25A 'p3x7':19A 'pcfv':20A 'python':2A 'resourc':11A 'sdk':3A 'session':5A 'streamablehttp':8A 'transport':9A 'unbound':4A","search_b":"'-400':30B '-770':32B '-772':34B 'ai':27B 'ai-tool':26B 'client':70B 'cwe':29B,31B,33B 'default':56B 'endpoint':75B 'expir':58B 'fastmcp':35B 'free':60B 'grow':82B 'host':40B 'http':43B,50B 'mcp':36B,45B 'memori':68B,84B 'mode':54B 'never':57B 'new':64B 'ordinari':78B 'process':87B 'python':37B,46B 'reach':73B 'request':80B 'restart':89B 'sdk':47B 'self':39B 'self-host':38B 'server':83B 'session':61B,65B 'short':79B 'state':53B 'stay':66B 'streamabl':42B,49B 'streamable-http':41B 'tool':28B 'transport':51B 'use':77B","search_c":"'1':204C,265C,352C '1.12.0':227C,430C '1.29.1':218C '1.30.0':264C '1.8.0':216C '10000':317C '1800':289C '2':211C,269C,358C '2.0.0':220C '2.1.1':222C '2.2.0':268C '4':385C '404':297C '503':326C 'affect':92C,174C,214C,224C 'aliv':307C 'also':137C 'anoth':323C 'answer':296C,325C 'app':210C,357C 'argument':349C 'authent':246C 'bodi':387C,417C 'bound':162C,366C 'cannot':423C 'client':112C,151C,187C 'close':291C 'could':153C,157C 'default':102C,201C,288C,316C 'delet':113C,338C 'disabl':363C 'discard':330C 'elimin':370C 'end':114C,335C 'endpoint':156C,196C,447C 'entri':120C 'exist':313C 'expir':110C,400C 'expiri':339C 'fastmcp':203C,351C 'first':125C 'fit':420C 'fix':260C 'flight':282C 'fulli':191C 'grow':158C 'hold':376C 'holder':257C 'host':407C 'http':96C,182C,209C,232C,356C,428C 'id':294C 'idl':285C,410C 'in-progress':301C 'initi':141C,378C,391C 'invalid':393C 'keep':305C 'kept':138C,237C 'keyword':348C 'later':229C,272C,432C 'left':118C 'like':401C 'limit':247C,388C 'live':373C 'lower':408C 'mani':254C 'max':310C,412C,415C 'mcp':179C,263C 'mcpserver':206C 'mcpserver.run':354C 'memori':160C 'mib':386C 'mode':100C,185C,198C 'need':435C 'never':103C 'none':362C 'number':145C 'open':250C,259C,298C,322C,343C,396C 'ordinari':164C 'paramet':142C,379C,394C 'pars':140C 'pass':230C,426C 'per':438C 'per-sess':437C 'progress':303C 'rather':368C 'reach':154C,194C,445C 'reclaim':104C,170C 'refus':128C,342C 'regist':121C,130C 'request':126C,166C,280C,304C,319C,344C,416C 'restart':169C 'restrict':442C 'retent':367C 'rough':382C 'run':133C 'second':287C 'serv':178C 'server':97C,159C,225C,238C 'server.streamable':208C 'session':105C,107C,116C,123C,136C,147C,235C,251C,277C,284C,311C,312C,328C,374C,398C,409C,413C,439C 'set':346C 'short':165C 'size':418C 'small':406C 'soon':332C 'sse':244C 'state':99C,106C,184C,197C,440C 'stateless':231C,427C 'stay':129C 'stdio':242C 'still':375C,395C 'stream':299C 'streamabl':95C,181C,355C 'streamablehttpsessionmanag':213C,361C 'summari':90C 'task':134C 'timeout':286C,411C 'token':256C 'transport':245C 'true':233C,429C 'trust':192C 'twice':383C 'unlimit':149C 'upgrad':261C,424C 'use':163C,239C 'version':93C,215C,275C 'whether':336C 'whose':124C 'without':161C 'would':321C 'x':205C,212C,266C,270C,353C,359C 'yes':175C 'yet':425C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-09-30T20:53:30+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa-repo","external_id":"GHSA-84m7-p3x7-pcfv","url":"https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv","severity":"high","published_at":"2026-09-30T20:53:30+00:00","modified_at":"2026-09-30T20:53:30+00:00","first_seen_at":"2026-11-09T22:53:24+00:00","fetched_at":"2026-11-09T22:53:24+00:00","note":null},{"source":"ghsa","external_id":"GHSA-84m7-p3x7-pcfv","url":"https://github.com/advisories/GHSA-84m7-p3x7-pcfv","severity":"medium","published_at":"2026-10-15T20:13:13+00:00","modified_at":"2026-10-15T20:13:14+00:00","first_seen_at":"2026-11-09T22:57:50+00:00","fetched_at":"2026-11-09T22:57:50+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-59951","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59951","severity":null,"published_at":"2026-10-14T17:18:29+00:00","modified_at":"2026-10-16T16:00:33+00:00","first_seen_at":"2026-11-09T23:10:12+00:00","fetched_at":"2026-11-09T23:10:12+00:00","note":null}],"documents":[{"id":110614,"url":"https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa-repo","publisher":"vendor","text":null,"published_at":"2026-09-30T20:53:30+00:00","relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"},{"id":110905,"url":"https://api.github.com/repos/modelcontextprotocol/python-sdk/security-advisories/GHSA-84m7-p3x7-pcfv","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":110907,"url":"https://github.com/modelcontextprotocol/python-sdk/pull/3395","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":110908,"url":"https://github.com/modelcontextprotocol/python-sdk/pull/3426","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":110909,"url":"https://github.com/modelcontextprotocol/python-sdk/commit/92120b4b0f50385af096592d7cee932fc1d994e7","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":110910,"url":"https://github.com/modelcontextprotocol/python-sdk/commit/d2290ca3434731b68ea3e2270bc06a6e6575931b","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":48360,"url":"https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"},{"id":48361,"url":"https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"}],"disclosures":[],"exploit_sources":[{"type":"epss","score":0.00458,"url":"https://api.first.org/data/v1/epss?cve=CVE-2026-59951"}],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}