# What happens when an instance migrates an MCP session from resumable SSE to streamable HTTP mid-tool-call and the negotiated capability set silently regresses **Date of Record:** 2026 November 23 **Scope:** Applies to MCP clients that hold a live session across a transport upgrade (legacy resumable SSE → streamable HTTP) while a server-side tool invocation is in flight, and where per-tool capabilities were negotiated at session init. Does not apply to fresh sessions initiated directly over streamable HTTP, nor to stateless one-shot request/response tool calls with no resumption token outstanding. ## Core Distinction There are two distinct notions of "the session survived the migration," and conflating them is the entire failure. The *transport-level* session ID (`Mcp-Session-Id`) is a string the server hands back and the client echoes; it survives a transport swap trivially because it is just a header value. The *capability-level* session is the negotiated tuple of `(protocolVersion, capabilities, toolSchemas)` agreed during `initialize`. These two can desynchronize: the transport handshake succeeds and returns a valid session ID, while the capability tuple the server now enforces is a *default* tuple, not the one the client believes is active. The boundary condition is this: **a resumable-SSE session that carries an outstanding `Last-Event-ID` resumption token and an in-flight tool call, when migrated to streamable HTTP, will re-handshake the transport without re-negotiating capabilities.** The server treats the new streamable-HTTP POST as a fresh transport binding to an existing logical session, applies its default per-tool capability profile, and the client continues issuing tool calls under its stale belief about which optional tool features (e.g. `outputSchema` validation, structured-content return, progress notifications) are enabled. The regression is silent because no error is raised at migration time — only later, when a tool call exercises a capability that was negotiated-on but is now defaulted-off (or vice versa). ## What Was Observed A client maintained a long-lived SSE session against an MCP server. During `initialize`, the client and server agreed on a capability set including `tools.progressNotifications: true` and a specific `outputSchema` for `filesystem.read`. The client then issued `tools/call` for a long-running `filesystem.scan` operation. The SSE stream carried partial progress events; the client recorded `Last-Event-ID: 47` and had received 47 progress frames but not the terminal result. The client's transport layer decided to upgrade to streamable HTTP (a policy triggered by a connection-quality heuristic). It opened a streamable-HTTP POST to the same endpoint, presented the existing `Mcp-Session-Id`, and included `Last-Event-ID: 47` in the resumption header. The server accepted the POST, bound the new stream to the existing logical session, and **returned 200 with an empty event stream** — no replay of events 48+, because the server's streamable-HTTP handler did not implement `Last-Event-ID` replay for the migrated binding; it only implemented it for native SSE connections. Observed state transitions: 1. `initialize` → capability tuple `C_negotiated = {progress: on, outputSchema: filesystem.read:v2}`. 2. `tools/call filesystem.scan` → SSE stream, events 1..47 delivered, `Last-Event-ID=47` recorded, terminal result pending. 3. Transport swap → streamable HTTP POST with `Mcp-Session-Id` + `Last-Event-ID: 47`. 4. Server binds transport, **does not replay**, applies `C_default = {progress: off, outputSchema: filesystem.read:v1}` to the migrated session. 5. Client believes `C_negotiated` is active; issues `tools/call filesystem.read` expecting `v2` schema and progress frames. 6. Server returns `v1`-shaped result with no progress frames. Client's schema validator rejects the result as malformed and retries — but the retry is now a *new* tool call on a session whose capability tuple the client still mis-models. The failure is not the missing replay (that is a known, documentable transport limitation). The failure is the **capability regression that occurs silently alongside it**: the client has no signal that `C_negotiated ≠ C_default`, because the streamable-HTTP binding returned a valid session ID and a 200, and MCP has no post-migration capability re-assertion step in the base protocol. ## Condition of Validity This failure mode is valid — i.e., it can occur — only when *all* of the following hold: - The client and server negotiated a **non-default** capability tuple at `initialize` (at least one optional tool feature differs from server defaults). - A tool call is **in flight** (outstanding resumption token or pending terminal result) at the moment of transport migration. - The server's streamable-HTTP handler **binds to the existing logical session** rather than forcing a fresh `initialize` (this is the common, spec-permitted behavior — session reuse across transports is allowed). - The server **does not re-emit or re-validate the capability tuple** on the new transport binding (the base MCP spec does not mandate this; it is an implementation choice). If any one of these fails, the regression cannot occur: a fresh `initialize` re-negotiates cleanly; a server that rejects cross-transport session reuse forces a clean restart; a server that re-asserts capabilities on rebind closes the gap. The dangerous quadrant is precisely *session reuse + no capability re-assertion + non-default tuple + in-flight call*. ## Decision Boundary The architectural invariant required to bound this is: **capability tuples are bound to the transport binding, not merely to the logical session ID.** Concretely, a server MUST treat a transport rebind as a capability re-negotiation event, and a client MUST treat any transport migration as invalidating its cached capability model until the server re-confirms it. Two guardrails make this operational: 1. **Server-side rebind assertion.** On any POST that presents an existing `Mcp-Session-Id` over a *different* transport than the one the session was initialized on, the server must include a `Mcp-Capabilities` re-assertion header (or an equivalent `notifications/capabilities/changed` event as the first frame on the new stream) carrying the tuple it will actually enforce. If the enforced tuple differs from `C_negotiated`, the client is obligated to either re-`initialize` or explicitly accept the downgrade before issuing further tool calls. 2. **Client-side migration barrier.** A client must not issue a tool call after a transport migration until it has received either (a) the re-assertion matching `C_negotiated`, or (b) an explicit downgrade acceptance. The resumption token must be treated as *transport-scoped*, not session-scoped: a `Last-Event-ID` from an SSE binding is not valid on a streamable-HTTP binding unless the server explicitly advertises cross-transport replay support (a capability, itself, that must be negotiated). The decision boundary for the operator is: **if the server cannot re-assert capabilities on rebind and cannot replay across transports, the client must force a full re-`initialize` on migration and accept the loss of the in-flight call's progress state.** There is no safe middle path where the transport migrates but the capability tuple and resumption token are assumed to carry over. ## Operational Effect The practical consequence is a class of failures that look like *tool-output schema mismatches* or *missing progress events* but are actually *capability-tuple desynchronization across a transport boundary*. Operators debugging these see a valid session ID, a 200 response, and a malformed tool result — and waste time inspecting the tool implementation rather than the session's capability state. The compounding effect: because the client's schema validator rejects the `v1`-shaped result, it retries. Each retry is a new `tools/call` on a session whose enforced tuple is `C_default`. If the tool is non-idempotent (e.g. `filesystem.scan` with side effects, or a write tool), the retries produce duplicate side effects. The capability regression thus amplifies into a **duplicate-execution hazard** — the same failure family as a lost `Last-Event-ID` replay, but triggered by the capability mismatch rather than the missing events. The invariant that prevents this: **a transport migration is a capability boundary, and the in-flight-call state (resumption token + pending result) is only valid within the transport binding that produced it.** Cross-binding resumption requires explicit, negotiated support; absent that, migration must be treated as a session reset for capability and resumption purposes, with the client re-`initialize`-ing and the operator accepting that the in-flight call is abandoned (and must be reconciled out-of-band if it had side effects). ```python class CapabilityTransportDesyncError(RuntimeError): """Raised when a session's enforced capability tuple diverges from the tuple negotiated at initialize, across a transport rebind.""" pass DEFAULT_CAPABILITIES = { "progressNotifications": False, "outputSchema": {"filesystem.read": "v1"}, } def rebind_transport(session, new_transport: str, last_event_id: str | None): """Bind an existing logical session to a new transport. Returns the capability tuple the server will enforce on the new binding. Raises CapabilityTransportDesyncError if the enforced tuple differs from the negotiated tuple and the client has not explicitly accepted a downgrade. """ negotiated = session.capabilities enforced = session.server_default_capabilities or DEFAULT_CAPABILITIES # A resumption token from one transport binding is not valid on another # unless the server explicitly advertises cross-transport replay. if last_event_id is not None and new_transport != session.transport: if not session.server_supports_cross_transport_replay: raise CapabilityTransportDesyncError( f"resumption token {last_event_id!r} from {session.transport!r} " f"is not valid on {new_transport!r}; server does not advertise " f"cross-transport replay" ) if enforced != negotiated: if not session.client_accepts_downgrade: raise CapabilityTransportDesyncError( f"capability tuple regressed on rebind to {new_transport!r}: " f"negotiated={negotiated!r} enforced={enforced!r}; " f"client must re-initialize or explicitly accept downgrade " f"before issuing further tool calls" ) session.capabilities = enforced session.transport = new_transport return enforced ```