René's URL Explorer Experiment


Title: Add resource_owner field to AuthorizationCode and AccessToken classes by yukuanj · Pull Request #1517 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Add resource_owner field to AuthorizationCode and AccessToken classes by yukuanj · Pull Request #1517 · modelcontextprotocol/python-sdk

X Title: Add resource_owner field to AuthorizationCode and AccessToken classes by yukuanj · Pull Request #1517 · modelcontextprotocol/python-sdk

Description: Summary This PR adds a resource_owner field to both AuthorizationCode and AccessToken classes, bonding the identity of the resource owner to the issued access tokens through the authorization flow. Motivation and Context This PR solves #1038 (request to add a subject to AccessToken) OAuth 2.1 §7.4 (https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-14) notes that resource servers may make access control decisions based on the identity of the resource owner (for user-delegated flows) or the client (for client credentials flows). In other words, tool calls and resource fetches often need to depend on who the token is on behalf of, not just its scopes. Resource servers may make access control decisions based on the identity of a resource owner for which an access token was issued, or based on the identity of a client in the client credentials grant. Therefore, it is likely that the behavior of calling a tool / fetching a resource needs to depend on the identity of the resource owner. There was an initial attempt to solve this (#1165), but it has been closed for inactivity. That thread mentioned there was no JWT payload to build from; this change avoids that dependency entirely. The feature is token-format agnostic: it does not require JWTs and works equally with opaque tokens. What Has Been Changed? AuthorizationCode class: add resource_owner. AccessToken class : add resource_owner. Token Issuance & Introspection Path (in the simple-auth example): When generating an authorization code, the AS stores the corresponding resource_owner. When exchanging the code for an access token, the AS binds the resulting token to that resource_owner. When the RS introspects the access token, the AS includes the resource_owner in the introspection result. How Has This Been Tested? Tested with the simple-auth example to issue codes, tokens and introspect with resource_owner. Breaking Changes No breaking changes. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context Naming alternatives Issue #1038 asked for subject. In JWT ecosystems, subject (sub) is commonly the canonical identifier. This PR uses resource_owner to mirror OAuth terminology in user-delegated flows. If maintainers prefer subject, this can be trivially renamed.

Open Graph Description: Summary This PR adds a resource_owner field to both AuthorizationCode and AccessToken classes, bonding the identity of the resource owner to the issued access tokens through the authorization flow....

