feat(auth): implement SEP-2207 OIDC-flavored refresh token guidance#676
Draft
wdawson wants to merge 1 commit intomodelcontextprotocol:mainfrom
Draft
feat(auth): implement SEP-2207 OIDC-flavored refresh token guidance#676wdawson wants to merge 1 commit intomodelcontextprotocol:mainfrom
wdawson wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
9 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.
Implements SEP-2207 refresh token guidance for the Rust SDK.
get_access_token()returnsAuthorizationRequiredwhen expired without a refresh token (or when refresh fails), instead of attempting a doomed refreshoffline_accessto requested scopes when the AS advertises it inscopes_supported, so OIDC-flavored servers issue refresh tokensNo server-side changes needed — the SDK already conforms to server guidance, and
register_client()already includesrefresh_tokeningrant_types.Motivation and Context
OIDC Authorization Servers require the
offline_accessscope to issue refresh tokens. Without this, MCP clients connecting through OIDC servers get frequent re-authentication. SEP-2207 adds explicit guidance; this PR brings the Rust SDK into conformance.How Has This Been Tested?
Breaking Changes
None.
get_access_token()now returnsAuthorizationRequiredinstead ofTokenRefreshFailedon refresh failure, but no caller matches onTokenRefreshFailed.offline_accessis only added when the AS explicitly advertises support.Types of changes
Checklist
Additional context
Spec PR: SEP-2207
Companion PRs: Python SDK#2039 · TypeScript SDK#1523
AI Disclosure: AI assisted with implementation and test authoring. All changes were reviewed and guided by hand.