{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-sse-stream-resumption-from-session-resumption-in-mcp-http-native-transport",
  "title": "How should an instance distinguish SSE stream resumption from session resumption in MCP HTTP-native transport",
  "date_of_record": "2026 November 9",
  "scope": "Applies to MCP servers and clients using the HTTP-native transport with `text/event-stream` responses, `Last-Event-ID` resumption, and the `Mcp-Session-Id` header. Does not apply to stdio transport, nor to plain JSON request/response MCP endpoints that never emit SSE.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-sse-stream-resumption-from-session-resumption-in-mcp-http-native-transport.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-sse-stream-resumption-from-session-resumption-in-mcp-http-native-transport.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-sse-stream-resumption-from-session-resumption-in-mcp-http-native-transport.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1498,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "In MCP's HTTP-native transport, two independent resumability mechanisms coexist and are routinely conflated: 1. **Stream resumption** — a broken SSE connection is re-established by the client sending `Last-Event-ID`, asking the server to replay events after that ID on the *same logical stream*. This is governed by SSE semantics and is scoped to a single HTTP...",
    "what_was_observed": "A server implemented event replay keyed on a monotonic event counter stored per session, not per stream. Client A opened a stream, received events 1–5, and the connection dropped. Client A reconnected with `Last-Event-ID: 5` and `Mcp-Session-Id: S`. The server replayed events 6–9 — correct. Later, Client A's process restarted, discarded its event ID, and reconnected with only `Mcp-Session-Id: S`. The server, seeing a...",
    "condition_of_validity": "The separation holds only when all of the following are true: - The server maintains a **per-stream** event buffer distinct from the **per-session** state, and `Last-Event-ID` lookups are scoped to the stream that emitted that ID (or to a session-scoped log whose entries are tagged with the stream they belong to). - Pending server-to-client requests are stor...",
    "decision_boundary": "On reconnect, the server must branch on the *combination* of headers, not either alone: - `Mcp-Session-Id` present, `Last-Event-ID` present, ID valid for that session → **stream resumption**: replay events after the ID on the new stream, do not re-emit already-delivered pending requests, do not reset session state. - `Mcp-Session-Id` present, `Last-Event-ID`...",
    "operational_effect": "When the boundary is respected, client restarts and flaky connections are recoverable without duplicate side effects, and server-initiated requests survive stream churn. When it is violated, the observable symptoms are (a) `tools/call` duplication after client restart with a stale event ID, (b) permanently pending `sampling`/`elicitation` requests that time ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "edd3f148db330e64d9ca33962196afea9f8b6fb6874713e0966f0be539d73d8f",
    "verified_classes": [
      "ResumptionBoundaryError",
      "StreamEventLog"
    ],
    "verified_functions": [
      "handle_reconnect",
      "__init__",
      "register_session",
      "append",
      "queue_server_request",
      "resume"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResumptionBoundaryError"
    ],
    "sample_fail_closed_invariants": [
      "Last-Event-ID supplied without Mcp-Session-Id; event IDs are stream-scoped and cannot be interpreted without a session",
      "no Mcp-Session-Id; client must establish a session before resuming"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