X Description: Summary This PR adds a resource_owner field to both AuthorizationCode and AccessToken classes, bonding the identity of the resource owner to the issued access tokens through the authorization flow....

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

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:2b9da391-358f-4b80-a8fe-0b9bf3347a8e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9C80:2BB463:38D215:4E082B:6AFD1068
html-safe-noncea7408f980622ff8f7037955d6a21dcbc4d6e5065ca7afbc0d1cfaa5deb0be322
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzgwOjJCQjQ2MzozOEQyMTU6NEUwODJCOjZBRkQxMDY4IiwidmlzaXRvcl9pZCI6IjU5Mjg5NDQ1NDQyMTYwNjAwMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd9b11760b224aba9471d92fb83bacd441d4e167c61753baa20979c3d01bbc171
hovercard-subject-tagpull_request:2949966779
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/1517/files
twitter:imagehttps://avatars.githubusercontent.com/u/234094463?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/234094463?s=400&v=4
og:image:altSummary This PR adds a resource_owner field to both AuthorizationCode and AccessToken classes, bonding the identity of the resource owner to the issued access tokens through the authorization flow....
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7c34e25df4e46e972c8f0225e63410231bdeb9ea5634597c712796bbcdb2e627
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
release8fa571ebaa95e4e6bf872197c0e84b7dc48e6785
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1517%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%2F1517%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/1517/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues306 (306)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
yukuanjhttps://github.com/yukuanj
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
yukuanj:mainhttps://github.com/yukuanj/python-sdk/tree/main
Conversation 4 https://github.com/modelcontextprotocol/python-sdk/pull/1517
Commits 7 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits
Checks 26 https://github.com/modelcontextprotocol/python-sdk/pull/1517/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/1517/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files
Add resource_owner field to AuthorizationCode and AccessToken classes https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#top
Show all changes 7 commits https://github.com/modelcontextprotocol/python-sdk/pull/1517/files
a962f21 Add resource_owner field to AuthorizationCode and AccessToken classes yukuanj Oct 27, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/a962f2189c3ee904bbac11837d1f37b4baabfc8d
042fa3d Add resource_owner field in the introspection process yukuanj Oct 27, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/042fa3d9485be8f5e6f90b36fd65cab2e42fe42a
8840ae1 Merge branch 'modelcontextprotocol:main' into main yukuanj Oct 30, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/8840ae12f2f9b48eec00f2b93d2b6129c440b8a7
4780e00 Merge branch 'modelcontextprotocol:main' into main yukuanj Jan 19, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/4780e004659418d757df4571a6b76b5174496fe5
ee19453 add resource and resource_owner to RefreshToken yukuanj Jan 19, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/ee194530e3234528edc1390aa451c36606f7397a
21c8417 Merge branch 'main' into main yukuanj Jan 29, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/21c8417d2e3e23bb96037cf340482537a9885381
d369b79 Merge branch 'main' into main yukuanj Mar 6, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1517/commits/d369b79d42835c31861b3f2e42708c281e0357da
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/1517/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files
auth_server.py https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-1923b3db33049224b57ac8bf6131919e088dd382ebaa61902f49ce6d601b7899
simple_auth_provider.py https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
token_verifier.py https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-488377b765d8b32e8e5fb73fa28dec511790c79066d63d37b2e18d85ee5ef19d
provider.py https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-f7e852ad288ea2750460eb8e8ef0d6152216cd97ae505acd5f06146cf866abec
examples/servers/simple-auth/mcp_simple_auth/auth_server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-1923b3db33049224b57ac8bf6131919e088dd382ebaa61902f49ce6d601b7899
View file https://github.com/yukuanj/python-sdk/blob/d369b79d42835c31861b3f2e42708c281e0357da/examples/servers/simple-auth/mcp_simple_auth/auth_server.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1517/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-1923b3db33049224b57ac8bf6131919e088dd382ebaa61902f49ce6d601b7899
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-1923b3db33049224b57ac8bf6131919e088dd382ebaa61902f49ce6d601b7899
examples/servers/simple-auth/mcp_simple_auth/simple_auth_provider.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
View file https://github.com/yukuanj/python-sdk/blob/d369b79d42835c31861b3f2e42708c281e0357da/examples/servers/simple-auth/mcp_simple_auth/simple_auth_provider.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1517/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-41a606ab858c2ba47b880a5f09e15157ee945ab71c528227e29e368616d84d47
examples/servers/simple-auth/mcp_simple_auth/token_verifier.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-488377b765d8b32e8e5fb73fa28dec511790c79066d63d37b2e18d85ee5ef19d
View file https://github.com/yukuanj/python-sdk/blob/d369b79d42835c31861b3f2e42708c281e0357da/examples/servers/simple-auth/mcp_simple_auth/token_verifier.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1517/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-488377b765d8b32e8e5fb73fa28dec511790c79066d63d37b2e18d85ee5ef19d
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-488377b765d8b32e8e5fb73fa28dec511790c79066d63d37b2e18d85ee5ef19d
src/mcp/server/auth/provider.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-f7e852ad288ea2750460eb8e8ef0d6152216cd97ae505acd5f06146cf866abec
View file https://github.com/yukuanj/python-sdk/blob/d369b79d42835c31861b3f2e42708c281e0357da/src/mcp/server/auth/provider.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1517/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-f7e852ad288ea2750460eb8e8ef0d6152216cd97ae505acd5f06146cf866abec
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-f7e852ad288ea2750460eb8e8ef0d6152216cd97ae505acd5f06146cf866abec
https://github.com/modelcontextprotocol/python-sdk/pull/1517/files#diff-f7e852ad288ea2750460eb8e8ef0d6152216cd97ae505acd5f06146cf866abec
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.