Skip to main content

MCP OAuth Connectors and Connected Apps

OAuth sign-in for connectors​

Connector apps such as claude.ai and ChatGPT sign a user in with OAuth instead of asking them to paste a token. Budget Thing supports this for a fixed list of connector clients: claude-ai and chatgpt. They are public clients (no client secret) that must use PKCE with S256, and a client that is not on the list is refused.

Client registration​

A connector can get its client ID automatically through dynamic client registration. The authorization server's discovery document (https://oauth.budgetthing.com/.well-known/openid-configuration) names the endpoint as registration_endpoint:

POST https://api.budgetthing.com/api/oauth2/register
Content-Type: application/json
{
"client_name": "Claude",
"redirect_uris": ["https://claude.ai/api/mcp/auth_callback"],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "none"
}

Registration doesn't create a new client. It is accepted only when every redirect_uris entry is a published callback of one supported connector, compared exactly:

ConnectorClient IDAccepted redirect URIs
Claudeclaude-aihttps://claude.ai/api/mcp/auth_callback, https://claude.com/api/mcp/auth_callback

The response is that connector's existing client, so every user of the connector shares one public client, exactly as with manual setup:

{
"client_id": "claude-ai",
"client_name": "Claude",
"redirect_uris": ["https://claude.ai/api/mcp/auth_callback"],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "none",
"scope": "budgetthing.read budgetthing.write offline_access"
}

The status is 201. No client secret and no registration access token are issued, so the client can't be read, changed or deleted through the registration API. client_name and any other metadata in the request are ignored; the name users see comes from Budget Thing's own configuration.

A refused registration is 400 with an RFC 7591 error:

errorWhen
invalid_redirect_uriredirect_uris is missing, or holds a URI that isn't a supported connector's published callback (or mixes two connectors)
invalid_client_metadatatoken_endpoint_auth_method asks for a client secret or key (anything but none; leaving it out is treated as none), grant_types holds anything but authorization_code and refresh_token, response_types holds anything but code, or the body isn't a JSON object

Client ID metadata documents are not supported.

A connector can also skip registration and use its client ID directly, which is what a user does when the app asks for their own OAuth client: enter claude-ai and leave the client secret blank.

Flow​

  1. The client calls the endpoint without a token and receives 401 with a WWW-Authenticate header that carries a resource_metadata URL (RFC 9728).
  2. It fetches the protected-resource metadata, which names the authorization server, reads the authorization server's discovery document, registers (see Client registration) unless it already has a client ID, and runs the OAuth 2.1 authorization-code flow with PKCE (S256) against it. An authorization request without an S256 code challenge, or with a redirect URI that isn't one of the connector's callbacks, is refused with invalid_request.
  3. During authorization the user signs in to Budget Thing and is asked, on Budget Thing's own consent screen, to pick one workspace and an access level (see below). That choice is stored as a grant. Consent for a connector is never remembered or skipped: every authorization asks again. Both the sign-in step and Allow need a sign-in from the last 15 minutes; a stale session is sent through a fresh sign-in first (see Operations that need a recent sign-in).
  4. The client calls the endpoint with Authorization: Bearer <access token>.

Protected-resource metadata​

GET /.well-known/oauth-protected-resource/api/v1/mcp
GET /.well-known/oauth-protected-resource
{
"resource": "https://api.budgetthing.com/api/v1/mcp",
"resource_name": "Budget Thing",
"authorization_servers": ["https://oauth.budgetthing.com/"],
"scopes_supported": ["budgetthing.read", "budgetthing.write", "offline_access"],
"bearer_methods_supported": ["header"]
}

The first form is the RFC 9728 location for the resource's path. Both are served only while the MCP endpoint and OAuth connectors are enabled; otherwise they return 404.

authorization_servers holds the authorization server's issuer exactly as its own discovery document (/.well-known/openid-configuration) states it, including the trailing slash, so clients that compare issuers byte for byte (RFC 8414 §3.3) accept it. If the authorization server can't be reached to confirm its issuer, the metadata returns 503 with a Retry-After header; retry later.

Access levels​

The user's choice maps one-to-one to personal access token scopes. The client's requested OAuth scopes never widen it: the server derives the permissions from the choice alone.

Access levelScopes granted
Read (the default)Every :read scope
Read and writeEvery :read scope, plus every :write scope except webhooks:write and ledger:write

webhooks:write is withheld because a webhook that posts workspace data to an address of the connector's choosing would keep working after the connection was revoked. ledger:write is withheld because journal entries are raw double-entry postings. A connector asking for budgetthing.write is offered both levels; one asking only for budgetthing.read is offered read only. Read and write is offered only for a workspace the user may change.

Whatever the access level, a connector can only use the MCP tools. The scopes decide which of them work.

An OAuth token is held to exactly the same rules as a personal access token restricted to that workspace: the default-deny route policy, the deny list (personal access tokens, billing, exports, backups, workspace cloning, members, admin, consent and connected-apps routes), the user's role in the workspace, the workspace's plan and the rate limits. OAuth tokens are accepted only on the MCP endpoint, never on the REST API.

How every request is checked​

On every request the server asks the authorization server to introspect the token and requires all of the following. Any failure, including the authorization server being slow or unreachable, is a 401.

  • the token is active and is an access token (token_use=access_token);
  • its audience (aud) contains the canonical endpoint URL exactly (https://api.budgetthing.com/api/v1/mcp);
  • it was issued to a registered client;
  • its session names a grant that exists, has not been revoked, belongs to the token's subject and client, and covers the token's scopes;
  • the grant's workspace has not been deleted.

Membership and role are not part of the token check. They are checked per tool call, exactly as for a personal access token. A user who has been removed from the workspace still presents a valid token, but every tool call fails with a workspace_not_found tool error rather than a 401.

Because the grant is reloaded on every request, revoking it (or deleting the workspace) takes effect on the next call, whatever the token's own lifetime.

Errors​

A refused request is 401 with:

WWW-Authenticate: Bearer realm="budgetthing-mcp", error="invalid_token", resource_metadata="https://api.budgetthing.com/.well-known/oauth-protected-resource/api/v1/mcp"

The body never says which check failed. An unauthenticated request carries the same header without error.

Token lifetimes​

Access tokens are short-lived (30 minutes). Refresh tokens rotate on every use, a reused refresh token revokes the whole token chain, and a refresh token's lifetime is bounded (30 days). These are authorization-server settings.

Connected apps​

A user manages their connected apps in an interactive session, in Settings > Developer > Connected apps. Both operations below refuse personal access tokens and OAuth tokens, so an integration can't list or revoke connections.

List connected apps​

GET /api/v1/me/connected-apps
{
"connectedApps": [
{
"id": "ogr_…",
"clientId": "claude-ai",
"clientName": "Claude",
"workspaceId": "wks_…",
"workspaceName": "Household",
"preset": "read",
"scopes": ["accounts:read", "…"],
"createdAt": "2026-11-11T10:00:00Z",
"lastUsedAt": "2026-11-11T10:05:00Z"
}
]
}

clientName comes from Budget Thing's own configuration, not from the name the client registered with. lastUsedAt is omitted until the app is first used and is updated at most every five minutes.

Disconnect an app​

DELETE /api/v1/me/connected-apps/{grantID}

Returns 204. The app's tokens stop working on its next request. When it was the user's last active grant for that client, the authorization server's consent session for the client is revoked as well. An unknown grant, or one that belongs to another user, returns 404. Granting and revoking are recorded in the workspace's audit log as oauth_grant.created and oauth_grant.revoked.