Dialing in scopes for MCP sign-ins
David Danialy
Published · 5 min read
MCP authorization has a scope-selection problem during OAuth sign-in. Ask for too few scopes and the MCP server can't do its job. Ask for too many and people face a consent screen longer than a terms-of-service page, or an identity provider that rejects the request outright.
Speakeasy asks the MCP server which OAuth scopes it needs. Sign-ins request those scopes and fall back to the identity provider's full list only when no other source supplies them.
How do MCP servers request OAuth scopes?
The MCP authorization spec gives a server two ways to tell us.
First, when a request arrives without a valid token, the server replies 401 with a WWW-Authenticate header (RFC 6750). Its scope value lists what the request needs, and the spec treats that list as authoritative.
The server can also publish its supported scopes at a well-known URL in protected resource metadata (RFC 9728).
For a server at https://mcp.example.com/mcp, the challenge response can request scopes like this:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer scope="issues:read issues:write"
The client retrieves that document from the server’s well-known URL:
GET /.well-known/oauth-protected-resource/mcp HTTP/1.1
Host: mcp.example.com
The server responds with the metadata document:
HTTP/1.1 200 OK
Content-Type: application/json
{
"resource": "https://mcp.example.com/mcp",
"authorization_servers": ["https://auth.example.com"],
"scopes_supported": ["issues:read", "issues:write", "projects:read"]
}
The flow shows how each piece fits into a sign-in:
The metadata must name the server URL exactly, including whether it ends in a slash. We skip it if the resource value does not match. The advertised scopes may omit what a server later requires; challenges and pins handle those additional scopes.
How are requested MCP OAuth scopes chosen?
Six sources can supply the scopes. We check them in order, and the first one with an answer wins:
- Client scope override. Scopes an admin sets on the remote session client page. The client is the connection Speakeasy uses to sign in to the identity provider.
- Server challenge scopes. The
scopefrom the server's latest rejection, itsWWW-Authenticateheader. - Pinned server scopes. A fixed list an admin sets in the Pinned scopes field of an MCP server's Settings › Identity, sent exactly as written, even if the server doesn't list those scopes. A pin belongs to the server's URL, so every server in the project at that URL shares it.
- Server advertised scopes. The
scopes_supportedlist from the server's advertised menu. - Provider scope override. A fixed list set on the identity provider.
- Provider scope catalog. Every scope the identity provider offers, as a last resort. Turn on Request default scopes when the MCP server advertises none on the identity provider to send no scopes instead, and the identity provider applies its own default scopes or, depending on its policy, rejects the request (RFC 6749 §3.3).
The diagram also shows who controls each source:
For example, a server challenge takes precedence over pinned server scopes. When the server provides no challenge or advertised scopes, a pin or provider override can still supply the request. If no source supplies scopes, the identity provider setting determines whether Speakeasy requests its full catalog or sends no scopes so the provider can apply its defaults.
Scopes an admin sets go out exactly as written, whether that's a client scope override, pinned server scopes, or a provider scope override. If the server's challenge scopes win, we add openid, email, profile, and offline_access only when the server itself advertises them. Advertised lists go out as published. Want to know who signed in, or keep them signed in? Include openid or offline_access in the scopes you set.
How can you preview OAuth scopes before MCP sign-in?
To check what a sign-in will ask for, open the MCP server's Settings › Identity. A note under Pinned scopes says which of the six sources is in charge. Here, the pin wins:

If a pin is set but something higher up wins, the note says what. Teammates who can view the server but not edit it see a read-only "Requested at sign-in" summary instead, with the scopes and where they came from, like "Advertised by the MCP server."
What happens to existing MCP connections after scope changes?
Changing the scope settings does not change an active connection or revoke its existing grant. The connection keeps its granted scopes until the client starts another sign-in. Speakeasy requests the updated set then, and the identity provider handles any consent step under its own policy.
How to configure OAuth scopes for MCP servers
Sign-ins already ask each server what it needs. Change settings in these cases:
- The server's menu asks for more than your team should approve. Pin server scopes on its URL. A pin outranks the server's menu, though a client scope override or the server's challenge scopes still win over it.
- The server says nothing. With no challenge scopes and no menu, sign-ins fall through to the identity provider's settings. Pin server scopes to choose the set yourself. Without a pin or a provider scope override, turn on Request default scopes when the MCP server advertises none so the identity provider applies its defaults (or rejects the request, depending on its policy) instead of being asked for its whole catalog.
- A sign-in asks for something unexpected. Open the server's Settings › Identity, where the note under Pinned scopes names the source in charge. If the server's menu is being skipped, check that its
resourcevalue matches the server URL exactly. A trailing slash is enough to break the match.
Standards
Scope discovery follows the MCP authorization spec, RFC 9728 for protected resource metadata, RFC 6750 for bearer token challenges, and RFC 6749 §3.3 for the scope parameter.
Open the Speakeasy MCP Gateway, connect a remote MCP server, and see what its sign-ins will ask for.