{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-sse-to-streamable-http-upgrade-from-silently-rebinding-a-per-tool-oauth-resource-mid-session",
  "title": "Which invariants prevent SSE-to-streamable-HTTP upgrade from silently rebinding a per-tool OAuth resource mid-session",
  "date_of_record": "2026 November 27",
  "scope": "Applies to MCP clients and servers that negotiate a `text/event-stream` session, then upgrade that same logical session to the streamable-HTTP transport under a per-tool OAuth resource binding (RFC 8707 `resource` indicator). Does not cover stdio transport, pure SSE sessions that never upgrade, or bearer-token-only deployments with no resource scoping.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-to-streamable-http-upgrade-from-silently-rebinding-a-per-tool-oauth-resource-mid-session.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-to-streamable-http-upgrade-from-silently-rebinding-a-per-tool-oauth-resource-mid-session.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-sse-to-streamable-http-upgrade-from-silently-rebinding-a-per-tool-oauth-resource-mid-session.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2223,
    "python_slice_tokens": 395,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the token expired\" and it is not \"the upgrade dropped the connection.\" Both of those are loud. The failure is that the upgrade *succeeded* — the client received `200 OK`, a new `Mcp-Session-Id`, and a working stream — but the OAuth `resource` binding that authorized tool calls on the SSE leg was **re-derived from the new transport's endpo...",
    "what_was_observed": "A client established an SSE session at `GET /mcp/sse` with a token minted for `resource=https://api.example.com/mcp/sse`. The server advertised an upgrade path: the client should `POST /mcp/stream` with `Mcp-Session-Id: <sid>` to switch to streamable HTTP. The client did so, correctly forwarding the original `Authorization: Bearer <tok>` header. The server-side resource validation middleware — a standard RFC 8707 che...",
    "condition_of_validity": "The invariant holds only under all of the following: - **The resource indicator is pinned at grant time and immutable across transport legs.** The session record must store `resource` as a field set once at `initialize`, and every subsequent request on any leg of that session must validate against the *stored* value, not a recomputed one. - **Session ID rota...",
    "decision_boundary": "The boundary is this: **does the upgrade handler treat `resource` as input or as invariant?** - If `resource` is an *input* to the upgrade (recomputed from the new URL, re-requested from the AS, re-validated against the new endpoint), the upgrade is an authorization event and must go through full consent. In practice nobody does this, which is why the failur...",
    "operational_effect": "Downstream, the effect is a **capability widening with a clean audit trail**. Every request returns `200`. Every token validates. Every tool call succeeds. The only artifact is a `resource` claim diff in the token issuance log, which is exactly the kind of thing that gets filtered out of dashboards because it looks like routine rotation. The blast radius is ..."
  },
  "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": "c7c606ae517317e9d0fa852acd929e1b87a889d29f22de9b4fcd0b3a3b77867d",
    "verified_classes": [
      "ResourceBindingMismatch",
      "SessionRecord"
    ],
    "verified_functions": [
      "_canonical",
      "upgrade_transport",
      "validate_tool_call"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ResourceBindingMismatch"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
