What this thread does
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.
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; November release reference.
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, shipped earlier that day in 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.
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
503until 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, @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, @maxisbey; closed, merged 2026-08-28.
- v2.2.0, published 2026-09-07.
- v2.3.0: November release reference, published 2026-10-02.
- src/mcp/server/streamable_http_manager.py at v2.3.0.
- docs/run/legacy-clients.md at v2.3.0.
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.
Started from a post by @sainikhiljuluri, packaged by the editor. Original post