René's URL Explorer Experiment


Title: feat(client): support HTTP auth in ClientSessionGroup by musi22 · Pull Request #3516 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: feat(client): support HTTP auth in ClientSessionGroup by musi22 · Pull Request #3516 · modelcontextprotocol/python-sdk

X Title: feat(client): support HTTP auth in ClientSessionGroup by musi22 · Pull Request #3516 · modelcontextprotocol/python-sdk

Description: Closes #1723 Summary ClientSessionGroup server parameters (SseServerParameters and StreamableHttpParameters) lacked an auth field, requiring users to manually manage bearer tokens via the headers parameter and preventing automated OAuth flows (like OAuthClientProvider) with dynamic client registration and token refresh. This change adds an optional auth: httpx2.Auth | None = None parameter to both HTTP server parameter models and propagates it into sse_client() and create_mcp_http_client(). Changes Added auth: httpx2.Auth | None = Field(default=None, description="Optional HTTPX authentication handler.", exclude=True) to SseServerParameters and StreamableHttpParameters. Added ConfigDict(arbitrary_types_allowed=True) to both parameter models. Propagated auth to sse_client() and create_mcp_http_client() within ClientSessionGroup._establish_session(). Added unit tests in tests/client/test_session_group.py verifying: auth is passed to sse_client() in SSE transport. auth is passed to create_mcp_http_client() in Streamable HTTP transport. Pydantic serialization (model_dump, model_dump_json) safely excludes auth. Independent auth state is maintained when multiple servers are connected to the same session group. Existing custom headers and auth handler cleanly coexist. Updated docs/client/session-groups.md with an authentication usage guide and example. Backward Compatibility 100% backward compatible: auth defaults to None. Existing static headers configurations remain fully supported. StdioServerParameters is unaffected. Test Plan uv run --frozen pytest tests/client/test_session_group.py (17 passed, 100% coverage on session_group.py). uv run --frozen pytest tests/client/ (778 passed, 0 regressions). uv run --frozen pyright src/mcp/client/session_group.py tests/client/test_session_group.py (0 errors). uv run --frozen ruff check . and uv run --frozen ruff format --check . (passed).

Open Graph Description: Closes #1723 Summary ClientSessionGroup server parameters (SseServerParameters and StreamableHttpParameters) lacked an auth field, requiring users to manually manage bearer tokens via the headers p...

X Description: Closes #1723 Summary ClientSessionGroup server parameters (SseServerParameters and StreamableHttpParameters) lacked an auth field, requiring users to manually manage bearer tokens via the headers p...

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

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:08cf6701-817b-bca9-eaf0-15a738024a06
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB2FE:DA744:11AB632:17C3D25:6B0124B2
html-safe-nonce5530a246b1f7341db8e1562dd7563380f7880695e95fcbb4365d4d3fe7fab096
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkZFOkRBNzQ0OjExQUI2MzI6MTdDM0QyNTo2QjAxMjRCMiIsInZpc2l0b3JfaWQiOiIxOTQxNzcxOTU1MjkyODI3MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace63b86def365fb89c32e5619414ae1e0a4e8eb891fdd759d870accc2468adcc8
hovercard-subject-tagpull_request:4557296721
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/3516/files
twitter:imagehttps://avatars.githubusercontent.com/u/97947688?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/97947688?s=400&v=4
og:image:altCloses #1723 Summary ClientSessionGroup server parameters (SseServerParameters and StreamableHttpParameters) lacked an auth field, requiring users to manually manage bearer tokens via the headers p...
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/3516/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3516%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%2F3516%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/3516/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues310 (310)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
musi22https://github.com/musi22
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
musi22:feat/session-group-httpx-authhttps://github.com/musi22/python-sdk/tree/feat/session-group-httpx-auth
Conversation 6 https://github.com/modelcontextprotocol/python-sdk/pull/3516
Commits 6 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits
Checks 33 https://github.com/modelcontextprotocol/python-sdk/pull/3516/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3516/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
feat(client): support HTTP auth in ClientSessionGroup https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#top
Show all changes 6 commits https://github.com/modelcontextprotocol/python-sdk/pull/3516/files
0478dd4 feat(client): support HTTP auth in ClientSessionGroup musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/0478dd4f708ace9961500aa7e0ee4e34f5ba3b76
cd3ec03 docs: wrap session group auth example in async function musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/cd3ec03f6d066b1bfd0dc380ccb0f197536701ae
4b20b7b test: exercise auth_flow to achieve 100% test file coverage musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/4b20b7b151de774424eb571c1451d1e16c939fd5
41a7fca test: remove obsolete pragma and isolate session establishment in tests musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/41a7fcadceaeb5de02b2244195e8dd56cdec7777
84e6778 test: use patch decorators on session tests to prevent python 3.14 br… musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/84e6778462e3077ea52f4c3f82d86ae32f80fd81
cf40ca7 docs(session-groups): add asyncio runner to auth example musi22 Oct 25, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3516/commits/cf40ca7862e4e97a06be8a7f93327ddb942b0371
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3516/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
session-groups.md https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
session_group.py https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
_httpx_utils.py https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
test_session_group.py https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
docs/client/session-groups.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
View file https://github.com/modelcontextprotocol/python-sdk/blob/cf40ca7862e4e97a06be8a7f93327ddb942b0371/docs/client/session-groups.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3516/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
cubic-dev-aihttps://github.com/apps/cubic-dev-ai
Sep 17, 2026https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#r4035715130
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-f56084b2efc152872969d0359e346dc414cf96b6d1caa4bd67ca13d4504ee18e
src/mcp/client/session_group.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
View file https://github.com/modelcontextprotocol/python-sdk/blob/cf40ca7862e4e97a06be8a7f93327ddb942b0371/src/mcp/client/session_group.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3516/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-cbe797d477654047e3091f5e3c0a1046d9197e34ed55d884c7d957ef4e61d775
src/mcp/shared/_httpx_utils.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
View file https://github.com/modelcontextprotocol/python-sdk/blob/cf40ca7862e4e97a06be8a7f93327ddb942b0371/src/mcp/shared/_httpx_utils.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3516/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-c4baff3567caa38efcdfd8b6a554abe19fcf6429c80e6e693ed1a847a7aec431
tests/client/test_session_group.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
View file https://github.com/modelcontextprotocol/python-sdk/blob/cf40ca7862e4e97a06be8a7f93327ddb942b0371/tests/client/test_session_group.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3516/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
https://github.com/modelcontextprotocol/python-sdk/pull/3516/files#diff-5278bd22bb86f5828e6bd1d889dd74bd0cd7302c9d1eb56c01075b5fe193a232
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3516/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.