Flow · agent-as-client
Agent host as OAuth client (MCP HTTP)
The MCP client discovers how to authorize from Protected Resource Metadata and performs OAuth 2.1. The model never sees a protocol other than 'call this tool'.
Use the hop list beside the stage, or the phase labels, to jump. Every hop has Now, Why, the RFC, and chips — none are skipped.
Actors
User · MCP client (agent host) · MCP server · Authorization server
Sequence
Animated sequence · agent-as-client
MCP HTTP — Who is the OAuth client when a host calls your tools?
Agent host as OAuth client (MCP HTTP)
The MCP client discovers how to authorize from Protected Resource Metadata and performs OAuth 2.1. The model never sees a protocol other than 'call this tool'.
Now · 1/12· Discover· MCP authYou are here
MCP client (agent host)→MCP server·Unauthenticated HTTP request
The MCP host (OAuth client) calls the MCP server (resource). Stdio transports must not use this profile.
Why The host does not guess the AS. The resource tells it how to authorize.
Knock on the tool's door with no pass yet.
- MCP host from the spec
- MCP server from the spec
Solid = from the spec
Stdio MCP MUST NOT use this profile. Tokens must not be forwarded to other servers. CIMD is preferred; DCR is deprecated in the 2026-07-28 spec. The spec cites OAuth 2.1 draft-13 and CIMD draft-00; implement current revisions for token handling.
Transcript
- 1
DiscoverMCP client→MCP serverMCP auth
Unauthenticated HTTP request
The MCP host (OAuth client) calls the MCP server (resource). Stdio transports must not use this profile.
Why The host does not guess the AS. The resource tells it how to authorize.
Knock on the tool's door with no pass yet.
- MCP host
- MCP server
- 2
DiscoverMCP server→MCP clientRFC 9728
401 + WWW-Authenticate resource_metadata URL (RFC 9728 PRM)
WWW-Authenticate points at RFC 9728 PRM. resource = this MCP server, not a portable agent identity.
Why Protected resource metadata is how the client finds the AS and the canonical resource URI. Do not skip this challenge.
The door posts the address of the notice that names the desk.
- WWW-Authenticate
- resource_metadata
- PRM
- 3
DiscoverMCP client→MCP serverRFC 9728
GET protected resource metadata — this hop is not optional in MCP HTTP
The host fetches PRM from the URL the 401 advertised. That document names authorization_servers and the resource identifier.
Why Do not fold PRM into the 401. The metadata document is a separate GET.
Read the notice on the tool's door: which desk, which room name.
- protected resource metadata
- authorization_servers
- resource
- 4
DiscoverMCP client→Authorization serverRFC 8414
GET authorization-server metadata, then CIMD (preferred) or DCR
The host learns authorization_endpoint and token_endpoint, then gets a client_id at this AS. The model is not the client.
Why Same discovery as OAuth 2.1. CIMD is preferred; DCR is deprecated in MCP 2026-07-28. Optional if the host is already registered.
The host — not the model — takes a number at this desk.
- RFC 8414
- CIMD
- client_id
- 5
ProveMCP client→MCP clientRFC 7636
Generates PKCE code_verifier and S256 code_challenge
The host stores a fresh code_verifier. Only the S256 hash will go to the AS.
Why Identical to OAuth 2.1 Prove. Shown so MCP is not a different login.
Drawer secret — same as the OAuth 2.1 hop.
- code_verifier
- S256
- 6
GrantMCP client→Authorization serverOAuth 2.1
Authorization request: response_type=code, code_challenge, resource= this MCP URI
The host sends the user-agent to the authorization endpoint. resource= is this MCP server's canonical URI from PRM.
Why Identical grant to OAuth 2.1, plus RFC 8707 resource= bound to this MCP server.
Walk the owner to the desk for a pass to this one tool.
- response_type=code
- PKCE
- resource=
- 7
GrantUser→Authorization serverOAuth 2.1
Authenticates at the authorization server
The resource owner authenticates at the AS. The MCP server has not been called with a token yet.
Why Identical to OAuth 2.1. Login is not consent and not the tool call.
The owner shows ID at the pass desk.
- authentication
- 8
GrantUser→Authorization serverOIDC Core
Consents. OIDC if the tool needs who — ID Token is not the MCP Bearer
The resource owner consents at the AS. The MCP server will later see an access token, not an ID Token.
Why A human still approves the grant. An ID Token, if issued, stays with the host.
The owner signs the slip for this tool, not a nametag for the API.
- consent
- ID Token
- 9
GrantAuthorization server→MCP clientOAuth 2.1
Redirects back with an authorization code — not an access token in the URL
The host receives a code. The MCP Bearer is not in this hop.
Why Identical to OAuth 2.1. MCP does not revive implicit.
A ticket for this tool's desk.
- code
- no implicit
- 10
GrantMCP client→Authorization serverRFC 7636
POSTs the token endpoint: code + code_verifier
grant_type=authorization_code, code, code_verifier. Prefer DPoP on this POST if you can.
Why Identical to OAuth 2.1 back-channel redemption.
Cash the ticket with the drawer secret.
- token endpoint
- code
- code_verifier
- 11
GrantAuthorization server→MCP clientRFC 8707
Returns an access token with aud = this MCP server
The token endpoint returns an access token to the host. The model never sees it.
Why Audience is this resource. Forwarding the pass to another MCP server is a mix-up. Still a Bearer photocopy until you add DPoP.
A pass for this door, held by the host.
- access token
- aud
- Bearer
- 12
CallMCP client→MCP serverRFC 6750
Authorization: Bearer. Server checks audience == itself and responds
The host calls this MCP server with the access token in the Authorization header. Do not forward it to another server. The server validates aud (RFC 9068 JWT or introspection).
Why Audience validation is the difference between a calendar token and a payments incident. Not AAuth signed HTTP. Not an Agent Card.
Show the pass at this tool's door. Do not photocopy it to the next tool.
- Authorization: Bearer
- aud
- RFC 9068
Caveats
Stdio MCP MUST NOT use this profile. Tokens must not be forwarded to other servers. CIMD is preferred; DCR is deprecated in the 2026-07-28 spec. The spec cites OAuth 2.1 draft-13 and CIMD draft-00; implement current revisions for token handling.
Why this hop looks this way
The model never sees OAuth. The host is the client. Audience validation at the MCP server is the difference between a calendar token and a payments incident.