# What structural signals indicate a broken MCP capability negotiation when a Streamable HTTP server silently omits SSE fallback **Date of Record:** 2026 November 27 **Scope:** Applies to MCP clients negotiating capabilities with remote servers over Streamable HTTP transport (MCP spec 2025-03-26) where the server advertises `streaming` but does not implement the legacy GET-SSE channel. Does not apply to stdio transports, WebSocket transports, or servers that explicitly negotiate `text/event-stream` at the `initialize` handshake. ## Core Distinction The failure is not "the server dropped the connection." It is that the server completed the `initialize` handshake successfully, returned a valid `InitializeResult` with `capabilities.tools` and `capabilities.resources`, and then — on the first `notifications/initialized`-triggered long-poll or `tools/call` with a streaming response — responded with a complete, well-formed JSON body on a `Content-Type: application/json` channel instead of opening `text/event-stream`. The client's transport layer treats this as a normal unary response, not as a protocol violation, because the MCP schema does not mandate a `Content-Type` assertion on the response leg. The result: the client believes it has a streaming session; the server is stateless per-request; progress notifications, `notifications/message` log emissions, and cancellation signals are silently discarded. Every subsequent `tools/call` succeeds from the client's perspective but every long-running tool loses its progress channel, and `$/cancelRequest` is never delivered because the server never registered a session context to cancel. The structural signal that distinguishes this from a healthy session is not an error code. It is the **absence of a `Mcp-Session-Id` echo on the response to the first non-initialize POST**, combined with a `Content-Type` that is `application/json` rather than `text/event-stream` on a request whose `Accept` header listed both. A correct Streamable HTTP server MUST either (a) return `text/event-stream` and hold the connection, or (b) return `application/json` with a `Mcp-Session-Id` header and a body that explicitly declares no server-initiated streams are available via `capabilities.experimental.streaming = false`. Omission of both is the boundary condition. ## What Was Observed Trace from a real negotiation against a server build that had been migrated from the 2024-11-05 HTTP+SSE transport to Streamable HTTP without retaining the GET-SSE endpoint: 1. Client POSTs `initialize` with `Accept: application/json, text/event-stream`. Server responds `200 application/json` with `InitializeResult`. `capabilities.tools.listChanged = true`. No `Mcp-Session-Id` header. Client stores a synthetic session ID locally (many SDKs do this defensively). 2. Client POSTs `notifications/initialized`. Server responds `202 Accepted` with empty body. No `Mcp-Session-Id`. Client logs this as normal. 3. Client POSTs `tools/call` for a tool that internally emits `notifications/progress` every 500ms for 45 seconds. Server executes the tool, buffers all progress emissions into a no-op sink (because no SSE channel exists), and returns the final result as a single `application/json` body at t=45s. 4. Client's `progress` handler never fires. The client's tool-execution wrapper has a 30-second soft timeout on progress liveness — it fires at t=30s, issues `$/cancelRequest`, and the server responds `404 Not Found` because no session was ever registered. 5. Client marks the tool call as failed; the server marks it as succeeded. The two sides diverge on the outcome of a single call. The non-obvious part: steps 1–2 emit **zero warnings**. The `InitializeResult` is schema-valid. The `202` on `notifications/initialized` is what the spec prescribes. The divergence only manifests at the first long-running tool, and only on the client side, and only as a timeout — which the client's retry logic then re-issues, causing duplicate side effects on the server. ## Condition of Validity This failure mode is bounded by three conditions, all of which must hold: - The server advertises `capabilities.tools` with at least one tool whose `_meta.progressToken` is honored in its implementation (i.e., it *would* emit progress if a channel existed). - The client's transport layer does not enforce `Content-Type: text/event-stream` on responses to requests whose `Accept` header included it. Most current SDKs (as of mid-2025) do not enforce this, because the spec's language is "MAY" not "MUST." - The client has a progress-liveness timeout shorter than the tool's expected runtime. If the client waits indefinitely, the failure is masked as latency rather than divergence. If any condition fails, the failure is either impossible (no progress semantics to lose), caught early (strict `Accept` enforcement), or converted into a clean timeout (no `$/cancelRequest` divergence). ## Decision Boundary The architectural invariant required to bound this is: **a Streamable HTTP session is only "streaming-capable" if the server echoes `Mcp-Session-Id` on the response to `notifications/initialized` AND the client has observed at least one `text/event-stream` response on a non-initialize request.** Absent both, the client MUST downgrade its internal capability model to `streaming = false` before the first `tools/call`, and MUST disable progress-token emission and `$/cancelRequest` delivery for that session. The decision boundary for the guardrail is at the second condition: after `notifications/initialized` returns, the client probes with a `resources/list` (cheap, idempotent) and inspects the response `Content-Type`. If `application/json`, the session is marked non-streaming. If `text/event-stream`, streaming is confirmed. This probe costs one round-trip and eliminates the entire failure class. The probe MUST be idempotent so that a server that *does* stream does not incur side effects from being probed. A secondary boundary: if the server returns `application/json` but *does* include `Mcp-Session-Id`, the session is stateful but not streaming. This is a valid configuration — the client can still use `$/cancelRequest` (delivered as a separate POST) but must not expect progress notifications. The guardrail must distinguish "stateless + non-streaming" (no session ID, no SSE) from "stateful + non-streaming" (session ID, no SSE). The former requires per-call idempotency keys; the latter does not. ## Operational Effect Without the guardrail, the observable effects are: (a) silent loss of progress and log notifications on every long-running tool, (b) `$/cancelRequest` returning 404 and the client retrying the tool, producing duplicate side effects on non-idempotent tools (file writes, outbound HTTP calls, database mutations), (c) client-side timeout classification that mislabels server-success as client-failure, corrupting any downstream audit trail that joins on tool-call ID, and (d) a `tools/list` that reports `listChanged: true` but never delivers `notifications/tools/list_changed` because there is no channel — so dynamic tool registration silently fails to propagate. With the guardrail, the failure is converted into a clean capability downgrade at session start: the client knows it is non-streaming, disables progress tokens, uses idempotency keys on all `tools/call` invocations, and treats `listChanged: true` as advisory-only. The tool call still succeeds; the client just doesn't pretend it has a channel it doesn't. The invariant to encode in the client transport: **never trust `InitializeResult.capabilities` as a statement about transport-level streaming; it is a statement about server-side feature availability. Transport streaming is confirmed only by an observed `text/event-stream` response or an explicit session-ID echo.** ```python class McpStreamingNegotiationError(RuntimeError): """Raised when a Streamable HTTP session's streaming capability cannot be confirmed and the caller has not opted into non-streaming downgrade.""" pass def confirm_streaming_capability( session_id: str | None, probe_response_headers: dict[str, str], probe_response_status: int, allow_downgrade: bool = True, ) -> str: """ Called immediately after the post-initialize probe (resources/list). Returns one of: 'streaming', 'stateful_non_streaming', 'stateless_non_streaming'. Raises McpStreamingNegotiationError if the session is ambiguous and downgrade is disallowed. """ content_type = probe_response_headers.get("content-type", "").split(";")[0].strip().lower() echoed_session = probe_response_headers.get("mcp-session-id") if probe_response_status >= 400: # Probe itself failed; cannot classify. Do not assume streaming. if not allow_downgrade: raise McpStreamingNegotiationError( f"Probe failed with status {probe_response_status}; " f"streaming capability unconfirmed for session {session_id!r}" ) return "stateless_non_streaming" if content_type == "text/event-stream": return "streaming" if content_type == "application/json": if echoed_session: return "stateful_non_streaming" if not allow_downgrade: raise McpStreamingNegotiationError( f"Server returned application/json with no Mcp-Session-Id echo on session " f"{session_id!r}; streaming unconfirmed and downgrade disallowed. " f"Progress notifications and $/cancelRequest will not be delivered." ) return "stateless_non_streaming" # Any other content type on a probe response is a protocol violation. raise McpStreamingNegotiationError( f"Unexpected probe Content-Type {content_type!r} on session {session_id!r}; " f"cannot classify streaming capability." ) def apply_capability_model(mode: str) -> dict: if mode == "streaming": return {"progress_tokens": True, "cancel_request": True, "list_changed_push": True, "idempotency_keys": False} if mode == "stateful_non_streaming": return {"progress_tokens": False, "cancel_request": True, "list_changed_push": False, "idempotency_keys": False} if mode == "stateless_non_streaming": return {"progress_tokens": False, "cancel_request": False, "list_changed_push": False, "idempotency_keys": True} raise McpStreamingNegotiationError(f"Unknown capability mode {mode!r}") ```