Files
Max Isbey d95f3a6922 fix: remove scope registration check from authorize handler
The check in validate_scope rejected any requested scope not in the
client's registered metadata. This broke the MCP spec's step-up
authorization flow: when a server returns 403 insufficient_scope with
a WWW-Authenticate challenge containing expanded scopes, the client
(see client/auth/oauth2.py) re-authorizes with those scopes and the
server would reject them.

RFC 7591 Section 2 defines the scope field as scopes the client "can
use", with no language restricting requests to that set. Scope policy
enforcement belongs in OAuthAuthorizationServerProvider.authorize(),
which can already raise AuthorizeError(error="invalid_scope", ...).

The TypeScript SDK removed this check in #983 for the same reason.

InvalidScopeError is removed as it was only raised from this path.

Reported-by: nik1097
Github-Issue: #2216
2026-03-17 11:51:31 +00:00
..
2025-03-25 13:06:15 +01:00
2026-01-25 14:45:52 +01:00
2026-01-25 14:45:52 +01:00