> ## Documentation Index
> Fetch the complete documentation index at: https://docs.proofable.me/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP OAuth

> Connect a custom MCP host to Proofable sign-in: discovery, authorization, token exchange, refresh, and revocation.

Proofable MCP uses the **Authorization Code** grant with PKCE. The user signs in on Proofable with the same passkey or wallet flow as the product.

> [!NOTE]
>
> Most clients only need `https://mcp.proofable.me/mcp` and the sign-in they open. This page is for custom MCP hosts, security review, and raw HTTP integration.

## Flow overview

```text theme={"system"}
MCP client discovers Proofable MCP
  → GET /.well-known/oauth-protected-resource
  → GET /.well-known/oauth-protected-resource/mcp
  → GET /.well-known/oauth-authorization-server
  → GET /oauth/authorize (validates OAuth params; redirects to hosted login if needed)
  → User authenticates on proofable.me (passkey, wallet, or Google/Microsoft)
  → Browser returns to /oauth/authorize with session; backend issues auth code
  → Redirect to client callback with code
  → POST /api/v1/auth/mcp/token (exchange code for access token)
  → Client uses Bearer token on MCP requests
```

`/oauth/authorize` validates OAuth parameters. Without a session it redirects to `https://proofable.me/verify?intent=mcp&returnTo=/oauth/authorize?...`. After login it issues a single-use code (5-minute TTL) and redirects to `redirect_uri`.

## Discovery

### Protected resource metadata

```http theme={"system"}
GET https://mcp.proofable.me/.well-known/oauth-protected-resource
GET https://mcp.proofable.me/.well-known/oauth-protected-resource/mcp
```

```json theme={"system"}
{
  "resource": "https://mcp.proofable.me/mcp",
  "authorization_servers": ["https://proofable.me"],
  "scopes_supported": [
    "proofable:core",
    "proofable:profile",
    "proofable:secrets"
  ],
  "resource_documentation": "https://docs.proofable.me/mcp/overview"
}
```

A signed-out handshake and the four signed-out tools answer normally. Every other call without a usable token returns the challenge that starts DCR and PKCE. An access key uses the same URL as a Bearer token.

```http theme={"system"}
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.proofable.me/mcp/.well-known/oauth-protected-resource", scope="proofable:core proofable:profile proofable:secrets"
```

### Authorization server metadata

```http theme={"system"}
GET https://proofable.me/.well-known/oauth-authorization-server
```

```json theme={"system"}
{
  "issuer": "https://proofable.me",
  "authorization_endpoint": "https://proofable.me/oauth/authorize",
  "token_endpoint": "https://proofable.me/api/v1/auth/mcp/token",
  "revocation_endpoint": "https://proofable.me/api/v1/auth/mcp/revoke",
  "registration_endpoint": "https://proofable.me/oauth/register",
  "response_types_supported": ["code"],
  "grant_types_supported": ["authorization_code", "refresh_token"],
  "code_challenge_methods_supported": ["S256"],
  "token_endpoint_auth_methods_supported": ["none"],
  "scopes_supported": [
    "proofable:core",
    "proofable:profile",
    "proofable:secrets",
    "offline_access"
  ],
  "resource_indicators_supported": true,
  "authorization_response_iss_parameter_supported": true
}
```

## Authorization

The examples on this page use the **Proofable SDK CLI** loopback flow (`proofable auth --oauth`), which identifies as `proofable-cli`. A host MCP client sends the `client_id` that DCR issued to it, its own registered `redirect_uri`, and the same `resource`.

```http theme={"system"}
GET https://proofable.me/oauth/authorize
  ?response_type=code
  &client_id=proofable-cli
  &redirect_uri=http://127.0.0.1:PORT/callback
  &code_challenge=BASE64URL(SHA256(code_verifier))
  &code_challenge_method=S256
  &state=RANDOM_CSRF_VALUE
  &scope=proofable:core proofable:profile proofable:secrets offline_access
  &resource=https://mcp.proofable.me/mcp
```

