René's URL Explorer Experiment


Title: Pass httpx auth through ClientSessionGroup HTTP parameters by mateolafalce · Pull Request #3840 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Pass httpx auth through ClientSessionGroup HTTP parameters by mateolafalce · Pull Request #3840 · modelcontextprotocol/python-sdk

X Title: Pass httpx auth through ClientSessionGroup HTTP parameters by mateolafalce · Pull Request #3840 · modelcontextprotocol/python-sdk

Description: Fixes #1723 Summary ClientSessionGroup could not carry an httpx2.Auth. Callers had to put a bearer token in headers, so an OAuthClientProvider (discovery, refresh) could not run from a session group. SseServerParameters and StreamableHttpParameters now take an optional auth. connect_to_server passes it to sse_client and create_mcp_http_client. auth is omitted from model_dump(), model_dump_json(), and repr(): the handler can hold a credential, and it is not JSON. Behavior auth defaults to None. Stdio is unchanged. One auth instance per server. Two servers that share one OAuthClientProvider share its tokens and its refresh cycle. headers= is still sent. A header other than Authorization arrives as set. If the handler sets Authorization, that value is what the server sees. OAuthClientProvider sets it once it has an access token. The docs example defines its own bearer handler, so copying it runs. OAuthClientProvider drops into the same auth= slot. Building one is covered in the OAuth clients page. Tests In-process streamable HTTP and legacy SSE: the server sees the handler's bearer token. Two servers in one group see two different tokens. A manual Authorization header does not survive a handler that sets its own, and X-Trace-Id does. Dumps do not contain the token. uv run --frozen pytest tests/client/test_session_group.py tests/docs_src/test_session_groups.py Pyright on the touched files reports 0 errors. Disclosure: an AI assistant drafted this change at my request. This branch is independent of #2065 and #3516, which are still open. It is based on current main (so max_sse_event_size is unchanged) and covers the open review notes on #3516: the docs example runs, and the test states which Authorization value the server sees.

Open Graph Description: Fixes #1723 Summary ClientSessionGroup could not carry an httpx2.Auth. Callers had to put a bearer token in headers, so an OAuthClientProvider (discovery, refresh) could not run from a session grou...

X Description: Fixes #1723 Summary ClientSessionGroup could not carry an httpx2.Auth. Callers had to put a bearer token in headers, so an OAuthClientProvider (discovery, refresh) could not run from a session grou...

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

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:5092ef22-4db7-9247-327f-e5ae10507daf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC5D4:24ACB9:16962ED:1DA81A6:6B012A75
html-safe-nonceb43639014a824dcdab3cb003524545652621dd214611d901c7366e533fb13295
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUQ0OjI0QUNCOToxNjk2MkVEOjFEQTgxQTY6NkIwMTJBNzUiLCJ2aXNpdG9yX2lkIjoiMTQ5ODU4MTM5MzUwNzE2NjgzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6a15d12cfd99e0b9b3ff024d893ed5347cbc8541fa396353b3b653a805bcb56c
hovercard-subject-tagpull_request:5216153980
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/3840/files
twitter:imagehttps://avatars.githubusercontent.com/u/98977436?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/98977436?s=400&v=4
og:image:altFixes #1723 Summary ClientSessionGroup could not carry an httpx2.Auth. Callers had to put a bearer token in headers, so an OAuthClientProvider (discovery, refresh) could not run from a session grou...
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/3840/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3840%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%2F3840%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/3840/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues313 (313)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
mateolafalcehttps://github.com/mateolafalce
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
mateolafalce:feat/session-group-http-authhttps://github.com/mateolafalce/python-sdk/tree/feat/session-group-http-auth
Conversation 2 https://github.com/modelcontextprotocol/python-sdk/pull/3840
Commits 2 https://github.com/modelcontextprotocol/python-sdk/pull/3840/commits
Checks 33 https://github.com/modelcontextprotocol/python-sdk/pull/3840/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3840/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
Pass httpx auth through ClientSessionGroup HTTP parameters https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#top
Show all changes 2 commits https://github.com/modelcontextprotocol/python-sdk/pull/3840/files
ff78bb6 Pass httpx auth through ClientSessionGroup HTTP parameters mateolafalce Nov 8, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3840/commits/ff78bb6cf80efcbc2e753d3b94b2b621aebac2e9
606db60 Cover the session group auth test helpers mateolafalce Nov 8, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3840/commits/606db6003a2d25813ddbaeb6e971db3dada35b67
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3840/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
session-groups.md https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
transports.md https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1e8dad68fc5833fd229242cdafbfe85ab6382fbfb42e0c7e3080118ddc9b68c2
tutorial005.py https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1c034b27d985c8c85eb8ed6f75ff7515a2af941efb637714ef874cd3dc40ac29
session_group.py https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
_httpx_utils.py https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
test_session_group.py https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
test_session_groups.py https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
docs/client/session-groups.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/docs/client/session-groups.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
docs/client/transports.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1e8dad68fc5833fd229242cdafbfe85ab6382fbfb42e0c7e3080118ddc9b68c2
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/docs/client/transports.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1e8dad68fc5833fd229242cdafbfe85ab6382fbfb42e0c7e3080118ddc9b68c2
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1e8dad68fc5833fd229242cdafbfe85ab6382fbfb42e0c7e3080118ddc9b68c2
docs_src/session_groups/tutorial005.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-1c034b27d985c8c85eb8ed6f75ff7515a2af941efb637714ef874cd3dc40ac29
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/docs_src/session_groups/tutorial005.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
src/mcp/client/session_group.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/src/mcp/client/session_group.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
src/mcp/shared/_httpx_utils.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/src/mcp/shared/_httpx_utils.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
tests/client/test_session_group.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/tests/client/test_session_group.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
tests/docs_src/test_session_groups.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
View file https://github.com/modelcontextprotocol/python-sdk/blob/606db6003a2d25813ddbaeb6e971db3dada35b67/tests/docs_src/test_session_groups.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3840/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
https://github.com/modelcontextprotocol/python-sdk/pull/3840/files#diff-3348dcdeddef442fa66d823ae045c64c935d50c80049ab6a71498eed98aa53b0
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3840/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.