René's URL Explorer Experiment


Title: fix(client/auth): discard stored client registrations whose secret has expired by claude[bot] · Pull Request #3264 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix(client/auth): discard stored client registrations whose secret has expired by claude[bot] · Pull Request #3264 · modelcontextprotocol/python-sdk

X Title: fix(client/auth): discard stored client registrations whose secret has expired by claude[bot] · Pull Request #3264 · modelcontextprotocol/python-sdk

Description: Requested by Felix Weinberger · Slack thread NoteAI disclosure: this PR was authored by Claude (an AI agent operated by the MCP maintainer team's triage workflow, at Felix Weinberger's request — see attribution above). Fixes #3256. Problem OAuthClientProvider persists client_secret_expires_at (RFC 7591) through TokenStorage but never reads it back, and dynamic registration only happens when stored client info is absent. Once a dynamically registered secret lapses — e.g. against an AS issuing 30-day secrets, or an SDK server with ClientRegistrationOptions.client_secret_expiry_seconds set — every token-endpoint interaction fails with invalid_client, including the exchange after a fresh interactive authorization, so the client is permanently stuck ("I re-authenticated and nothing changed") until the application manually deletes the persisted client info. With no RFC 7592 rotation endpoint, re-registration is the only standard recovery path, and only the SDK client can perform it. Fix The minimal fix from the issue's "expected behavior" (1): a registration that authenticates with the minted secret (client_secret_post / client_secret_basic) and carries a non-zero, past client_secret_expires_at is treated as absent — in _initialize, when loading stored client info (restart case), and at the start of the 401 handler, re-checking the in-memory record (long-lived process whose secret lapses after load, so an interactive consent is never burned on an exchange doomed to fail invalid_client). The next 401 flow then re-registers (or resolves CIMD) and overwrites the dead record via the existing set_client_info call — no change to the TokenStorage contract (unlike draft #3260, which makes the setters accept None). Deliberate scoping: 0 means "never expires" and an absent field means no expiry was declared — both are kept (RFC 7591). Registrations with token_endpoint_auth_method "none"/absent never present the secret, so a lapsed secret does not invalidate them. Stored tokens are kept: a live access token continues to work without client authentication, and with no client info can_refresh_token() is false, so the refresh path that would present the lapsed secret is skipped. Pre-registered flows are unaffected: the client-credentials extension providers override _initialize and never load client info from storage. The issue's "expected behavior" (2) — reactively invalidating on an invalid_client token response for servers that expire registrations without declaring it — is intentionally left out: it needs a way to delete (not just overwrite) persisted state, i.e. a TokenStorage contract decision that deserves its own discussion. docs/client/oauth-clients.md is updated in the same PR: the TokenStorage tip and the CIMD section's "stored client_info still wins" statement now mention the expired-secret discard. Tests Three new tests in tests/client/test_auth.py: predicate unit test covering lapsed secret (post/basic), 0 = never expires, absent expiry, still-live expiry, and "none"-method registrations; flow regression test: a lapsed stored registration is treated as absent on load (stored access token still used), and after the 401 the flow issues a POST /register instead of reusing the dead record; mid-session lapse test: a registration that expires after _initialize already loaded it is discarded by the 401 handler, which then re-registers. ruff format/ruff check clean, pyright strict 0 errors, tests/client/test_auth.py + tests/client/auth + tests/interaction/auth pass with 100% branch coverage on src/mcp/client/auth/oauth2.py.

