All Agent Engineering

Check MCP HTTP token audience and resource boundaries

Use the 2025-06-18 Authorization page to check the resource parameter, audience validation and token passthrough.

AINavWritten / Updated
On this page

At a glance

This sheet covers a protected MCP HTTP endpoint with authorization enabled, using the 2025-06-18 Authorization specification. Verify issuance and validation for this server and prevent token passthrough. It does not require a token to be issued exclusively for or accepted exclusively by one service. HTTP endpoints with authorization disabled are outside this workflow.

Runtime and applicability

Article type
Engineering practice
Verified
Applies to
  • MCP Check MCP HTTP token audience and resource boundaries

Execution locations and responsibilities

  • MCP client and server Use the workflow below to distinguish responsibilities of the caller, runtime, and external actions.
Engineering workflow order
Engineering workflow order1. Confirm scope and transport → 2. Check the 401 response and metadata discovery → 3. Check the resource parameter and canonical URI → 4. Check how the token is carried → 5. Check server audience validation and status codes → 6. Check that upstream calls do not pass tokens through. Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.1. Confirm scope and transport2. Check the 401 response and metadata discovery3. Check the resource parameter and canonical URI4. Check how the token is carried5. Check server audience validation and status codes6. Check that upstream calls do not pass tokens through

Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.

When to use

  • The MCP server must implement Protected Resource Metadata (RFC9728), whose authorization_servers field lists at least one authorization server, and a 401 response must use the WWW-Authenticate header to point to the metadata location. The client must parse that header and discover endpoints through Authorization Server Metadata (RFC8414). Clients and authorization servers should support Dynamic Client Registration (RFC7591); where it is unsupported the client needs another way to obtain a client ID.

When not to use

  • This sheet covers only token audience, the resource parameter, how the token is carried, and passthrough in HTTP authorization; it does not assess the internals of the authorization server, which the page states are out of its scope.
  • The page mentions a separate security document that discusses passthrough details, but that document was not part of the supplied material, so nothing from it is added here.
  • Authorization servers SHOULD issue short-lived access tokens; public-client refresh token rotation, client PKCE and exact redirect URI validation have their own MUST requirements. This sheet does not individually accept those implementations or convert SHOULD into a universal requirement.

Prerequisites and input

  • The implementation under review is confirmed to use HTTP transport; the page says stdio implementations should not follow this authorization specification and should take credentials from the environment instead.
  • You know the MCP server canonical URI and its authorization server; do not write real tokens into the sheet, only the conclusions of each check.
  • The target is a protected HTTP endpoint with authorization enabled; otherwise mark the remaining authorization checks not applicable.

Engineering checks

Discovery and client identity layer — The MCP server must implement Protected Resource Metadata (RFC9728), whose authorization_servers field lists at least one authorization server, and a 401 response must use the WWW-Authenticate header to point to the metadata location. The client must parse that header and discover endpoints through Authorization Server Metadata (RFC8414). Clients and authorization servers should support Dynamic Client Registration (RFC7591); where it is unsupported the client needs another way to obtain a client ID.

Audience binding layer — The client must implement Resource Indicators (RFC 8707) and send the resource parameter in both the authorization request and the token request, set to the canonical URI of the target MCP server, whether or not the authorization server supports it. The server must validate that a token was issued for it and reject tokens unless an audience claim or another validation method establishes this server as the intended recipient; the specification does not require every token to share one claim representation. This layer stops a token from being reused across services.

Upstream isolation layer — If the MCP server calls an upstream API it may act as an OAuth client there, using a token that the upstream authorization server issued separately; it must never pass through the token received from the MCP client. Passthrough can cause a confused deputy problem. PKCE for authorization codes, exact redirect URI matching and state verification are also security requirements on that page.

1. Confirm scope and transport

Where: transport and authorization configuration. Input: transport and whether the target endpoint is protected. Continue only for HTTP with authorization enabled. Authorization is optional overall; when disabled the remaining token/401/discovery checks are not applicable. Completion: identify transport, authorization and endpoint. Stop this sheet for stdio or authorization-disabled HTTP instead of requiring nonexistent 401 or Bearer behavior.

