/api/mcp. It implements:
- RFC 7591 — Dynamic Client Registration
- RFC 7636 — PKCE (required, S256 only)
- RFC 8414 — Authorization Server Metadata
- RFC 9728 — Protected Resource Metadata
Discovery
| URL | Purpose |
|---|---|
/.well-known/oauth-authorization-server | AS metadata (endpoints, supported grants, PKCE methods) |
/.well-known/oauth-protected-resource | Resource metadata (authorization servers, scopes) |
Endpoints
POST /api/oauth/register
Dynamic Client Registration. Returns a client_id (public clients, no secret).
Request:
{ "client_id": "c_01HX...", "client_id_issued_at": 1713456789, ... }
Redirect URI allowlist: only these prefixes are accepted:
https://claude.ai/api/mcp/auth_callbackhttps://claude.com/api/mcp/auth_callbackhttp://localhost:<port>/http://127.0.0.1:<port>— any port
GET /api/oauth/authorize
Starts the OAuth flow. Renders a consent page that redirects to Clerk for sign-in, then issues an authorization code bound to the caller’s PRO entitlement.
Required query params:
response_type=codeclient_id— from DCRredirect_uri— must match the one registeredcode_challenge— PKCE S256code_challenge_method=S256state— opaquescope(optional)
GETDEL on exchange).
POST /api/oauth/token
Exchanges an authorization code for an access token, or refreshes an existing token.
Grant type: authorization_code:
refresh_token:
- Access token: 1 hour
- Refresh token: 7 days
Cache-Control: no-store, Pragma: no-cache.
Using tokens
Pass the access token on every MCP request:Error responses
Per RFC 6749 §5.2:invalid_request, invalid_client, invalid_grant, unsupported_grant_type, invalid_scope.