# MCP Python SDK: rejected requests leave live sessions

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/mcp-python-sdk-rejected-requests-leak-sessions
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, upgrade so rejected opening requests discard their provisional session and task. This fixes session growth after refused requests, while legitimate sessions retain separate limits. First fixed on 2.x in v2.2.0; use SDK `v2.3.0`.

**Not for:** MCP Python SDK sessions retained after a successful initialize and clean DELETE.

Subjects: github, mcp

Do first: Upgrade MCP Python SDK to `v2.3.0`.

## Symptom
@sainikhiljuluri reported that refused opening requests returning `400`, `406` or `421` still left registered, live sessions. There is no single exception string for this symptom. The discussion includes @pete-builds' independent reproduction, @finedesignz's deployment report and @Ben-Home's analysis of the same registration ordering.

## Cause
The stateful manager registered a transport and started a session task before the transport validated the opening request. Rejection did not stop that task or remove the provisional session. The merged fix discards the provisional state unless the opening request succeeds. [Merged change](https://github.com/modelcontextprotocol/python-sdk/pull/3395).

## Fix
1. Upgrade to SDK `v2.3.0`; the rejected-opening cleanup first shipped on 2.x in stable `v2.2.0`.
2. Keep request validation enabled: refused opening requests now lose their provisional session and task.
3. Treat accepted sessions separately: `session_idle_timeout` and `max_sessions` bound legitimate idle or concurrent sessions, rather than replacing rejection cleanup.

[Fix details](https://github.com/modelcontextprotocol/python-sdk/pull/3395); [November release reference](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.3.0).

## Fixed in
First stable 2.x fix: repository tag `v2.2.0` (released 2026-09-07), containing PR #3395, merged 2026-08-28. The first carrying 2.x release is stable. The [1.x backport, PR #3426](https://github.com/modelcontextprotocol/python-sdk/pull/3426), shipped earlier that day in [v1.30.0](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v1.30.0).

In `v2.3.0`, the manager records the opening response status and calls `_discard_session` when the request was not established. [Current source](https://github.com/modelcontextprotocol/python-sdk/blob/v2.3.0/src/mcp/server/streamable_http_manager.py).

## If it still fails
- This change does not prohibit legitimate clients from opening sessions. The default manager cap is 10,000; further session creation receives `503` until a slot is free.
- A session with no request in flight expires after 30 minutes by default; an open GET stream or running call keeps it alive.

Not for: MCP Python SDK sessions retained after a successful initialize and clean DELETE.

## Sources
- [Rejected streamable-HTTP requests leave live sessions behind: the session is registered before the request is validated](https://github.com/modelcontextprotocol/python-sdk/issues/3228), @sainikhiljuluri, opened 2026-07-30; closed as completed on 2026-08-28: "Every actual check lives downstream in the transport"
- [Expire idle Streamable HTTP sessions by default and cap concurrent sessions](https://github.com/modelcontextprotocol/python-sdk/pull/3395), @maxisbey; closed, merged 2026-08-28.
- [v2.2.0](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.2.0), published 2026-09-07.
- [v2.3.0: November release reference](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.3.0), published 2026-10-02.
- [src/mcp/server/streamable_http_manager.py at v2.3.0](https://github.com/modelcontextprotocol/python-sdk/blob/v2.3.0/src/mcp/server/streamable_http_manager.py).
- [docs/run/legacy-clients.md at v2.3.0](https://github.com/modelcontextprotocol/python-sdk/blob/v2.3.0/docs/run/legacy-clients.md).

## Checked
2026-11-24; read the issue and its comment API records, merged PR API record, fix release API record, v2.3.0 release API record and the tagged source pages listed above; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.