Skip to content

Commit b863e4c

Browse files
committed
Document scope policy as the provider's responsibility in authorize()
Spell out on OAuthAuthorizationServerProvider.authorize() that the requested scopes have only been checked against the server-wide valid_scopes and that per-client scope policy is enforced here, so the contract lives on the interface operators implement rather than only in the migration guide. No-Verification-Needed: docstring-only change
1 parent 7d398a0 commit b863e4c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/mcp/server/auth/provider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ async def authorize(self, client: OAuthClientInformationFull, params: Authorizat
192192
and MUST generate an authorization code with at least 128 bits of entropy.
193193
See https://datatracker.ietf.org/doc/html/rfc6749#section-10.10.
194194
195+
Scope policy is this method's responsibility. `params.scopes` has been checked only
196+
against the server-wide `ClientRegistrationOptions.valid_scopes` (when configured); the
197+
client's registered `scope` metadata is self-asserted (RFC 7591 §2) and is not enforced.
198+
Reject a request the client may not make by raising `AuthorizeError` with
199+
`error="invalid_scope"`, or grant a narrower scope set - and issue the token accordingly.
200+
195201
Args:
196202
client: The client requesting authorization.
197203
params: The parameters of the authorization request.

0 commit comments

Comments
 (0)