11-25-2025 compliant Auth#651
Merged
alexhancock merged 10 commits intomodelcontextprotocol:mainfrom Feb 12, 2026
Merged
Conversation
- add WWWAuthenticateParams for parsing scope and resource_metadata from headers - add ScopeUpgradeConfig and scope tracking in AuthorizationManager - add InsufficientScopeError and 403 handling in streamable HTTP client - add scope union computation for progressive authorization - export new public types: AuthClient, ScopeUpgradeConfig, WWWAuthenticateParams Co-authored-by: fizy069 <fizy069@users.noreply.github.com>
|
Idea: conformance could be used to test against a live server. Some of the other SDK projects test against it in CI, e.g. https://github.com/modelcontextprotocol/python-sdk/blob/main/.github/workflows/conformance.yml |
Contributor
Author
Will leave this up to @alexhancock to tackle in a separate PR probably. Unless you'd like me to add here. Don't want it to be bigger than it needs to be |
9 tasks
alexhancock
approved these changes
Feb 12, 2026
Contributor
|
Nice @wdawson. Thanks! Will get it released soon |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bring the SDK's OAuth implementation into compliance with MCP Authorization Spec 2025-11-25 and wire up automatic scope selection and upgrade flows.
As discussed with @alexhancock in #641
Motivation and Context
The SDK's OAuth implementation targeted the 2025-03-26 spec and was missing several features from the 2025-11-25 revision:
SDK consumers also had to manually manage scope selection and handle scope upgrade flows. This change makes those automatic.
How Has This Been Tested?
cargo test -p rmcp --lib --all-features)Breaking Changes
AuthorizationMetadatahas a new fieldcode_challenge_methods_supported: Option<Vec<String>>. Code that constructs this struct with explicit fields (not..Default::default()) will need to add the field. Thecomplex_auth_streamhttpexample has been updated accordingly.handle_response()now returnsAuthError::InsufficientScopeon 403 witherror="insufficient_scope"in the WWW-Authenticate header, andAuthError::AuthorizationFailed("Forbidden")for other 403 responses. Previously all non-401 responses were passed through asOk.Types of changes
Checklist
Additional context
This incorporates work from PR #595 by @fizy069 (SEP-835 scope handling). The relevant commits include a Co-authored-by trailer to preserve attribution.
Security vs compatibility philosophy: the SDK defaults to correct spec behavior but falls back gracefully for non-compliant servers, except where the fallback would be insecure. PKCE S256 is always enforced (never falls back to plain or no challenge). RFC 8707 resource parameter is always sent but the flow continues if the server ignores it.
The
select_scopes()priority chain follows SEP-835:scopefrom WWW-Authenticate headerscopes_supportedfrom Protected Resource Metadata (RFC 9728)scopes_supportedfrom AS metadataPassing empty scopes to
start_authorization()triggers auto-selection using this chain.