2. Check the 401 response and metadata discovery

Where: the MCP server response to an unauthorized request, and the client discovery logic. Input: the response headers of a request sent without a token, and the Protected Resource Metadata. Action: confirm the server returns 401 with a WWW-Authenticate header giving the metadata location, that the metadata contains authorization_servers, and that the client picks an authorization server from it and reads its metadata. Completion check: the sheet names the selected authorization server and records that the client made the choice. Stop condition: if the metadata lacks authorization_servers, or the client cannot parse the header, stop.

3. Check the resource parameter and canonical URI

Where: the authorization request and the token request sent by the client. Input: the URI of the target MCP server. Action: confirm both requests carry the resource parameter set to the canonical URI: it has a scheme, has no fragment, and preferably has no trailing slash; a bare hostname without a scheme is invalid. Completion check: the resource value is identical in both requests and matches the service identified by the Protected Resource Metadata. Stop condition: if either request lacks the parameter, or the URI contains a fragment or lacks a scheme, mark it failed.

4. Check how the token is carried

Where: every HTTP request from the client to the MCP server. Input: request headers and URLs. Action: confirm each request carries the access token in the Authorization Bearer header, including later requests in the same logical session, and that no token appears in the URL query string. Also confirm the client sends only tokens issued by that server authorization server. Completion check: every sampled request meets these points. Stop condition: if a token appears in a query string, or a token from another authorization server is used, stop and correct it.

5. Check server audience validation and status codes

Where: the MCP server token validation logic. Input: a token issued for this service, one issued for another service, an expired or invalid token, and a token with insufficient permissions. Action: confirm only tokens validated for this server through an audience claim or another valid method are accepted; absence of a particular claim representation alone does not establish failed recipient validation, and that the others get the codes the page specifies: 401 for invalid or expired tokens, 403 for invalid scopes or insufficient permissions, and 400 for a malformed authorization request. Completion check: each input has a recorded status code and no data is returned on rejection. Stop condition: if the server accepts a token issued for another resource, record a severe defect and stop the acceptance.

6. Check that upstream calls do not pass tokens through

Where: the MCP server upstream path. Input: whether upstream calls exist, their authentication method and the received client token. If there is no upstream call, record this item as not applicable. Otherwise prohibit passthrough of the MCP client token. For OAuth upstreams check a separate token issued by the upstream authorization server; for other authentication methods verify the actual provider contract instead of forcing OAuth. A static-client-ID OAuth proxy also checks user consent for each dynamically registered client. Completion: record the actual credential source, purpose and owner with no MCP token passthrough. Stop that path on passthrough or missing authentication evidence, without assuming every upstream must use OAuth.

Task example

This is an invented manual walkthrough; the observations are hypothetical expectations, not verification that was run. Imagine a remote MCP service whose canonical URI is https://mcp.example.com/mcp. A request without a token is expected to get a 401 and a WWW-Authenticate header. The client is expected to put the same resource value in both the authorization request and the token request. The reviewer then imagines presenting a token issued for a different service and expects it to be rejected with 401. This synthetic scenario assumes an OAuth upstream. Finally that upstream call is inspected: it is expected to use a separate token from the upstream authorization server, and if a log shows the client token forwarded unchanged, the sheet records a failure.

Completion checks

  • The resource parameter appears in both the authorization request and the token request, with the canonical URI of the target service.
  • The server establishes the intended recipient through an audience claim or another valid method and rejects failed validation; distinguish the actual uses of 401, 403 and 400.
  • Upstream calls never pass through the MCP token: OAuth uses a separately issued token, other methods have provider authentication evidence, and no upstream is recorded as not applicable.

Verification scope

Only the supplied Authorization page of the MCP 2025-06-18 specification was read as documentation. Installation, login, API execution and output were not tested; the example is an invented walkthrough and does not describe any product actual behavior. That version is the one read here and is not claimed to be the newest.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. MCP · MCP documentation: mcp-auth

Found an error? Tell us →