Connect with OAuth (MCP)
Add BrainstormRouter to Claude, ChatGPT, and other MCP clients by signing in — no API key to paste.
This flow is off by default. It is available only on a deployment where the operator has set BR_MCP_OAUTH_ENABLED=1. When it is off, the discovery URLs below return 404 and the MCP endpoint accepts API keys only (Authorization: Bearer br_live_…).
What it does
BrainstormRouter's MCP endpoint is https://api.brainstormrouter.com/v1/mcp/connect. With OAuth enabled, an MCP client that has no key can still connect: it sends you to the BrainstormRouter dashboard, you sign in and approve what the client may do, and the client receives a short-lived token.
You do not create an OAuth app first. The client identifies itself in one of three ways:
| Client identity | How it works | Shown on the consent screen as |
|---|---|---|
| Client ID Metadata Document | The client_id is an https:// URL the client publishes. BrainstormRouter fetches it. | The host of that URL, marked _Unverified_ |
| Dynamic Client Registration | The client registers itself at POST /auth/oauth/register. | The name it chose, marked _Unverified_ |
| Pre-registered app | A developer created it with POST /v1/oauth/apps (client_id starts with br_app_). | Its registered name |
Connect from Claude
- In Claude, add a custom connector (Settings → Connectors).
- Enter the server URL exactly:
https://api.brainstormrouter.com/v1/mcp/connect - Leave any OAuth client ID / secret fields empty — BrainstormRouter has no client secrets.
- Connect. A BrainstormRouter page opens: sign in, review the request, and choose Approve.
Claude identifies itself with a Client ID Metadata Document hosted on claude.ai, and its redirect URI is https://claude.ai/api/mcp/auth_callback. The consent screen shows both hosts — check that they are claude.ai before approving. Menu names in Claude change; Anthropic's custom connector documentation is the reference for the client side.
Connect from ChatGPT
- In ChatGPT, create a connector (app) that points at the MCP server URL
https://api.brainstormrouter.com/v1/mcp/connect.
- Choose OAuth as the authentication method. No client ID or secret is needed.
- Connect, sign in to BrainstormRouter, and approve.
OpenAI's authentication guide is the reference for the client side.
Connect from any other MCP client
Give the client the MCP URL. A client that follows the MCP authorization specification discovers everything else:
# 1. The MCP endpoint answers 401 and says where the metadata is
curl -i -X POST https://api.brainstormrouter.com/v1/mcp/connect
# WWW-Authenticate: Bearer resource_metadata="https://api.brainstormrouter.com/.well-known/oauth-protected-resource/v1/mcp/connect", scope="models completions tools"
# 2. Protected resource metadata (RFC 9728)
curl https://api.brainstormrouter.com/.well-known/oauth-protected-resource/v1/mcp/connect
# 3. Authorization server metadata (RFC 8414)
curl https://api.brainstormrouter.com/.well-known/oauth-authorization-server
Requirements for clients:
- Public clients only. There are no client secrets;
token_endpoint_auth_methodisnone. - PKCE with
S256is mandatory. - Redirect URIs must be
https://…, orhttp://on127.0.0.1,localhostor[::1](any
port). At most five. Custom URI schemes are not accepted for metadata-document or dynamically registered clients.
- Send
resource=https://api.brainstormrouter.com/v1/mcp/connecton the authorization and token
requests. Any other value is rejected with invalid_target.
- The token endpoint accepts
application/x-www-form-urlencoded(and JSON).
Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /.well-known/oauth-protected-resource/v1/mcp/connect | Protected resource metadata (also served at /.well-known/oauth-protected-resource) |
GET | /.well-known/oauth-authorization-server | Authorization server metadata |
GET | /auth/oauth/authorize | Starts sign-in and consent in the browser |
POST | /auth/oauth/token | authorization_code and refresh_token grants |
POST | /auth/oauth/register | Dynamic client registration (RFC 7591) |
POST | /auth/oauth/revoke | Token revocation (RFC 7009) |
GET | /auth/oauth/userinfo | The account behind an access token |
Scopes
| Scope | Lets the client |
|---|---|
models | See which models and providers your account can use |
completions | Send prompts to models (spends on your own provider keys) |
embeddings | Create embeddings (spends on your own provider keys) |
memory | Read and write your stored memories |
usage | Read usage, cost and audit history |
tools | Run the execution tools: br_generate_image, br_generate_speech, br_transcribe_audio, br_list_connected_tools, br_call_connected_tool. This also allows sending prompts, and reading (not changing) your stored memories, which is how an agent loads the marketing brief. |
offline_access | Nothing by itself; clients send it to ask for a refresh token |
full | Everything the developer role can do |
An MCP client is told to ask for models completions tools. That is enough to read memory but not to write it; a client that should save memories must also ask for memory. If a client asks for nothing, it gets completions models. No scope reaches beyond the developer role, and a tool the token's scopes do not cover fails with Forbidden: requires .
Media and connected-service tools run on your own provider keys. If you have not added one, they return provider_key_required.
Tokens
| Token | Format | Lifetime |
|---|---|---|
| Access token | A BrainstormRouter API key (br_live_…) | 1 hour |
| Refresh token | Opaque (br_rt_…) | 30 days from the first sign-in, not extended by use |
Every refresh returns a new refresh token and retires the old one, along with the previous access token. If a retired refresh token is ever presented again, BrainstormRouter treats it as stolen: the whole chain and its current access token are revoked and you are asked to sign in again. An authorization code that is presented twice has the same effect.
A token response:
{
"access_token": "br_live_…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "br_rt_…",
"scope": "models completions tools"
}
Errors use the standard OAuth shape, for example {"error": "invalid_grant", "error_description": "…"}.
Disconnect
- From the client: clients that support it call
POST /auth/oauth/revokewhen you remove the
connector. Revoking either token ends the whole grant.
- From BrainstormRouter: open Dashboard → API Keys and revoke the key named
OAuth:.
The client's next refresh will mint a new key until the grant expires, so to end a grant completely, remove the connector in the client as well.
Who am I connected as?
curl https://api.brainstormrouter.com/auth/oauth/userinfo \
-H "Authorization: Bearer $ACCESS_TOKEN"
{
"sub": "0b8f3a52-…",
"email": "you@example.com",
"email_verified": true,
"tenant_id": "5c1d9e07-…"
}
email_verified is true when the account was created by signing in through an identity provider.
For operators
| Variable | Default | Effect |
|---|---|---|
BR_MCP_OAUTH_ENABLED | unset (off) | 1 turns the flow on |
BR_PUBLIC_API_URL | https://api.brainstormrouter.com | The issuer and the base of every advertised URL. Never taken from the Host header. |
BRAINSTORMROUTER_PUBLIC_DASHBOARD_URL | https://brainstormrouter.com/dashboard/ | Where the browser is sent to sign in and consent |
BR_MCP_OAUTH_DCR_PER_IP_HOURLY | 10 | Dynamic registrations per IP per hour |
BR_MCP_OAUTH_DCR_DAILY_CAP | 500 | Dynamic registrations across all callers per 24 hours |
The dashboard must be deployed with the consent page before the flag is turned on, and database migration v71 must have run.