René's URL Explorer Experiment


Title: 401 in Streamable HTTP should be handled gracefully · Issue #1295 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: 401 in Streamable HTTP should be handled gracefully · Issue #1295 · modelcontextprotocol/python-sdk

X Title: 401 in Streamable HTTP should be handled gracefully · Issue #1295 · modelcontextprotocol/python-sdk

Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description Currently, streamable_...

Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...

X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1295

X: @github

direct link

Domain: redirect.github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"401 in Streamable HTTP should be handled gracefully","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\nCurrently, `streamable_http` will call `response.raise_for_status()` when handling POST requests. [(ref)](https://github.com/modelcontextprotocol/python-sdk/blob/9a8592e7d4d69b785df8b5d9d7b694cb6cbb149f/src/mcp/client/streamable_http.py#L278).\n\nThis means that a 401 will bubble up and cause the entire program to crash. \n\nWhile a 401 on server initialize could warrant an exception, we have a use case where a MCP server will return 401 for specific unauthorized operations, and allow others.\n\nThis should be handled gracefully, similar to how [`_handle_unexpected_content_type`](https://github.com/modelcontextprotocol/python-sdk/blob/9a8592e7d4d69b785df8b5d9d7b694cb6cbb149f/src/mcp/client/streamable_http.py#L340C15-L340C46) works, returning a JSONRPC message outlining an unauthorized exception was thrown.\n\nThis would let an agent or other client handle it instead of crashing the program.\n\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.12 and MCP SDK v1.13.1\n```","author":{"url":"https://github.com/somaraani","@type":"Person","name":"somaraani"},"datePublished":"2025-08-22T21:31:45Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/1295"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a271e3bc-f1fe-57a1-4ce8-6658a9874435
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB5D4:2B0D42:003C:007D:6B056A28
html-safe-nonce7da082d84f2f57f345b159e322233cb5bbf9f9ec6abf8149cc9e107b78caedfd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUQ0OjJCMEQ0MjowMDNDOjAwN0Q6NkIwNTZBMjgiLCJ2aXNpdG9yX2lkIjoiMjg4NDEzNDUwOTI4MjIwNzEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf5c743e4ffdeb323fa91daecf267a95af5ea1b61afb9cdeaf6ded575d0ee826e
hovercard-subject-tagissue:3346829678
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/1295/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ad622a438535c3692765ae6fc7fac43188ddb8d7824d909d1c5b350d5baebc1d/modelcontextprotocol/python-sdk/issues/1295
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ad622a438535c3692765ae6fc7fac43188ddb8d7824d909d1c5b350d5baebc1d/modelcontextprotocol/python-sdk/issues/1295
og:image:altInitial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesomaraani
hostnamegithub.com
expected-hostnamegithub.com
None1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef6d69234e682c947a48074340e69d45d5901de31
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://redirect.github.com/modelcontextprotocol/python-sdk/issues/1295#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F1295
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://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F1295
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues/1295
Reloadhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues/1295
Reloadhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues/1295
modelcontextprotocolhttps://redirect.github.com/modelcontextprotocol
python-sdkhttps://redirect.github.com/modelcontextprotocol/python-sdk
Codehttps://redirect.github.com/modelcontextprotocol/python-sdk
Issues320 (320)https://redirect.github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://redirect.github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://redirect.github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://redirect.github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://redirect.github.com/modelcontextprotocol/python-sdk/security
Insightshttps://redirect.github.com/modelcontextprotocol/python-sdk/insights
https://redirect.github.com/modelcontextprotocol/python-sdk
New issuehttps://redirect.github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/1295
New issuehttps://redirect.github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/1295
401 in Streamable HTTP should be handled gracefullyhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues/1295#top
P2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P2%22
bughttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
https://github.com/somaraani
somaraanihttps://github.com/somaraani
on Aug 22, 2025https://github.com/modelcontextprotocol/python-sdk/issues/1295#issue-3346829678
https://github.com/modelcontextprotocol/python-sdk/issueshttps://github.com/modelcontextprotocol/python-sdk/issues
(ref)https://github.com/modelcontextprotocol/python-sdk/blob/9a8592e7d4d69b785df8b5d9d7b694cb6cbb149f/src/mcp/client/streamable_http.py#L278
_handle_unexpected_content_typehttps://github.com/modelcontextprotocol/python-sdk/blob/9a8592e7d4d69b785df8b5d9d7b694cb6cbb149f/src/mcp/client/streamable_http.py#L340C15-L340C46
somaraanihttps://redirect.github.com/somaraani
needs confirmationhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22needs%20confirmation%22
on Aug 22, 2025https://github.com/modelcontextprotocol/python-sdk/issues/1295#event-19295287634
felixweinbergerhttps://redirect.github.com/felixweinberger
bughttps://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
P2https://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P2%22
needs confirmationhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22needs%20confirmation%22
on Oct 7, 2025https://github.com/modelcontextprotocol/python-sdk/issues/1295#event-20141681111
Varun6578https://redirect.github.com/Varun6578
on Mar 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/1295#event-23190245339
fix: handle HTTP 4xx/5xx gracefully in StreamableHTTP transporthttps://github.com/Varun6578/python-sdk/commit/4a7bcc588d15c347a123c89b9dcd5e055f3395ce
https://docs.github.com/articles/closing-issues-via-commit-messages
4a7bcc5https://github.com/Varun6578/python-sdk/commit/4a7bcc588d15c347a123c89b9dcd5e055f3395ce
https://redirect.github.com/sgoel2be24-cyber
sgoel2be24-cyberhttps://redirect.github.com/sgoel2be24-cyber
on Aug 10, 2026https://github.com/modelcontextprotocol/python-sdk/issues/1295#issuecomment-5240592452
#3276https://github.com/modelcontextprotocol/python-sdk/pull/3276
https://redirect.github.com/sgoel2be24-cyber
sgoel2be24-cyberhttps://redirect.github.com/sgoel2be24-cyber
on Sep 4, 2026https://github.com/modelcontextprotocol/python-sdk/issues/1295#issuecomment-5536640325
#1295https://github.com/modelcontextprotocol/python-sdk/issues/1295
#3276https://github.com/modelcontextprotocol/python-sdk/pull/3276
https://redirect.github.com/Kludex
Kludexhttps://redirect.github.com/Kludex
on Oct 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/1295#issuecomment-6163579659
#2110https://github.com/modelcontextprotocol/python-sdk/issues/2110
Kludexhttps://redirect.github.com/Kludex
completedhttps://redirect.github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/1295#event-33205330263
Sign up for freehttps://redirect.github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/1295
Sign in to commenthttps://redirect.github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/1295
P2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P2%22
bughttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.