OAuth for Remote MCP Servers: What Claude and ChatGPT Require (Discovery, DCR, CIMD, Callbacks)
Both Claude and ChatGPT follow the MCP authorization spec: your server answers unauthenticated requests with 401 and a WWW-Authenticate: Bearer resource_metadata="..." header, serves protected resource metadata at /.well-known/oauth-protected-resource, and points to an authorization server that publishes RFC 8414 or OpenID metadata with code_challenge_methods_supported: ["S256"]. The client registers through DCR, a Client ID Metadata Document, or a pre-registered client, and sends a resource parameter your tokens should be bound to.
OAuth is where most remote MCP connections break. The good news is that Claude and ChatGPT implement the same spec, so one correct setup serves both. The differences are in a few strict details. Everything below comes from the MCP authorization spec and each vendor's auth docs; mcplisted is not affiliated with Anthropic or OpenAI.
The flow both clients run
- The client calls your MCP endpoint without a token.
- Your server returns
401 Unauthorizedwith aWWW-Authenticateheader pointing at your protected resource metadata. - The client reads that metadata, picks the authorization server, and fetches its metadata.
- The client registers or identifies itself (DCR, CIMD, or a pre-registered client).
- The user signs in; the client runs authorization code with PKCE and a
resourceparameter. - The client calls your server with
Authorization: Bearer <token>on every request.
Step 1: the 401 challenge
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource", scope="files:read"
The MCP spec says servers MUST use WWW-Authenticate on a 401 to point at the metadata. Claude is strict here: it starts sign-in only on a real 401 and ignores WWW-Authenticate on a 200. The optional scope parameter controls what Claude requests; without it, Claude requests everything in scopes_supported.
Step 2: protected resource metadata
{
"resource": "https://mcp.example.com/mcp",
"authorization_servers": ["https://auth.example.com"],
"scopes_supported": ["files:read", "files:write"],
"bearer_methods_supported": ["header"]
}
resourcemust equal the MCP URL the user enters, including the path (Claude).- Claude uses only the first entry in
authorization_serversand does not fall back. ChatGPT says it tries each listed issuer. - If the
401has no pointer, Claude probes/.well-known/oauth-protected-resource/<path>then/.well-known/oauth-protected-resourceon your origin. Treat that as a fallback.
Step 3: authorization server metadata
Serve either /.well-known/oauth-authorization-server (RFC 8414) or /.well-known/openid-configuration. Claude tries the first, then the second, and only one needs to work.
{
"issuer": "https://auth.example.com",
"authorization_endpoint": "https://auth.example.com/authorize",
"token_endpoint": "https://auth.example.com/token",
"registration_endpoint": "https://auth.example.com/register",
"client_id_metadata_document_supported": true,
"token_endpoint_auth_methods_supported": ["none"],
"code_challenge_methods_supported": ["S256"],
"response_types_supported": ["code"],
"grant_types_supported": ["authorization_code", "refresh_token"]
}
Both clients send PKCE with S256. OpenAI says servers are unsupported when metadata omits code_challenge_methods_supported or doesn't list S256.
Step 4: client registration
| Method | Claude | ChatGPT |
|---|---|---|
DCR (registration_endpoint) |
Supported by default; registers a new client on every fresh connection | Supported; registers once per MCP server connection and reuses it |
| CIMD | Used when metadata has client_id_metadata_document_supported: true and "none" in token_endpoint_auth_methods_supported |
Preferred when supported; none or private_key_jwt |
| Pre-registered client | Anthropic-held client credentials entered in the portal | provided client declared in mcp.json, secret entered in the portal |
Machine-to-machine client_credentials |
Not supported | Not supported |
Anthropic recommends CIMD or Anthropic-held credentials over DCR for high-traffic servers, because DCR can create very large numbers of clients. The 2026-07-28 MCP spec also marks DCR as deprecated in favor of CIMD.
Step 5: redirect URIs
| Client | Redirect URI to allow |
|---|---|
| claude.ai, Desktop, mobile, Cowork | https://claude.ai/api/mcp/auth_callback |
| Claude Code | Loopback on any port: http://localhost/callback and http://127.0.0.1/callback, port ignored |
| ChatGPT (issuer identification supported) | https://chatgpt.com/connector_platform_oauth_redirect |
| ChatGPT (otherwise) | https://chatgpt.com/connector/oauth/{callback_id}, copied from the server's management page |
ChatGPT uses the stable URI only when your metadata sets authorization_response_iss_parameter_supported: true and your server returns a matching iss on every authorization response (RFC 9207). More in Claude callback URLs and redirect URIs.
Step 6: tokens bound to your server
Both clients send the RFC 8707 resource parameter on the authorization and token requests. The MCP spec says servers MUST validate that tokens were issued for them and MUST NOT pass a received token through to upstream APIs. Claude sends the canonical form of your URL: lowercase scheme and host, no trailing slash, no fragment, no default port. Accept that form when you check aud.
Token endpoint details Claude enforces
- Accept
Content-Type: application/x-www-form-urlencodedon/token. A JSON-only parser returns415and breaks sign-in./registeruses JSON. - Return
invalid_grantwhen a refresh token is no longer valid, not a custom code. - Rotate refresh tokens for public clients and return the new one in the same response.
- Respond within 10 seconds for discovery, registration, and token requests, and 30 seconds for refresh.
Tools that need sign-in and tools that don't
Claude's lazy authentication triggers sign-in from a transport-level 401 returned before the MCP SDK runs; a 200 tool result with isError: true saying "please sign in" does not trigger it. ChatGPT's tool-level flow uses per-tool securitySchemes (noauth, oauth2) plus an error result carrying _meta["mcp/www_authenticate"]. If you serve both clients, implement both signals.
Checklist
-
401withresource_metadataon unauthenticated protected calls - Protected resource metadata
resourcematches the exact MCP URL - Primary issuer listed first in
authorization_servers -
S256advertised; DCR or CIMD available - Claude and ChatGPT redirect URIs allowed
-
audchecked against the canonical server URL - Form-encoded token endpoint, under 10 seconds
You can run a free check to see which discovery steps your live server already passes, and use the testing guide for manual curl checks.
Run a free check on your MCP server →Paste your URL and see what Claude, ChatGPT and Gemini reviewers will flag.
FAQ
Do I need Dynamic Client Registration?
Not strictly. Claude and ChatGPT accept DCR, a Client ID Metadata Document, or a pre-registered client. Anthropic suggests CIMD or Anthropic-held credentials for high-traffic servers.
Why does Claude never reach my authorization server?
Anthropic says this happens when the 401 has no resource_metadata pointer and the well-known paths on your MCP origin return 404, so Claude can't find the authorization server.
Can ChatGPT or Claude use client_credentials?
No. Both vendors say machine-to-machine client_credentials grants are not supported for connecting to MCP servers.
Do I have to bind tokens to my server URL?
The MCP spec says servers MUST validate that access tokens were issued for them as the audience, and both clients send the resource parameter to make that possible.
Sources
- MCP specification 2025-06-18: Authorization
- Authentication for connectors (Claude docs)
- Lazy authentication for MCP servers (Claude docs)
- Troubleshoot your connector (Claude docs)
- Authentication (OpenAI plugin docs)
- Reference (OpenAI plugin docs)
- MCP specification 2026-07-28: Deprecated features
Rules change. If something here is out of date, email hello@mcplisted.com and we'll fix it. See our editorial policy.