Skip to content

Commit 493074e

Browse files
authored
Merge pull request #137 from auth0/update-mcp-auth-flow-spec-jun-25
Update mcp auth flow spec jun 25
2 parents 778f7c8 + 2b6eb33 commit 493074e

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

auth4genai/img/mcp_auth_flow.png

51.9 KB
Loading

auth4genai/mcp/auth-for-mcp.mdx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,25 @@ Here is the standard OAuth authorization code flow when an MCP server uses Auth0
4646

4747
<Steps>
4848
<Step>
49-
The MCP client initiates the OAuth flow by making a request to the MCP
50-
server's authorization endpoint.
49+
The MCP client sends a request to the protected MCP server and receives HTTP `401 Unauthorized` with a `WWW-Authenticate` header that indicates the protected resource metadata URL.
5150
</Step>
5251
<Step>
53-
The MCP server redirects the user to the Auth0 authorization server.
52+
The MCP client requests the [resource metadata](https://datatracker.ietf.org/doc/html/rfc9728/) from the MCP server at the `/.well-known/oauth-protected-resource` endpoint.
5453
</Step>
5554
<Step>
56-
The user authenticates with Auth0 (using username/password, social login, or
57-
MFA).
55+
The MCP client parses the metadata, selects an authorization server (Auth0) from the list, and then fetches its OAuth 2.0 Authorization Server Metadata from the `/.well-known/oauth-authorization-server` endpoint. [Dynamic Client Registration (DCR)](https://auth0.com/docs/get-started/applications/dynamic-client-registration#enable-dynamic-client-registration) can happen after receiving the metadata response.
5856
</Step>
5957
<Step>
60-
After successful authentication, Auth0 redirects the browser back to the MCP
61-
server's callback URL with a single-use authorization code.
58+
The client generates [PKCE](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce) parameters and builds the authorization request, then opens the browser to the authorization endpoint.
6259
</Step>
6360
<Step>
64-
The MCP server exchanges the authorization code for an access token directly
65-
with the Auth0 token endpoint.
61+
The user then authenticates with Auth0 (using username/password, social login, or MFA). Auth0 redirects the browser to the MCP client’s registered redirect URI with an authorization code.
6662
</Step>
6763
<Step>
68-
The MCP server validates the token from Auth0 and generates its own session
69-
or internal access token that is bound to the third-party session.
64+
The MCP client exchanges the code at the token endpoint and Auth0 returns the access token completing the original OAuth flow.
7065
</Step>
7166
<Step>
72-
The MCP server completes the original OAuth flow, returning its own token to
73-
the MCP client, which can then be used to make authenticated calls to the
74-
server's tools.
67+
After receiving an access token (and refresh token), the MCP client will use the access token to make authenticated calls to the MCP server's tools.
7568
</Step>
7669
</Steps>
7770

0 commit comments

Comments
 (0)