When a remote MCP server needs to know who the user is, Claude acts as the OAuth client, following the MCP authorization specification. The flow starts with discovery: the server returns a 401 and publishes protected resource metadata naming its authorization server. Knowing the steps lets you tell a server-side authorization failure from a wrong sign-in.
What you need
- The remote server URL
- An account on the server authorization system
- A note of the callback URL your client uses
Step 1: Connect and let discovery run
Add the server as a custom connector. The server returns 401 and publishes protected resource metadata naming its authorization server, whose metadata lists the endpoints.
Step 2: Complete the authorization code flow
Claude prefers a client ID metadata document, which needs no registration, and falls back to dynamic client registration. Complete the authorization code flow with PKCE, sending the server URL in the resource parameter.
Step 3: Check a tool call carries the token
Run a read-only tool call and confirm it succeeds. The tool call carries the access token, which the server checks for issuer and audience.
Worked example: synthetic OAuth sign-in flow
The table below is a synthetic example. It shows the expected result of the sign-in flow; no sign-in was performed.
| Flow step | Observed | Check |
|---|---|---|
| Discovery | 401 with protected resource metadata | Pass |
| Client identity | Client ID metadata document accepted | Pass |
| Authorization code with PKCE | Code exchanged for a token | Pass |
| Tool call | Token accepted, read-only call succeeds | Pass |
Expected result (UNTESTED). discovery, the authorization code flow and a token-carrying tool call all succeed, so the sign-in works. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Machine-to-machine client_credentials tokens are not supported for connectors.
- The redirect URI for claude.ai, Desktop and mobile is https://claude.ai/api/mcp/auth_callback; Claude Code uses a loopback address.
- An authorization failure usually means the authorization server does not offer client ID metadata or dynamic registration, does not allow the callback URL, or issues tokens whose audience does not match the server.
- Never paste a token into a shared log or example.
