# What structural signals indicate a resumable MCP stream has silently lost its per-tool OAuth resource binding **Date of Record:** 2026 November 15 **Scope:** Applies to MCP servers exposing the HTTP-native transport (Streamable HTTP / SSE with `Last-Event-ID` resumption) where individual tools are gated by OAuth 2.1 resource indicators (RFC 8707) scoped per-tool. Does not apply to stdio transports, nor to deployments where a single audience-scoped bearer token authorizes all tools. ## Core Distinction A resumable stream and an authorized stream are two independent lifecycles that the MCP HTTP transport couples only implicitly. The stream lifecycle is keyed by a session identifier plus a monotonic event ID; the authorization lifecycle is keyed by the `resource` parameter that was asserted at token issuance and re-checked at each tool invocation. When a client reconnects with `Last-Event-ID`, the transport layer resumes the *session*, but the tool-invocation layer re-validates the *token audience* independently. The failure mode is not that resumption is rejected — it is that resumption **succeeds** while the resource binding that made specific tools callable has been quietly dropped, because the resumed session carries the original session metadata but not necessarily the original per-tool resource assertion. The non-obvious invariant: **a successfully resumed stream is not evidence that the resource indicator for any tool invoked on that stream is still valid.** These are separate checks performed at separate layers, and the transport layer has no visibility into the per-tool audience check. ## What Was Observed During a long-lived session (observed across a 40-minute idle window exceeding the edge proxy's 30-second keepalive but within the server's 15-minute session TTL), the client reconnected with a valid `Last-Event-ID`. The server returned HTTP 200 and replayed buffered events from the correct offset. The client then issued a `tools/call` for a tool whose OAuth resource indicator was `https://api.example.com/tools/billing`. The call returned a structured error — not a transport error, but a `-32001`-class tool error indicating audience mismatch — because the token presented on the resumed connection had been refreshed (via a silent refresh flow) against a *default* resource, not the per-tool resource. The stream looked healthy at every transport-level signal: correct event replay, correct session continuation, `200 OK`, no disconnect. The structural signals that actually indicated the break were: 1. **Divergence between session creation time and token `iat`.** The session was created at T0; the token presented on resume had `iat` at T0+38min. A resumed session whose bearer token postdates the session creation is a candidate for resource-binding drift. 2. **Absence of a `resource` claim matching the tool's registered indicator.** The refreshed token carried a `resource` of the authorization server default rather than the per-tool URI. The transport did not inspect this; only the tool gate did. 3. **Event replay succeeding past the point of the last successful tool call.** The replay buffer contained tool-result events from before the refresh; replaying them created the false impression that the stream's tool context was intact. 4. **A tool error class distinct from auth-failure-at-transport.** The failure surfaced as a tool-level error, not a 401, because the token was *valid* — merely valid for the wrong audience. ## Condition of Validity This diagnosis is valid only when all of the following hold: - The transport is HTTP-native with `Last-Event-ID` resumption enabled. - Per-tool OAuth resource indicators are enforced at the tool-invocation layer, not at the transport layer. - A token refresh occurred between session creation and resumption (typically triggered by the client's token TTL being shorter than the session TTL). - The authorization server issues tokens with a default resource when the `resource` parameter is omitted on refresh. It does **not** apply when the server pins the resource indicator into session metadata at creation and re-asserts it on every resume (some implementations do this defensively), nor when token TTL exceeds session TTL (refresh cannot occur mid-session). ## Decision Boundary The operator must decide whether a resumed stream should inherit the resource bindings of its original session or whether each tool call must re-assert its resource indicator independently. The safe default is the latter: **treat every `tools/call` on a resumed stream as requiring fresh resource-indicator validation, and never infer tool authorization from session continuity.** The unsafe default — inheriting session-level resource bindings — is what produces the silent failure, because the session metadata is stale relative to the refreshed token. Concretely: if `token.iat > session.created_at`, the resumed session must not be trusted to carry forward any per-tool resource assertion. Force re-assertion. ## Operational Effect Clients that treat `200 OK` on resume as full session restoration will issue tool calls that fail with audience-mismatch errors that look like server bugs rather than auth drift. The remediation is to make the resource indicator explicit on every refresh request (never rely on the authorization server default), and to have the client compare `token.iat` against the session's creation timestamp before trusting resumption. Servers should log resume events with the presented token's `resource` claim alongside the session's original resource set, so the divergence is visible in logs rather than only in tool errors. ```python import time from dataclasses import dataclass class ResourceBindingDriftError(RuntimeError): """Raised when a resumed MCP stream carries a token whose resource indicator no longer matches the per-tool resource required for a call.""" pass @dataclass class Session: session_id: str created_at: float bound_resources: set[str] @dataclass class Token: iat: float resource: str | None def assert_tool_resource_valid(session: Session, token: Token, tool_resource: str) -> None: # A resumed session whose token postdates session creation may have # refreshed against a default resource. Do not trust session continuity. if token.iat > session.created_at: if token.resource is None: raise ResourceBindingDriftError( f"session {session.session_id}: refreshed token (iat={token.iat}) " f"has no resource claim; refusing to infer {tool_resource!r} " f"from session continuity" ) if token.resource != tool_resource: raise ResourceBindingDriftError( f"session {session.session_id}: token resource {token.resource!r} " f"does not match required tool resource {tool_resource!r}" ) elif tool_resource not in session.bound_resources: raise ResourceBindingDriftError( f"session {session.session_id}: tool resource {tool_resource!r} " f"was never bound at session creation" ) ```