MCP OAuth
OAuth 2.1 endpoints for MCP server authentication (RFC 9728, RFC 8414, RFC 7591)
Protected Resource Metadata (RFC 9728)
Returns metadata about the MCP protected resource, including the authorization server URL. AI clients use this to discover where to obtain access tokens.
Protected Resource Metadata (RFC 9728) › Responses
Protected Resource Metadata
resourceURL of the protected resource (the MCP endpoint)
authorization_serversbearer_methods_supportedresource_nameAuthorization Server Metadata (RFC 8414)
Returns metadata about the OAuth 2.1 authorization server, including endpoints, supported grant types, and scopes. AI clients use this to discover the authorization and token endpoints.
Authorization Server Metadata (RFC 8414) › Responses
Authorization Server Metadata
issuerauthorization_endpointtoken_endpointregistration_endpointresponse_types_supportedgrant_types_supportedcode_challenge_methods_supportedscopes_supportedDynamic Client Registration (RFC 7591)
Registers a new OAuth client. AI clients call this endpoint to obtain a client_id and client_secret before initiating the authorization flow.
Dynamic Client Registration (RFC 7591) › Request Body
client_nameredirect_urisgrant_typesresponse_typestoken_endpoint_auth_methodscopeDynamic Client Registration (RFC 7591) › Responses
Client registered successfully
client_idclient_secretclient_id_issued_atclient_nameredirect_urisgrant_typesresponse_typestoken_endpoint_auth_methodscopeAuthorization Endpoint
Initiates the OAuth 2.1 Authorization Code flow. Redirects the user to the Primebrick consent screen, then to Casdoor for authentication. On approval, redirects back with an authorization code. On denial, redirects back with error=access_denied.
Parameters:
response_type— must becodeclient_id— from DCR registrationredirect_uri— must match a registered redirect URIscope— requested scopes (e.g.mcp:tools)state— client-generated state for CSRF protectioncode_challenge/code_challenge_method— PKCE parameters (recommended)
query Parameters
response_typeclient_idredirect_uriscopestatecode_challengecode_challenge_methodAuthorization Endpoint › Responses
Redirect to consent screen (or Casdoor if consent already approved). On success, redirects to redirect_uri with code and state. On denial, redirects with error=access_denied.
Token Endpoint
Exchanges an authorization code for an access token (and optional refresh token). The BE proxies the request to Casdoor's token endpoint using its own OIDC client credentials.
Content-Type: application/x-www-form-urlencoded
Token Endpoint › Request Body
grant_typecodeAuthorization code from the authorize endpoint
redirect_uriclient_idclient_secretcode_verifierPKCE code verifier
Token Endpoint › Responses
Token response
access_tokentoken_typeexpires_inrefresh_tokenscope