{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-resumes-an-mcp-sse-stream-across-an-oauth-2-1-token-rotation-boundary",
  "title": "What happens when an instance resumes an MCP SSE stream across an OAuth 2.1 token rotation boundary",
  "date_of_record": "2026 November 20",
  "scope": "Applies to MCP servers using the HTTP-native transport where a client holds a long-lived Server-Sent Events stream with `Last-Event-ID` resumption, and authorization is enforced via OAuth 2.1 access tokens bound to a resource indicator (RFC 8707). Does not apply to stdio transports, or to SSE streams that are never resumed across a token lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-across-an-oauth-2-1-token-rotation-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-across-an-oauth-2-1-token-rotation-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-resumes-an-mcp-sse-stream-across-an-oauth-2-1-token-rotation-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1871,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct identities in an MCP HTTP session: the *stream identity* (the SSE session, keyed by an event ID cursor and a server-side session handle) and the *authorization identity* (the OAuth 2.1 access token, scoped to a resource indicator). Most implementations treat these as orthogonal — the stream is a transport concern, the token is a securi...",
    "what_was_observed": "A client opens an SSE stream to an MCP server. The server issues `event: endpoint` and then streams `message` events, each with an `id:` field. The client's access token (audience `mcp://tools.internal`, per its resource indicator) has a 15-minute TTL. The stream is idle for 20 minutes — a long-running tool call is in flight, or the agent is parked awaiting human input. The token expires. The client's OAuth 2.1 clien...",
    "condition_of_validity": "The failure is bounded by three conditions, all of which must hold: - The SSE buffer retains events across the token's lifetime (buffer TTL > token TTL). If the buffer is flushed on token expiry, no cross-identity replay is possible. - The session store is keyed by stream identity (event cursor / session handle) rather than by `(principal, resource, stream)`...",
    "decision_boundary": "The architectural guardrail is to make resumption a *two-key* operation. The stream cursor is one key; the authorization context captured at stream establishment is the other. On resume: - If the presented token's `(sub, aud, scope)` matches the captured context, replay proceeds. - If it does not match, the server MUST NOT replay. It must terminate the old s...",
    "operational_effect": "In practice, the observable symptom is not a security alert. It is a *consistency* bug: an agent resumes a stream, receives replayed events from a prior principal's context, and continues its reasoning loop with state it should not have. The agent's episodic memory now contains tool results attributed to the wrong session. If the agent later distills that ep..."
  },
  "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": "9f7427c29980ce09ae12561ceade5e2df4e87546f98d3f5536f3d580e1ce1460",
    "verified_classes": [
      "ResumptionContextMismatch",
      "TokenExpired",
      "AuthContext",
      "BufferedEvent"
    ],
    "verified_functions": [
      "canonicalize_resource",
      "resume_stream",
      "matches"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ResumptionContextMismatch",
      "TokenExpired"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
