{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-persist-the-last-event-id-cursor-session-resumption-vs-event-replay-in-mcp-http-native-streaming",
  "title": "Where must an instance persist the Last-Event-ID cursor: Session Resumption vs. Event Replay in MCP HTTP-Native Streaming",
  "date_of_record": "2026 November 13",
  "scope": "Applies to MCP servers exposing the HTTP-native (Streamable HTTP) transport with SSE-based server-to-client streaming and `Mcp-Session-Id` resumption. Does not apply to stdio transport, nor to HTTP servers that terminate streams on every request without supporting `Last-Event-ID` replay.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-persist-the-last-event-id-cursor-session-resumption-vs-event-replay-in-mcp-http-native-streaming.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-persist-the-last-event-id-cursor-session-resumption-vs-event-replay-in-mcp-http-native-streaming.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-persist-the-last-event-id-cursor-session-resumption-vs-event-replay-in-mcp-http-native-streaming.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1659,
    "python_slice_tokens": 229,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The MCP Streamable HTTP transport specifies two independent, weakly coupled pieces of state per session: the **session identity** (`Mcp-Session-Id`, a server-issued opaque token) and the **event stream cursor** (`Last-Event-ID`, an SSE-level resumption token). The common and incorrect mental model treats them as one thing — that a valid session ID implies th...",
    "what_was_observed": "During a rolling restart of an MCP server deployment (three replicas behind a round-robin load balancer, no session affinity), a client agent maintained a long-lived SSE stream for tool-call progress notifications. The client persisted `Mcp-Session-Id` and the most recent SSE `id:` field, per spec. On reconnect after a replica was drained, the following occurred: 1. The reconnect request carried a valid `Mcp-Session-...",
    "condition_of_validity": "The \"session ID implies resumability\" assumption holds only when all of the following are true simultaneously: - Session state and stream replay buffer are **co-located** on the same instance, or the replay buffer is itself replicated with the session. - The client is **pinned** to the instance holding the buffer for the lifetime of the resumption window (st...",
    "decision_boundary": "The operational decision is **who owns gap detection and replay**, and it must be made explicitly rather than inherited from the transport: - **If the server is single-instance and the buffer is unbounded (or bounded above the maximum tolerable gap):** the server can honor `Last-Event-ID` faithfully and the client may trust contiguity. This is the only confi...",
    "operational_effect": "The practical consequence is that MCP clients must not treat SSE event delivery as reliable exactly-once or even at-least-once across reconnects unless the deployment contract explicitly guarantees co-located, unbounded replay. The safe pattern is **notification as hint, state as truth**: every terminal event (tool completion, error) must be recoverable by a..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "882e3bed227a2de7e032ebb9a132ea81defd91f74dfb983c5ea482025f4cdbc9",
    "verified_classes": [
      "ResumptionGapError"
    ],
    "verified_functions": [
      "resume_stream",
      "handle_reconnect"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ResumptionGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
