OAuth for MCP clients
A client connects to the hosted MCP server and the person signs in in a browser. No API key is pasted anywhere. This page is for people writing a client; Claude Code and Cursor already do all of it.
The access token it ends up with is an ordinary API key, valid for one hour and renewed with a refresh token. It is listed in the dashboard beside keys people made, marked as OAuth, and revoking it there ends the connection.
The flow
- Connect.
POST https://mcp.passivedev.com/mcpwith no token answers401withWWW-Authenticate: Bearer resource_metadata="https://mcp.passivedev.com/.well-known/oauth-protected-resource/mcp". - Find the authorization server.
GETthat URL.authorization_serversnames it (https://api.passivedev.com). - Read its metadata:
GET https://api.passivedev.com/.well-known/oauth-authorization-server. - Register (once per install):
POST /oauth/registerwith{"client_name", "redirect_uris"}. You get aclient_id. Clients are public: there is no secret. - Send the person to the
authorization_endpointwithresponse_type=code, yourclient_id, a registeredredirect_uri, a PKCEcode_challenge(methodS256), astate, thescopeyou want andresourceset to the MCP URL you connect to. - They approve and the browser returns to your
redirect_uriwithcode,stateandiss. - Exchange the code:
POST /oauth/token(form encoded) withgrant_type=authorization_code,client_id,code,redirect_uriandcode_verifier. You receiveaccess_token,refresh_token,expires_in(3600) andscope. - Call the MCP server with
Authorization: Bearer <access_token>. - Refresh with
grant_type=refresh_token,client_idandrefresh_token. You get a new pair.
Rules a client must follow
- PKCE
S256is required.plainis refused. - Redirect URIs must be
https, loopbackhttp(http://localhost:<port>/..., where the port may vary), or the custom scheme of a known MCP client:cursor,vscode,vscode-insiders,windsurf,zed,claude. Any other custom scheme is refused, because the browser would hand the code to whatever program the operating system has registered for it. They are matched exactly when you register. - A refresh token works once. Save the new one before using the new access token. Presenting one of the last five spent refresh tokens revokes the whole connection, because it can only mean it was copied. An older one is simply invalid.
- An authorization code works once and is bound to your client, redirect URI and challenge.
- Scopes. A token carries only scopes the MCP tools use:
apps:read,apps:write,db:read,db:write,jobs:readandworkers:read. Anything else you ask for is dropped, with or withoutresource, because the token is an API key the whole REST API accepts.apps:secretsanddb:credentialsare never among them. A token for/mcp/read-onlyis limited to read scopes. A refresh may narrow the scopes, never widen them. - Errors use the standard OAuth
erroranderror_description, not Passive'spassive_error.
Limits
| What | Limit |
|---|---|
| Registrations | 10 an hour per address |
| Token requests | 120 a minute per address |
| Connected clients per person | 20 (signing in again replaces the same client's earlier connection) |
| Authorization request | valid for 10 minutes |
| Authorization code | valid for 10 minutes, once |
| Access token | 1 hour |
| Refresh token | 30 days from its last use, rotated on every use |
| Connection (grant) | 90 days from sign-in, however often it refreshes; then sign in again |
| Registered client | 24 hours until it first signs someone in, then 90 days |
Revoking
POST /oauth/revoke with token set to a refresh or access token ends the connection and always
answers 200. A person can also revoke it from API keys in the dashboard.