Agents

OAuth endpoints for MCP clients

Metadata, authorize, consent, token, registration, revocation and introspection endpoints of an app's OAuth 2.1 server.

MCP clients find and use these endpoints on their own from the metadata. This page is for checking what they do, and for building your own consent page. All of them answer 404 until the app turns MCP sign-in on. Token, register, revoke and introspect answers carry Cache-Control: no-store.

Metadata#

GET/.well-known/oauth-authorization-server/v1/oauth/:app_idNone
GET/v1/oauth/:app_id/.well-known/oauth-authorization-serverNone

RFC 8414 metadata, by path insertion (what MCP clients try first) and appended.

{  "issuer": "https://api.scute.io/v1/oauth/app_xxx",  "authorization_endpoint": "https://api.scute.io/v1/oauth/app_xxx/authorize",  "token_endpoint": "https://api.scute.io/v1/oauth/app_xxx/token",  "registration_endpoint": "https://api.scute.io/v1/oauth/app_xxx/register",  "revocation_endpoint": "https://api.scute.io/v1/oauth/app_xxx/revoke",  "introspection_endpoint": "https://api.scute.io/v1/oauth/app_xxx/introspect",  "jwks_uri": "https://api.scute.io/v1/auth/app_xxx/jwks",  "response_types_supported": ["code"],  "response_modes_supported": ["query"],  "grant_types_supported": ["authorization_code", "refresh_token"],  "code_challenge_methods_supported": ["S256"],  "token_endpoint_auth_methods_supported": ["none"],  "revocation_endpoint_auth_methods_supported": ["none"],  "scopes_supported": ["tools:read", "tools:write"],  "authorization_response_iss_parameter_supported": true,  "client_id_metadata_document_supported": true}

registration_endpoint is missing when dynamic registration is off. scopes_supported is every scope of the app's enabled MCP servers.

Authorize#

GET/v1/oauth/:app_id/authorizeNone
QueryRequiredMeaning
response_typeyescode
client_idyesA known client, or an https URL to a client metadata document
redirect_uriyesOne of the client's redirect URIs
code_challengeyesPKCE challenge, 43 base64url characters
code_challenge_methodyesS256
resourceyesOne of the app's MCP server URLs
scopenoSpace-separated scopes of that server. Default: all of them.
statenoReturned as is

Until the client and redirect URI check out, errors are shown as JSON and never sent to the redirect URI. After that, errors go back to the redirect URI with error, error_description, state and iss: unsupported_response_type, invalid_request (no PKCE S256), invalid_target (bad resource), invalid_scope.

On success Scute redirects the browser to the consent page with ?request=oar_.... The request handle is valid for 10 minutes.

The hosted page is on the app's hosted site at /oauth/authorize. It signs the person in with the app's methods and shows what the client asks for. The API never renders HTML.

GET/v1/oauth/:app_id/requests/:handleNone, or session token

What the page shows: client (name, client_id, kind, host, client_uri, logo_uri), resource (url, name), scopes and expires_at. With the person's session token in X-Authorization, it adds already_granted: whether they already agreed to all of this. An expired or used handle is 404 with request_not_found.

POST/v1/oauth/:app_id/requests/:handle/decisionSession token
decisionstringrequired
approve or deny.

Needs the signed-in person's session token in X-Authorization. Answers { "redirect_to": "..." }: the client's redirect URI with code, state and iss, or with error=access_denied. A handle can be decided once.

Set login_url in the settings to use your own page. Scute sends the browser to login_url?request=oar_.... Sign the person in with Scute as usual, read the request with GET /requests/:handle, show it, post the decision with their session token, and send the browser to redirect_to.

Token#

POST/v1/oauth/:app_id/tokenNone (public client)

Authorization code#

FieldMeaning
grant_typeauthorization_code
client_idThe client
codeFrom the redirect. Valid for 60 seconds, once.
redirect_uriThe same as on authorize
code_verifierThe PKCE verifier, 43 to 128 characters
resourceOptional. Must match the grant's resource.
{  "access_token": "eyJ...",  "token_type": "Bearer",  "expires_in": 3600,  "refresh_token": "ort_...",  "scope": "tools:read tools:write"}

The access token's claims: iss, sub (the app user id), aud (the MCP server URL), client_id, scope, iat, exp, jti, and scute with grant and app. Verify it with the jwks_uri from the metadata, and check typ is at+jwt.

Using a code twice revokes the grant.

Refresh#

FieldMeaning
grant_typerefresh_token
client_idThe client
refresh_tokenThe latest refresh token
scopeOptional. Equal to or narrower than before; never wider.
resourceOptional. Must match the grant's resource.

Each refresh returns a new refresh token and spends the old one. Presenting a spent refresh token again revokes the grant.

Token errors#

errorWhen
invalid_clientUnknown or disabled client (401)
invalid_grantUnknown, used or expired code or refresh token, wrong redirect_uri, PKCE failed, grant revoked, or the person is banned or suspended
invalid_targetresource does not match the grant
invalid_scopeA refresh asked for wider scope
unsupported_grant_typeAny other grant type

Token exchange for a task#

The MCP gateway trades a person's access token for an agent task token (RFC 8693), so every tool call runs through the agent and person and task check. This grant needs the app key.

FieldValue
grant_typeurn:ietf:params:oauth:grant-type:token-exchange
subject_tokenThe person's access token
subject_token_typeurn:ietf:params:oauth:token-type:access_token
resourceOptional. Must equal the token's aud.
curl -X POST https://api.scute.io/v1/oauth/$SCUTE_APP_ID/token \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \  -d subject_token=$ACCESS_TOKEN \  -d subject_token_type=urn:ietf:params:oauth:token-type:access_token
{  "access_token": "sct_...",  "issued_token_type": "urn:scute:params:oauth:token-type:task",  "token_type": "N_A",  "expires_in": 3412,  "scope": "tools:read tools:write",  "task_id": "TASK_ID",  "agent": "mcp-assistant",  "scope_actions": { "tools:read": ["invoice:read"], "tools:write": ["invoice:refund"] }}

The task acts for the token's person, as the client's linked agent (or the app's default_agent), and expires with the access token (at least 60 seconds). When the MCP server maps scopes to permissions, the task's actions are the granted scopes' permissions. Errors: invalid_client without the app key, invalid_request when no agent is linked, invalid_grant when the token is not live or the agent is suspended.

Register a client#

POST/v1/oauth/:app_id/registerNone

RFC 7591, public clients only. Takes client_name, redirect_uris, client_uri, logo_uri, grant_types (authorization_code and refresh_token only) and token_endpoint_auth_method (none only). Answers 201 with client_id (dcr_...) and the registered metadata. 404 when dynamic registration is off. Errors: invalid_client_metadata, invalid_redirect_uri.

Revoke#

POST/v1/oauth/:app_id/revokeNone

RFC 7009. Takes client_id and token (a refresh token). Revokes the whole grant when the token belongs to that client. Always answers 200.

Introspect#

POST/v1/oauth/:app_id/introspectApp key

RFC 7662. Takes token: an access token or a refresh token. An active token answers active: true with token_type, sub, client_id, scope, aud and exp (access tokens also iss, iat, jti). Anything else answers { "active": false }.