# What happens when an instance reuses an MCP OAuth access token across tool calls whose resource-bound audience was never re-validated **Date of Record:** 2026 November 21 **Scope:** Applies to MCP servers enforcing OAuth 2.1 resource indicators (RFC 8707) and per-tool scope checks where a single access token is minted for a resource server and reused across multiple tool invocations within one agent session. Does not apply to per-tool token minting (token-per-tool), or to stateless HTTP MCP servers where each request carries an independently audience-validated token. ## Core Distinction The distinction that matters is between **token validity** and **token binding**. OAuth 2.1 validation answers "is this token live, unexpired, and signed by the expected issuer?" Resource binding answers a different question: "was this token's `aud` (audience) claim constrained to the exact resource this tool call targets, and does the token's granted scope set cover *this specific tool's* required scope?" A conforming MCP resource server checks both. The failure mode here is that the two checks drift apart at the *tool dispatch* layer, not the *transport* layer. The transport authenticates the request once, at connection establishment or on the first `tools/call`. The dispatcher then routes subsequent tool calls over the same authenticated session, reusing the already-validated token without re-evaluating per-tool scope or re-checking that the token's `aud` matches the *resource identifier of the tool being invoked* (which in MCP is frequently a distinct sub-resource, e.g. `mcp://server/tools/db_write` vs. `mcp://server/tools/db_read`). The non-obvious part: **the token is genuinely valid**, the signature checks out, the scope claim contains the string the client requested — and yet the tool call violates the resource binding because the binding was established for a *different* resource within the same server. Standard JWT validation passes; the invariant that fails is *audience-to-tool correspondence*. ## What Was Observed An agent connected to an MCP server over Streamable HTTP. During the OAuth 2.1 authorization code flow it requested a token with `resource=https://mcp.internal/tenant-a` and `scope=read write admin`. The authorization server, per RFC 8707, minted a token with `aud=["https://mcp.internal/tenant-a"]` and the full requested scope set. The server's transport middleware validated the token at session establishment and cached the validated principal in the session record. The agent then invoked `tools/call` for `search_documents` (requires `read`), which succeeded. It then invoked `tools/call` for `delete_document` (requires `admin` on resource `https://mcp.internal/tenant-a/tools/delete_document`). The dispatcher looked up the session's cached principal, checked that the *session* held `admin`, and executed the delete. No re-check of `aud` against the tool's declared resource identifier occurred, because the dispatcher treated the session's token as uniformly bound to the whole server. The observable trace: 1. `initialize` → transport validates token, binds session `S1` to principal `P` with `aud=https://mcp.internal/tenant-a`. 2. `tools/call search_documents` → dispatcher checks `P.scopes ⊇ {read}` → allow. 3. `tools/call delete_document` → dispatcher checks `P.scopes ⊇ {admin}` → allow. **No `aud` re-check against the tool's resource.** 4. A second agent, authorized only for `https://mcp.internal/tenant-a/tools/readonly`, connected to the same server. Its token had `aud` bound to the read-only sub-resource but the server's transport only validated `aud` against the *base* resource, so it too was admitted to the session layer. 5. The second agent's `delete_document` call was rejected on scope (it lacked `admin`), but its `search_documents` call was admitted — a read it was *not* audience-bound for, because its `aud` named only the read-only sub-resource, not the base. The failure is symmetric: over-admission (step 3) and cross-resource leakage (step 5) both stem from the same missing check. ## Condition of Validity The invariant that must hold for per-tool scope enforcement to be sound is: > For every `tools/call` dispatching tool `t`, the presented token's `aud` claim MUST contain the resource identifier `R(t)` declared in the tool's `_meta.resource` (or equivalent server-side registry), **and** the token's `scope` claim MUST be a superset of `required_scope(t)`. Both checks are evaluated at dispatch time, per call, against the *current* token — not against a session-cached principal. This invariant fails whenever any of the following hold: - The transport validates `aud` once and the dispatcher trusts the session. - `R(t)` is not declared per-tool, so the dispatcher has nothing to compare `aud` against. - The authorization server collapses all sub-resources of a server into a single `aud` value, so binding is coarser than the tool boundary. - Scope strings are checked as a flat set without resource qualification (e.g. `admin` meaning "admin anywhere" rather than "admin on `R(t)`"). The condition of validity therefore requires **resource-qualified scopes and per-tool audience declarations**, plus **dispatch-time re-validation**. If any of these is absent, the server is enforcing *authentication* but not *authorization binding*, and the per-tool scope check is advisory. ## Decision Boundary The boundary between a sound and unsound implementation is whether the server treats the OAuth token as a **session credential** or a **per-call warrant**. - **Session-credential model (unsound for MCP):** validate once at `initialize`, cache the principal, authorize subsequent calls against the cached principal. This is correct for a monolithic API where every endpoint shares one audience. It is wrong for MCP because MCP multiplexes many resources — tools, resources, prompts — each of which may carry a distinct resource identifier and a distinct scope requirement — over a single session. - **Per-call warrant model (sound):** the token is re-validated at each `tools/call`, `aud` is matched against `R(t)`, and scope is matched against `required_scope(t)`. The session carries no authorization state beyond the token reference. A server that sits on the wrong side of this boundary will pass all standard OAuth conformance tests (signature, expiry, issuer, scope presence) and still leak across resources, because the tests check the token, not the tool-to-token correspondence. The correct architectural guardrail is a **dispatch gate** that runs before the tool handler and after the transport: it takes `(token, tool_id)` and returns allow/deny, re-deriving `R(t)` and `required_scope(t)` from the server's tool registry on every call. The gate must fail closed when `R(t)` is undeclared — an undeclared resource is not "unrestricted," it is "unbound," and unbound must deny. ## Operational Effect When the invariant holds, an agent's authority is exactly the intersection of its token's audience and scope with each tool's declared resource and required scope. Cross-resource calls fail at the dispatch gate with a distinguishable error (`audience_mismatch` vs. `insufficient_scope`), which lets the agent's planner recover by re-authorizing for the specific sub-resource rather than re-authorizing the whole session. When the invariant fails, the operational effects are: 1. **Silent privilege broadening.** A token minted for a narrow sub-resource is accepted at the session layer for the whole server; the agent's effective authority is the union of all tool scopes reachable through the session, not the intersection with its token's `aud`. 2. **Cross-tenant / cross-resource leakage.** Two agents with disjoint `aud` bindings share the session layer and can read each other's resource spaces, because the base-resource check admits both. 3. **Non-recoverable agent state.** Because the failure surfaces as a *successful* call rather than a rejected one, the agent's episodic memory records the unauthorized action as valid, and subsequent reasoning builds on state it was never entitled to observe. The error is not detectable from inside the agent's trace. 4. **Audit divergence.** The authorization server's logs show a correctly scoped token; the resource server's logs show a correctly authenticated session; neither shows the tool-level binding violation, so post-hoc reconciliation cannot reconstruct which call exceeded which binding. The remediation is not "add a scope check" — the scope check exists. It is to make the check **resource-qualified and per-call**, and to declare `R(t)` for every tool so the dispatcher has a target to bind against. Without a declared `R(t)`, the gate cannot fail closed, and the server defaults to the session-credential model by omission. ```python from dataclasses import dataclass from typing import Mapping class ResourceBindingError(RuntimeError): """Raised when a tool call's token is not bound to the tool's resource.""" @dataclass(frozen=True) class ToolSpec: tool_id: str resource: str | None # R(t): declared resource identifier required_scope: frozenset[str] @dataclass(frozen=True) class Token: aud: frozenset[str] scope: frozenset[str] def dispatch_gate(token: Token, tool: ToolSpec) -> None: # Fail closed on undeclared resource: unbound is not unrestricted. if tool.resource is None: raise ResourceBindingError( f"tool {tool.tool_id!r} has no declared resource; cannot verify audience binding" ) # Per-call audience re-validation against the tool's resource, not the session base. if tool.resource not in token.aud: raise ResourceBindingError( f"audience mismatch for tool {tool.tool_id!r}: " f"token aud={sorted(token.aud)} does not contain {tool.resource!r}" ) # Per-call scope check, resource-qualified by the audience check above. missing = tool.required_scope - token.scope if missing: raise ResourceBindingError( f"insufficient scope for tool {tool.tool_id!r}: missing {sorted(missing)}" ) def handle_tools_call(token: Token, tool: ToolSpec, registry: Mapping[str, ToolSpec]) -> str: spec = registry.get(tool.tool_id) if spec is None: raise ResourceBindingError(f"unknown tool {tool.tool_id!r}") dispatch_gate(token, spec) return f"executed {spec.tool_id} on {spec.resource}" ```