Authentication
MCP OAuth 2.1
OAuth 2.1 with Dynamic Client Registration and PKCE S256 for Weave MCP clients.
MCP OAuth 2.1 & PKCE
Web and desktop MCP clients (Claude.ai, ChatGPT, and others) can connect without pasting a personal token by using Weave as an OAuth 2.1 authorization server.
Endpoints
Authorization server base: https://<APP_HOST>/api/v1/mcp-oauth
| Method | Path | Purpose |
|---|---|---|
POST | /register | Dynamic Client Registration (DCR) |
GET | /authorize | Authorization (PKCE S256) |
POST | /token | Token exchange / refresh |
GET | /consent/context | Consent UI context |
GET | /consent/tools-preview | Tools preview for consent |
POST | /consent | Approve / deny consent |
GET | /grants | List grants |
DELETE | /grants/:grantId | Revoke grant |
Discovery (well-known)
Served from the API origin:
| Path |
|---|
/.well-known/oauth-authorization-server |
/.well-known/openid-configuration |
/.well-known/oauth-protected-resource |
/.well-known/oauth-protected-resource/v1/mcp |
Metadata advertises:
registration_endpoint→…/api/v1/mcp-oauth/registerauthorization_endpoint→…/api/v1/mcp-oauth/authorizetoken_endpoint→…/api/v1/mcp-oauth/token- PKCE method:
S256 - Grants:
authorization_code,refresh_token - Protected resource:
https://<MCP_HOST>/v1/mcp
Register a client (DCR)
curl -X POST "https://<APP_HOST>/api/v1/mcp-oauth/register" \
-H "Content-Type: application/json" \
-d '{
"client_name": "My MCP Client",
"redirect_uris": ["https://client.example/callback"],
"token_endpoint_auth_method": "none",
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"code_challenge_method": "S256"
}'Example response:
{
"client_id": "mcp_client_...",
"client_name": "My MCP Client",
"redirect_uris": ["https://client.example/callback"],
"token_endpoint_auth_method": "none",
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"]
}Authorization code + PKCE
- Generate
code_verifierandcode_challenge(S256). - Redirect the user to:
https://<APP_HOST>/api/v1/mcp-oauth/authorize
?response_type=code
&client_id=<CLIENT_ID>
&redirect_uri=<REDIRECT_URI>
&code_challenge=<CHALLENGE>
&code_challenge_method=S256
&scope=notes:read%20projects:read
&state=<STATE>
&resource=https://<MCP_HOST>/v1/mcp- After consent, exchange the code:
curl -X POST "https://<APP_HOST>/api/v1/mcp-oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "code=<AUTH_CODE>" \
-d "redirect_uri=<REDIRECT_URI>" \
-d "client_id=<CLIENT_ID>" \
-d "code_verifier=<VERIFIER>" \
-d "resource=https://<MCP_HOST>/v1/mcp"Token response (shape):
{
"access_token": "wmo_...",
"refresh_token": "wmr_...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "notes:read projects:read"
}Call MCP with the access token
curl -X POST "https://<MCP_HOST>/v1/mcp" \
-H "Authorization: Bearer wmo_..." \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Personal tokens vs OAuth
| Mode | When to use |
|---|---|
Bearer wn_… | Scripts, CI, Cursor/VS Code config files |
OAuth wmo_… | Hosted clients with 1-click connect (Claude.ai, ChatGPT) |
See Connecting MCP clients for per-client setup.