Open Graph Description: Requested by Felix Weinberger · Slack thread NoteAI disclosure: this PR was authored by Claude (an AI agent operated by the MCP maintainer team's triage workflow, at Felix Weinberger's requ...

X Description: Requested by Felix Weinberger · Slack thread NoteAI disclosure: this PR was authored by Claude (an AI agent operated by the MCP maintainer team's triage workflow, at Felix Weinberger&#3...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/3264

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6019dc7b-b385-5519-0753-494054e97fbc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC9B4:EDA7A:16C3B70:1CECD42:6B01381F
html-safe-noncea0ee56ded0943c9aa5f37172b3fd7bab514634b4debb85a420d58f592956958d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUI0OkVEQTdBOjE2QzNCNzA6MUNFQ0Q0Mjo2QjAxMzgxRiIsInZpc2l0b3JfaWQiOiI2Nzc4NzE4MjI5MDUwMjQzMTAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac20f4d8d3d29dbe6c7916914086b1f406124d1e35107894bcff8a427e88b1a88b
hovercard-subject-tagpull_request:4225926400
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/3264/files
twitter:imagehttps://avatars.githubusercontent.com/in/1236702?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/1236702?s=400&v=4
og:image:altRequested by Felix Weinberger · Slack thread NoteAI disclosure: this PR was authored by Claude (an AI agent operated by the MCP maintainer team's triage workflow, at Felix Weinberger's requ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3264%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3264%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues315 (315)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
claudehttps://github.com/apps/claude
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
fix/oauth-discard-expired-client-registrationhttps://github.com/modelcontextprotocol/python-sdk/tree/fix/oauth-discard-expired-client-registration
Conversation 28 https://github.com/modelcontextprotocol/python-sdk/pull/3264
Commits 9 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits
Checks 38 https://github.com/modelcontextprotocol/python-sdk/pull/3264/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
fix(client/auth): discard stored client registrations whose secret has expired https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#top
Show all changes 9 commits https://github.com/modelcontextprotocol/python-sdk/pull/3264/files
4fac3c7 fix(client/auth): discard stored client registrations with an expired… claude Aug 7, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/4fac3c7b015ccc3ac6c806c528bc8c618448c1e3
50d6b0b fix(client/auth): re-check secret expiry in the 401 flow; document th… claude Aug 7, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/50d6b0b2ff10fb44bd2dad2ef35ee8aa766a5a4e
6b7ab0d chore: retrigger CI after PyPI download timeout claude Aug 7, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/6b7ab0d87fdcc00b4ce8191cf4bbe1f020f6b356
5a246e6 fix(client/auth): run the expiry discard after the SEP-2352 issuer ch… claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/5a246e67730261e92fa4adf2f1a348df6e2b5d8f
e53e526 fix(client/auth): drop the orphaned refresh token on expiry discard; … claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/e53e5263bb9e10e71bfff1c28275d4a9dfe572ec
32a056d test(client/auth): make the expiry-discard test's storage assertions … claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/32a056d4cfd51480f78f7c4b0b455ecea1993edf
43d9599 fix(client/auth): run discovery before the 403 step-up re-registers w… claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/43d9599d84353b4d9443c082e990ae573d5f3356
aedc88c fix(client/auth): finalize the discovery sub-generator when the flow … claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/aedc88c780e043e3dede817bcd2525cfd456e5dd
928b7bf test(client/auth): cover the 403 step-up's exception relay; drop its … claude Aug 10, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3264/commits/928b7bf262dce322ff2003a5fd02ba135758646f
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
oauth-clients.md https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
oauth2.py https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-b7aaf2062da175cea9a532176d6eb78b659eaadb757cc48929f0bafccfdb8d98
utils.py https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-1aed3def34492fb7eafa6e7aee6e9cc9973171b28c9574dc5c5b288a09878996
test_auth.py https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-f083d075f463e8b1ecfa6b931c33288c3d09b00ee3af3e5f74df16b7e75c3ab1
docs/client/oauth-clients.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
View file https://github.com/modelcontextprotocol/python-sdk/blob/928b7bf262dce322ff2003a5fd02ba135758646f/docs/client/oauth-clients.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3264/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
https://github.com/modelcontextprotocol/python-sdk/pull/3264/files#diff-fddbc8202fcc19df6fe65cb61729b4ac59bc61a267deb348d4abe479061bad70
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3264/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.