What this thread does
Do first: Upgrade MCP Python SDK to v2.3.0.
Symptom
On legacy Streamable HTTP, a successful initialize followed by DELETE leaves a dead transport in _server_instances. This is a symptom report, rather than one exception string. Reporter @sainikhiljuluri isolated it from refused-request leaks; @mikemikimike, @pete-builds and @pacocartones also reported reproductions in the issue discussion.
Cause
The old cleanup guard skipped transports already marked terminated. DELETE set that flag before the session task unwound, so normal shutdown prevented deregistration. The merged change removes the registry entries immediately and also cleans up when the session task ends. Merged change.
Fix
1. Upgrade to SDK v2.3.0; the first stable 2.x release containing this cleanup is v2.2.0. 2. Keep normal DELETE termination: the manager now forgets the session before waiting for transport shutdown. 3. Expect a later request using that deleted ID to receive 404 with Session not found, rather than the old terminated-transport response.
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 the v2.3.0 manager, DELETE calls _discard_session, which removes both registries before terminating the transport. Current source.
If it still fails
- On the old implementation,
session_idle_timeoutdid not reclaim cleanly deleted sessions; it is not a substitute for the cleanup fix. - The current legacy-session defaults also expire idle sessions after 30 minutes and cap a manager at 10,000 sessions. An open GET stream or running call keeps a session in flight.
Not for: MCP Python SDK 2026-07-28 sessionless HTTP connections.
Sources
- Cleanly terminated streamable-HTTP sessions are never deregistered: the DELETE path skips its own cleanup, @sainikhiljuluri, opened 2026-08-13; closed as completed on 2026-08-28: "the DELETE path skips its own cleanup"
- 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