An MCP client sends the user to authorize. Scute checks the request and redirects the browser to a consent page. The page signs the user in, reads the request, and records the user's decision. The client then swaps the code for tokens at token.
The consent page is the app's hosted page at /oauth/authorize on its tenant domain (its custom domain when one is active), or the app's own page when login_url is set in the server settings. Scute adds request=<handle> to the URL.
Start authorization#
/v1/oauth/:app_id/authorizeNoneOn success Scute redirects to the consent page. The sign-in request it opens is valid for 10 minutes.
Errors:
| Case | Response |
|---|---|
| Unknown or disabled client, or a metadata document that can't be used | 400 JSON, error invalid_client |
| redirect_uri not registered for the client | 400 JSON, error invalid_request |
| response_type is not code | Redirect to redirect_uri with error=unsupported_response_type |
| Missing PKCE or a method other than S256 | Redirect with error=invalid_request |
| resource missing or not one of the app's MCP servers | Redirect with error=invalid_target |
| A scope the resource doesn't offer | Redirect with error=invalid_scope |
Errors sent to the client's redirect_uri carry error, error_description, state and iss. Errors before the client and redirect URI are checked are never sent to the redirect URI.
Read a sign-in request#
/v1/oauth/:app_id/requests/:handleNoneWhat the consent page shows. :handle is the request value from the consent page URL. With the signed-in user's access token in X-Authorization, the response also has already_granted: true when an active grant already covers this client, resource and scopes.
{ "client": { "name": "Claude", "client_id": "https://claude.ai/oauth/client.json", "kind": "metadata_document", "host": "claude.ai", "client_uri": "https://claude.ai", "logo_uri": null }, "resource": { "url": "https://mcp.acme.example", "name": "Acme MCP" }, "scopes": ["mcp"], "expires_at": "2026-11-18T10:10:00.000Z", "already_granted": false}An expired or used request returns 404 with error_code request_not_found.
Record the user's decision#
/v1/oauth/:app_id/requests/:handle/decisionAccess tokenCalled by the consent page with the signed-in user's access token in X-Authorization.
{ "redirect_to": "https://client.example/callback?code=oac_...&state=xyz&iss=https%3A%2F%2Fapi.scute.io%2Fv1%2Foauth%2Fapp_3mxZRrzWxhPZ08dXvqq6"}Send the browser to redirect_to. On deny it carries error=access_denied. On approve Scute creates or extends the user's grant and adds a code (oac_...) valid for 60 seconds.
| Status | error_code | When |
|---|---|---|
| 401 | authentication_required | No valid access token for this app. |
| 422 | invalid | decision is not approve or deny. |
| 404 | request_not_found | The request expired or was already used. |
Exchange a code for tokens#
/v1/oauth/:app_id/tokenNonecurl -X POST https://api.scute.io/v1/oauth/app_3mxZRrzWxhPZ08dXvqq6/token \ -d grant_type=authorization_code \ -d client_id=cli_xxxxxxxxxxxxxxxxxxxxxxxx \ -d code=oac_xxx \ -d redirect_uri=https://client.example/callback \ -d code_verifier=$CODE_VERIFIER{ "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ii4uLiIsInR5cCI6ImF0K2p3dCJ9...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "ort_xxx", "scope": "mcp"}Token responses carry Cache-Control: no-store. A code can be used once: a second use returns invalid_grant and revokes the grant.
Refresh tokens#
/v1/oauth/:app_id/tokenNoneReturns a new access token and a new refresh token. The old refresh token stops working. Reusing a used refresh token returns invalid_grant and revokes the grant. Refresh tokens last the app's refresh_ttl, default 30 days.
Token errors#
Errors from token are JSON with error and error_description:
| Status | error | When |
|---|---|---|
| 401 | invalid_client | Unknown or disabled client. |
| 400 | invalid_grant | Unknown, expired or used code or refresh token, revoked grant, redirect_uri mismatch, failed PKCE check, or a user who may not sign in (banned or suspended). |
| 400 | invalid_target | resource doesn't match the grant. |
| 400 | invalid_scope | A refresh asked for scopes beyond the grant. |
| 400 | unsupported_grant_type | Any other grant_type. |
Exchange an access token for a task token#
/v1/oauth/:app_id/tokenApp keyFor the MCP gateway in front of the app's MCP server (RFC 8693). It trades a user's access token for an agent task token, so each tool call is checked against the agent, the user and the task. Needs the app key in Authorization: Bearer.
{ "access_token": "...", "issued_token_type": "urn:scute:params:oauth:token-type:task", "token_type": "N_A", "expires_in": 3412, "scope": "mcp", "task_id": "0193f960-1111-7222-8333-444444444444", "agent": "claude-desktop"}The task lasts as long as the access token, and at least 60 seconds. The agent is the one linked to the client, else the app's default_agent. When the resource maps scopes to permissions, scope_actions is included and the task may use only the permissions of the granted scopes.
| Status | error | When |
|---|---|---|
| 401 | invalid_client | No valid app key. |
| 400 | invalid_request | Wrong subject_token_type, or no agent linked to the client and no default agent. |
| 400 | invalid_grant | The subject token is not a live access token of this app, the agent is suspended, or the user may not sign in. |
| 400 | invalid_target | resource doesn't match the token's audience. |