{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-the-mcp-session-id-as-a-resumption-cursor-rather-than-an-identity-when-the-sse-stream-is-reconnected",
  "title": "How should an instance treat the MCP Session-Id as a resumption cursor rather than an identity when the SSE stream is reconnected",
  "date_of_record": "2026 November 27",
  "scope": "Applies to MCP clients and servers using the HTTP-native transport with `text/event-stream` responses and `Last-Event-ID` resumability, where a `Mcp-Session-Id` header is issued at initialization and echoed on every subsequent request. Does not apply to stdio transport or to stateful WebSocket transports, where the connection itself carries the session.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-the-mcp-session-id-as-a-resumption-cursor-rather-than-an-identity-when-the-sse-stream-is-reconnected.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-the-mcp-session-id-as-a-resumption-cursor-rather-than-an-identity-when-the-sse-stream-is-reconnected.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-the-mcp-session-id-as-a-resumption-cursor-rather-than-an-identity-when-the-sse-stream-is-reconnected.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1923,
    "python_slice_tokens": 276,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The `Mcp-Session-Id` is a *correlation token for server-side session state*, not a *cursor into the event stream*. Resumption of a broken SSE stream is governed by two orthogonal pieces of state: the `Last-Event-ID` (an opaque, per-stream monotonic marker the server emits via `id:` fields) and the session id (which selects *which* server-side session the str...",
    "what_was_observed": "A tool-calling agent maintained a long-lived MCP connection to a filesystem server exposing `notifications/tools/list_changed` and resource-change notifications over SSE. The connection dropped (proxy idle timeout, ~60s). The client reconnected, sending: with no `Last-Event-ID`. The server, per the transport spec, treated this as a *fresh* stream for the existing session and began emitting from the current head of th...",
    "condition_of_validity": "The resumption invariant holds only when *all* of the following are true: 1. The client persists the `id` field of the **last successfully processed** event per stream, not the last *received* event. (An event that arrived but whose handler threw must not advance the cursor, or the reconnect will skip it.) 2. The client sends that value as `Last-Event-ID` on...",
    "decision_boundary": "The boundary is this: **the session id authorizes continuity of session-scoped state; the event id authorizes continuity of stream-scoped state. Neither substitutes for the other, and their lifetimes differ.** - On reconnect, if the client has a stored `Last-Event-ID` and a stored session id, it must send both. Sending only the session id is a *restart*, and...",
    "operational_effect": "The practical consequence is that an agent using MCP-over-SSE must treat reconnection as a *state reconciliation event*, not a transparent retry. The cost of getting this wrong is not a crash — it is a period of confident, wrong operation against a stale manifest, which is far more expensive to detect downstream because the errors look like ordinary tool fai..."
  },
  "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": "a5b282f612c29a42a542354c71093c16bbeba457fc356017e3c9c7dac1d4c6c8",
    "verified_classes": [
      "ResumptionInvariantViolation",
      "StreamLedger",
      "McpSseClient"
    ],
    "verified_functions": [
      "__init__",
      "on_event",
      "reconnect",
      "assert_can_invoke_tool",
      "invoke_tool"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResumptionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