| Parameter | Required | Description |
| - | - | - |
| `response_type` | Yes | Must be `code` |
| `client_id` | Yes | Registered client identifier |
| `redirect_uri` | Yes | Must exactly match a registered URI |
| `code_challenge` | Yes | PKCE challenge (BASE64URL of SHA-256 of code\_verifier) |
| `code_challenge_method` | Yes | Must be `S256` |
| `state` | Yes | CSRF protection: returned verbatim |
| `scope` | No | Default: `proofable:core proofable:profile proofable:secrets offline_access` |
| `resource` | No | Defaults to `https://mcp.proofable.me/mcp`. Repeated identical values are accepted (RFC 8707); a different resource is rejected. |
| `iss` | Returned | The AS returns `iss=https://proofable.me` on the callback. Clients MUST validate it matches the expected issuer (RFC 9207). |

## Token exchange

```http theme={"system"}
POST https://proofable.me/api/v1/auth/mcp/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
code=AUTH_CODE
redirect_uri=http://127.0.0.1:PORT/callback
client_id=proofable-cli
code_verifier=ORIGINAL_CODE_VERIFIER
resource=https://mcp.proofable.me/mcp
```

Response:

```json theme={"system"}
{
  "access_token": "eyJ...",
  "token_type": "Bearer",
  "expires_in": 86400,
  "refresh_token": "rt_...",
  "scope": "proofable:core proofable:profile proofable:secrets"
}
```

## Refresh tokens

```http theme={"system"}
POST https://proofable.me/api/v1/auth/mcp/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token
refresh_token=rt_...
client_id=proofable-cli
resource=https://mcp.proofable.me/mcp
```

Refresh tokens last 30 days and rotate on each use. Include `offline_access` in the initial scope to receive one.

## Token claims

The MCP access token is a JWT:

| Claim | Value | Description |
| - | - | - |
| `iss` | `https://proofable.me` | Token issuer |
| `aud` | `https://mcp.proofable.me/mcp` | Resource audience: MCP server validates this |
| `sub` | Profile subject ID | Unique user identifier |
| `did` | `did:pkh:...` | Decentralized identifier |
| `azp` | Client ID | Client that requested the token |
| `scope` | Space-separated | Granted scopes |
| `token_use` | `mcp_access` | Token type: MCP server rejects other values |
| `iat` | Unix seconds | Issued at |
| `exp` | Unix seconds | Expires at |

The MCP server accepts a token only when `aud`, `iss` and `token_use` match these values and the token is unexpired and unrevoked.

## Scope model

| Scope | Description | Default |
| - | - | - |
| `proofable:core` | Public protocol tools (context, catalog, public proof reads) | Yes |
| `proofable:profile` | Signed-in profile context and ownership checks | Yes |
| `proofable:secrets` | Saved keys on your profile: list or remove one, or call a provider with one. Keys are saved in Proofable | Yes |
| `offline_access` | Refresh token so the client can stay signed in | Yes |

These four scopes are the complete public permission model. Access keys (`npk_*`) are a full-profile credential.

## Revocation

```http theme={"system"}
POST https://proofable.me/api/v1/auth/mcp/revoke
Content-Type: application/x-www-form-urlencoded

token=eyJ...
token_type_hint=access_token
client_id=proofable-cli
```

Revoking an access token also invalidates all associated refresh tokens.

## Registered clients

| `client_id` | Use |
| - | - |
| `proofable-cli` | Proofable SDK CLI (`proofable auth --oauth`): loopback redirect on `127.0.0.1` only |
| Issued by DCR | Host MCP clients: one client ID per registration, bound to its exact callback URIs |

Host MCP clients use a URL-only MCP config. The host reads `/.well-known/oauth-protected-resource`, registers itself at `/oauth/register`, and owns its PKCE and silent-refresh lifecycle. Host clients send their own DCR client ID, never `proofable-cli`.

## Security properties

| Property | Enforcement |
| - | - |
| PKCE required | `code_challenge_method=S256` is mandatory |
| Exact redirect\_uri match | Prevents open redirect attacks |
| State parameter preserved | CSRF protection |
| Resource indicator checked | A `resource` other than the MCP endpoint is rejected |
| Issuer validation (RFC 9207) | Client confirms `iss` on auth response matches expected AS; closes IdP mix-up |
| Token audience validated | MCP tokens cannot be used for other Proofable services |
| Refresh token rotation | Old refresh token invalidated on each use |
| Tokens never in query strings | Bearer header only |
| Single-use auth codes | Code invalidated after first exchange |

> [card] [Auth](https://docs.proofable.me/mcp/auth.md)
>
> Sign-in and access keys.

> [card] [Endpoints](https://docs.proofable.me/mcp/endpoints.md)
>
> Discovery URLs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.