# MCP authorization

A person's own assistant connects over MCP: OAuth 2.1 with PKCE, dynamic registration, and the Provenance MCP server.

Related guide: [Connect a client](https://provenanceauth.com/docs/provenance-mcp/connect.md)

## Endpoints

- `POST /v1/oauth/register`: [Register an assistant](#post-v1-oauth-register)
- `POST /v1/oauth/device_authorization`: [Start a terminal sign-in](#post-v1-oauth-device-authorization)
- `GET /.well-known/oauth-protected-resource`: [Get the MCP resource metadata](#get-well-known-oauth-protected-resource)
- `GET /.well-known/oauth-authorization-server`: [Get the authorization server metadata](#get-well-known-oauth-authorization-server)
- `GET /.well-known/oauth-protected-resource/v1/mcp`: [Get the MCP resource metadata (path form)](#get-well-known-oauth-protected-resource-v1-mcp)
- `POST /v1/oauth/token`: [Get or refresh tokens](#post-v1-oauth-token)
- `POST /v1/oauth/revoke`: [End a connection](#post-v1-oauth-revoke)

## Register an assistant

`POST /v1/oauth/register`

RFC 7591 dynamic registration for a person's own assistant: a public client (no secret) with 1–5 exact redirect URIs (https, loopback http, or a reverse-DNS app scheme). 20 an hour per IP. MCP 2026-07-28 prefers Client ID Metadata Documents: an assistant can use the URL of its metadata document as its `client_id` instead of registering.

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_name` | body | string | no | The assistant's name. |
| `redirect_uris` | body | array of strings | yes | Exact redirect URIs. |
| `application_type` | body | enum | no | `web` (the default) or `native` (a desktop app). A `web` client can't have only loopback redirect URIs. One of `web`, `native`. |

### Returns

The client.

### Errors

- [`invalid_redirect_uri`](https://provenanceauth.com/docs/platform/errors.md#invalid_redirect_uri)
- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/oauth/register" \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "Claude Desktop",
    "redirect_uris": [
      "http://127.0.0.1:33418/callback"
    ],
    "application_type": "native"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/register`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "client_name": "Claude Desktop",
    "redirect_uris": [
      "http://127.0.0.1:33418/callback"
    ],
    "application_type": "native"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/register", json={
    "client_name": "Claude Desktop",
    "redirect_uris": [
        "http://127.0.0.1:33418/callback"
    ],
    "application_type": "native"
}).json()
```

### Response 201

```json
{
  "client_id": "ocl_01M67Q2B8D7C4E2B9A6F5G1H0K",
  "client_name": "Claude Desktop",
  "redirect_uris": [
    "http://127.0.0.1:33418/callback"
  ],
  "token_endpoint_auth_method": "none",
  "grant_types": [
    "authorization_code",
    "refresh_token"
  ],
  "response_types": [
    "code"
  ],
  "client_id_issued_at": 1793469600
}
```

## Start a terminal sign-in

`POST /v1/oauth/device_authorization`

The device authorization request (RFC 8628) behind `npx @provenanceauth/connect`: a code for the person to enter at `verification_uri` and confirm with their passkey. Poll `POST /v1/oauth/token` with the device code grant every `interval` seconds.

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_name` | body | string | yes | The assistant's name, shown to the person. |
| `assistant` | body | enum | no | Which assistant (default `other`). One of `claude-code`, `codex`, `gemini`, `cursor`, `other`. |

### Returns

The code.

### Errors

- [`oauth_invalid_request`](https://provenanceauth.com/docs/platform/errors.md#oauth_invalid_request)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/oauth/device_authorization" \
  -H "Content-Type: application/json" \
  -d '{ "client_name": "Claude Code", "assistant": "claude-code" }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/device_authorization`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ "client_name": "Claude Code", "assistant": "claude-code" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/device_authorization", json={
    "client_name": "Claude Code",
    "assistant": "claude-code"
}).json()
```

### Response 200

```json
{
  "device_code": "dvc_q3V9xK2mW8sYd4cFjLhXn6gAe1pR5zT7Yk2m8VxQ1rT9",
  "user_code": "QSXT-BKLM",
  "verification_uri": "https://app.provenanceauth.com/me/connect/code",
  "verification_uri_complete": "https://app.provenanceauth.com/me/connect/code?code=QSXTBKLM",
  "expires_in": 600,
  "interval": 5,
  "client_id": "ocl_01M6B4QJ9D7C4E2B9A6F5G1H0K"
}
```

## Get the MCP resource metadata

`GET /.well-known/oauth-protected-resource`

RFC 9728: the one MCP server's address and its authorization server, with no `scopes_supported` (the account picker chooses who signs in). An MCP client finds it from the 401's `WWW-Authenticate` header.

Auth: none. No API key needed.

### Parameters

No parameters.

### Returns

The metadata.

### Errors

- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)

### Request

**curl**

```bash
curl "$PROVENANCE_API/.well-known/oauth-protected-resource"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/oauth-protected-resource`)).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/.well-known/oauth-protected-resource").json()
```

### Response 200

```json
{
  "resource": "https://mcp.provenanceauth.com",
  "authorization_servers": [
    "https://api.provenanceauth.com"
  ],
  "bearer_methods_supported": [
    "header"
  ],
  "resource_name": "Provenance",
  "resource_documentation": "https://www.provenanceauth.com/docs/provenance-mcp"
}
```

## Get the authorization server metadata

`GET /.well-known/oauth-authorization-server`

RFC 8414: the endpoints for a person's own assistant (PKCE S256, public clients, when MCP sign-in is set up) and the CIBA backchannel endpoint for company OAuth clients. With MCP sign-in it also advertises Client ID Metadata Documents (`client_id_metadata_document_supported`) and the RFC 9207 `iss` on every authorization response (`authorization_response_iss_parameter_supported`).

Auth: none. No API key needed.

### Parameters

No parameters.

### Returns

The metadata.

### Errors

- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)

### Request

**curl**

```bash
curl "$PROVENANCE_API/.well-known/oauth-authorization-server"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/oauth-authorization-server`)).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/.well-known/oauth-authorization-server").json()
```

### Response 200

```json
{
  "issuer": "http://127.0.0.1:50036",
  "token_endpoint": "http://127.0.0.1:50036/v1/oauth/token",
  "jwks_uri": "http://127.0.0.1:50036/.well-known/jwks.json",
  "scopes_supported": [
    "openid"
  ],
  "backchannel_authentication_endpoint": "http://127.0.0.1:50036/v1/oauth/bc_authorize",
  "backchannel_token_delivery_modes_supported": [
    "poll",
    "ping"
  ],
  "backchannel_user_code_parameter_supported": false,
  "authorization_details_types_supported": [
    "provenance_action"
  ],
  "token_endpoint_auth_methods_supported": [
    "private_key_jwt",
    "client_secret_basic"
  ],
  "token_endpoint_auth_signing_alg_values_supported": [
    "ES256",
    "EdDSA"
  ],
  "grant_types_supported": [
    "urn:openid:params:grant-type:ciba"
  ]
}
```

## Get the MCP resource metadata (path form)

`GET /.well-known/oauth-protected-resource/v1/mcp`

RFC 9728's path-inserted form for the one MCP server at `/v1/mcp`: the same metadata as `/.well-known/oauth-protected-resource`, for clients that build the address from the resource's path.

Auth: none. No API key needed.

### Parameters

No parameters.

### Returns

The metadata.

### Errors

- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)

### Request

**curl**

```bash
curl "$PROVENANCE_API/.well-known/oauth-protected-resource/v1/mcp"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/oauth-protected-resource/v1/mcp`)).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/.well-known/oauth-protected-resource/v1/mcp").json()
```

### Response 200

```json
{
  "resource": "https://api.provenanceauth.com/v1/mcp",
  "authorization_servers": [
    "https://api.provenanceauth.com"
  ],
  "bearer_methods_supported": [
    "header"
  ],
  "resource_name": "Provenance",
  "resource_documentation": "https://www.provenanceauth.com/docs/provenance-mcp"
}
```

## Get or refresh tokens

`POST /v1/oauth/token`

`authorization_code` with the PKCE verifier, `refresh_token`, the device code grant (RFC 8628), or the CIBA grant (`urn:openid:params:grant-type:ciba` with `auth_req_id`, the OAuth client authenticated): `authorization_pending` until the person decides, then the intent token, the approved `authorization_details` and an `id_token`. Form-encoded (or JSON).

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `grant_type` | body | enum | yes | Which exchange. One of `authorization_code`, `refresh_token`, `client_credentials`, `urn:ietf:params:oauth:grant-type:device_code`, `urn:openid:params:grant-type:ciba`. |
| `client_id` | body | string | no | The client (CIBA: optional; the client authenticates with an assertion or Basic). |
| `code` | body | string | no | With `authorization_code`. |
| `redirect_uri` | body | string | no | With `authorization_code`: the same redirect URI. |
| `code_verifier` | body | string | no | With `authorization_code`: the PKCE verifier. |
| `refresh_token` | body | string | no | With `refresh_token`. |
| `device_code` | body | string | no | With the device code grant. |
| `auth_req_id` | body | string | no | With the CIBA grant: the id from `POST /v1/oauth/bc_authorize`. |
| `client_assertion_type` | body | string | no | With the CIBA grant and `private_key_jwt`: `urn:ietf:params:oauth:client-assertion-type:jwt-bearer`. |
| `client_assertion` | body | string | no | With the CIBA grant or `client_credentials` and `private_key_jwt`: the signed assertion. |
| `scope` | body | string | no | With `client_credentials`: a registered agent's capabilities (`requesting:read requesting:act`, and `responding:read responding:act` once its responder tools are on; never `requesting:pay`), or `exchanges:read` for a party with no account. Left out, the agent's allowed set. |

### Returns

The tokens.

### Errors

- [`invalid_grant`](https://provenanceauth.com/docs/platform/errors.md#invalid_grant)
- [`oauth_invalid_request`](https://provenanceauth.com/docs/platform/errors.md#oauth_invalid_request)
- [`unsupported_grant_type`](https://provenanceauth.com/docs/platform/errors.md#unsupported_grant_type)
- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)
- [`authorization_pending`](https://provenanceauth.com/docs/platform/errors.md#authorization_pending)
- [`slow_down`](https://provenanceauth.com/docs/platform/errors.md#slow_down)
- [`access_denied`](https://provenanceauth.com/docs/platform/errors.md#access_denied)
- [`expired_token`](https://provenanceauth.com/docs/platform/errors.md#expired_token)
- [`ciba_client_invalid`](https://provenanceauth.com/docs/platform/errors.md#ciba_client_invalid)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "authorization_code",
    "client_id": "ocl_01M67Q2B8D7C4E2B9A6F5G1H0K",
    "code": "ocd_Yk2m8VxQ1rT9nB4wC7zD3fG6hJ0kL5pS",
    "redirect_uri": "http://127.0.0.1:33418/callback",
    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/token`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "grant_type": "authorization_code",
    "client_id": "ocl_01M67Q2B8D7C4E2B9A6F5G1H0K",
    "code": "ocd_Yk2m8VxQ1rT9nB4wC7zD3fG6hJ0kL5pS",
    "redirect_uri": "http://127.0.0.1:33418/callback",
    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/token", json={
    "grant_type": "authorization_code",
    "client_id": "ocl_01M67Q2B8D7C4E2B9A6F5G1H0K",
    "code": "ocd_Yk2m8VxQ1rT9nB4wC7zD3fG6hJ0kL5pS",
    "redirect_uri": "http://127.0.0.1:33418/callback",
    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}).json()
```

### Response 200

```json
{
  "access_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6ImF0K2p3dCJ9.eyJ0b2tlbl91c2UiOiJtY3BfYWNjZXNzIn0.c2ln",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "ort_Vq7m2KxT9nB4wC1zD3fG6hJ0kL5pSrY8",
  "scope": "provenance:personal"
}
```

## End a connection

`POST /v1/oauth/revoke`

RFC 7009: an assistant ends its own connection with its access token. Always 200.

Auth: none. No API key needed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | body | string | yes | The access token. |

### Returns

Done.

### Errors

- [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured)

### Request

**curl**

```bash
curl -X POST "$PROVENANCE_API/v1/oauth/revoke" \
  -H "Content-Type: application/json" \
  -d '{ "token": "eyJhbGciOiJFUzI1NiJ9.e30.c2ln" }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/oauth/revoke`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ "token": "eyJhbGciOiJFUzI1NiJ9.e30.c2ln" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/oauth/revoke", json={
    "token": "eyJhbGciOiJFUzI1NiJ9.e30.c2ln"
}).json()
```

### Response 200

```json
{}
```
