René's URL Explorer Experiment


Title: Tool results over 1 MiB cannot be received over SSE or streamable HTTP, and the limit is not configurable · Issue #3803 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Tool results over 1 MiB cannot be received over SSE or streamable HTTP, and the limit is not configurable · Issue #3803 · modelcontextprotocol/python-sdk

X Title: Tool results over 1 MiB cannot be received over SSE or streamable HTTP, and the limit is not configurable · Issue #3803 · modelcontextprotocol/python-sdk

Description: Summary A tool result larger than 1 MiB can never reach a client on an HTTP transport. The client opens every SSE stream with httpx2's default DEFAULT_MAX_EVENT_SIZE_BYTES = 1024 * 1024: in mcp/client/sse.py, through client.sse(url); in ...

Open Graph Description: Summary A tool result larger than 1 MiB can never reach a client on an HTTP transport. The client opens every SSE stream with httpx2's default DEFAULT_MAX_EVENT_SIZE_BYTES = 1024 * 1024: in mcp/cli...

X Description: Summary A tool result larger than 1 MiB can never reach a client on an HTTP transport. The client opens every SSE stream with httpx2's default DEFAULT_MAX_EVENT_SIZE_BYTES = 1024 * 1024: in mcp...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tool results over 1 MiB cannot be received over SSE or streamable HTTP, and the limit is not configurable","articleBody":"### Summary\n\nA tool result larger than 1 MiB can never reach a client on an HTTP transport. The client opens every SSE stream with `httpx2`'s default `DEFAULT_MAX_EVENT_SIZE_BYTES = 1024 * 1024`:\n- in `mcp/client/sse.py`, through `client.sse(url)`;\n- in `mcp/client/streamable_http.py`, through `EventSource(response)` in `_handle_sse_response`, the path a POST's response (and so a `tools/call` result) takes.\n\nNeither `sse_client` nor `streamable_http_client` takes a size parameter. A custom `http_client` cannot change it either, because the size is a per-call argument of `client.sse(...)` / `EventSource(...)`, not client configuration. The same result is delivered intact over stdio.\n\nThe failures also differ by transport:\n- **SSE:** the call fails with `MCPError(-32000, 'Connection closed')`, and the transport's task group then dies with `SSEError('Server-sent event exceeded the 1048576 byte limit.')`, so the whole session is lost.\n- **Streamable HTTP:** the call fails with `MCPError(-32000, 'SSE stream ended without a response')`, which does not mention the size limit; the session survives.\n\n### Reproducer (self-contained: an `MCPServer` on loopback and the SDK clients)\n\n```python\nimport asyncio\nimport socket\nimport threading\nimport time\n\nimport uvicorn\nfrom mcp import ClientSession\nfrom mcp.client.sse import sse_client\nfrom mcp.client.streamable_http import streamable_http_client\nfrom mcp.server.mcpserver import MCPServer\n\nserver = MCPServer(name=\"big-result\")\n\n@server.tool()\nasync def big(megabytes: int) -> str:\n    \"\"\"Return `megabytes` MiB of text.\"\"\"\n    return \"x\" * (megabytes * 1024 * 1024)\n\ndef serve(app) -> int:\n    with socket.socket() as sock:\n        sock.bind((\"127.0.0.1\", 0))\n        port = sock.getsockname()[1]\n    uv = uvicorn.Server(uvicorn.Config(app, host=\"127.0.0.1\", port=port, log_level=\"error\"))\n    threading.Thread(target=uv.run, daemon=True).start()\n    while not uv.started:\n        time.sleep(0.05)\n    return port\n\nasync def call(label: str, transport_cm) -> None:\n    try:\n        async with transport_cm as streams, ClientSession(streams[0], streams[1]) as session:\n            await session.initialize()\n            for mb in (0, 2):\n                try:\n                    result = await asyncio.wait_for(session.call_tool(\"big\", {\"megabytes\": mb}), 30)\n                    print(f\"  {label} {mb} MiB: ok, is_error={result.is_error}\")\n                except BaseException as exc:\n                    print(f\"  {label} {mb} MiB: {type(exc).__name__}: {exc!r:.160}\")\n    except BaseException as exc:\n        print(f\"  {label} session exit: {type(exc).__name__}: {exc!r:.200}\")\n\nasync def main() -> None:\n    sse_port = serve(server.sse_app())\n    http_port = serve(server.streamable_http_app())\n    await call(\"sse\", sse_client(f\"http://127.0.0.1:{sse_port}/sse\"))\n    await call(\"streamable-http\", streamable_http_client(f\"http://127.0.0.1:{http_port}/mcp\"))\n\nasyncio.run(main())\n```\n\nOutput:\n\n```\n  sse 0 MiB: ok, is_error=False\n  sse 2 MiB: MCPError: MCPError(-32000, 'Connection closed', None)\n  sse session exit: ExceptionGroup: ExceptionGroup('unhandled errors in a TaskGroup', [SSEError('Server-sent event exceeded the 1048576 byte limit.')])\n  streamable-http 0 MiB: ok, is_error=False\n  streamable-http 2 MiB: MCPError: MCPError(-32000, 'SSE stream ended without a response')\n```\n\n### Expected vs actual\n\n| | Expected | Actual |\n|---|---|---|\n| Large results | delivered up to a size the caller can configure (for example `max_event_size` on `sse_client` / `streamable_http_client`, passed through to `client.sse(...)` and `EventSource(...)`) | hard 1 MiB cap per SSE event, with no way to change it |\n| When the cap is hit | the call fails with an error that names the limit; the session survives | SSE: the session dies; streamable HTTP: a generic \"stream ended\" error with no mention of size |\n\nServers that return documents, graph results or large search results routinely exceed 1 MiB.\n\n### Environment\n\n- `mcp` 2.0.0, `httpx2` 2.13.0, `anyio` 4.14.2, `uvicorn` (from the SDK's dependency set)\n- CPython 3.14.10\n- Windows 11. Linux not tried; the limit comes from `httpx2`'s default and is platform-independent.\n\n### Workaround\n\nNone at the transport level. Downstream, the result-size limit is now an explicit host setting: oversized or failed calls are turned into a structured tool error naming the failure class, and each session is isolated so a transport failure cannot cancel the caller.\n","author":{"url":"https://github.com/gowthamrao","@type":"Person","name":"gowthamrao"},"datePublished":"2026-11-02T16:16:34Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3803"}

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:33a0ca50-fa54-e833-1020-01ea559469bf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idACFA:34CAB:1B7882E:230A7DA:6B015A37
html-safe-nonce274ba8dbe5958b730f40e539dc99ef47e5c5833260e606ee290985c9925cbba9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0ZBOjM0Q0FCOjFCNzg4MkU6MjMwQTdEQTo2QjAxNUEzNyIsInZpc2l0b3JfaWQiOiI2NjYyMjI0ODM4OTQzMzk4NDU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9c6eb4c809ab727d10b2773396f93bfeeedf656710e6a9c00bef06876502be38
hovercard-subject-tagissue:6166391841
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/3803/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9876bbdaa922ee84bebb801b539739b9e46b3c24240bbdcb37f75ea83fb7952a/modelcontextprotocol/python-sdk/issues/3803
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9876bbdaa922ee84bebb801b539739b9e46b3c24240bbdcb37f75ea83fb7952a/modelcontextprotocol/python-sdk/issues/3803
og:image:altSummary A tool result larger than 1 MiB can never reach a client on an HTTP transport. The client opens every SSE stream with httpx2's default DEFAULT_MAX_EVENT_SIZE_BYTES = 1024 * 1024: in mcp/cli...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegowthamrao
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3803#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3803
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%2Fissues%2F3803
Sign uphttps://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://github.com/modelcontextprotocol/python-sdk/issues/3803
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3803
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3803
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
https://github.com/modelcontextprotocol/python-sdk
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3803
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3803
Tool results over 1 MiB cannot be received over SSE or streamable HTTP, and the limit is not configurablehttps://github.com/modelcontextprotocol/python-sdk/issues/3803#top
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/gowthamrao
gowthamraohttps://github.com/gowthamrao
on Nov 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issue-6166391841
claudehttps://github.com/apps/claude
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
on Nov 3, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#event-35012802384
https://github.com/Shanmukh-l33t
Shanmukh-l33thttps://github.com/Shanmukh-l33t
on Nov 4, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6627043824
#3600https://github.com/modelcontextprotocol/python-sdk/pull/3600
af4c6f4https://github.com/modelcontextprotocol/python-sdk/commit/af4c6f4db2cd207f44374cd324a12cfbee8d2da6
#3338https://github.com/modelcontextprotocol/python-sdk/pull/3338
#3600https://github.com/modelcontextprotocol/python-sdk/pull/3600
#3600https://github.com/modelcontextprotocol/python-sdk/pull/3600
fix/sse-client-max-event-sizehttps://github.com/Shanmukh-l33t/python-sdk/tree/fix/sse-client-max-event-size
99e6d2d4https://github.com/Shanmukh-l33t/python-sdk/commit/99e6d2d4933697942796bdf83118fd9e09eaea2a
https://github.com/media-ctrl
media-ctrlhttps://github.com/media-ctrl
on Nov 4, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6630221735
https://github.com/lennardm
lennardmhttps://github.com/lennardm
on Nov 4, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6631183728
https://github.com/Shanmukh-l33t
Shanmukh-l33thttps://github.com/Shanmukh-l33t
on Nov 4, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6635758444
@lennardmhttps://github.com/lennardm
@media-ctrlhttps://github.com/media-ctrl
main...Shanmukh-l33t:python-sdk:fix/sse-client-max-event-sizehttps://github.com/modelcontextprotocol/python-sdk/compare/main...Shanmukh-l33t:python-sdk:fix/sse-client-max-event-size
https://github.com/SalyyS1
SalyyS1https://github.com/SalyyS1
on Nov 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6809401569
mcp-slimhttps://github.com/SalyyS1/mcp-slim
https://github.com/area51tazz
area51tazzhttps://github.com/area51tazz
on Nov 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6942441515
77001c9https://github.com/modelcontextprotocol/python-sdk/commit/77001c96f9507be0f4d009b83210a384a5e08bda
#3832https://github.com/modelcontextprotocol/python-sdk/pull/3832
77001c9https://github.com/modelcontextprotocol/python-sdk/commit/77001c96f9507be0f4d009b83210a384a5e08bda
#3832https://github.com/modelcontextprotocol/python-sdk/pull/3832
https://github.com/MrGaziz
MrGazizhttps://github.com/MrGaziz
on Nov 18, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6972421523
#3600https://github.com/modelcontextprotocol/python-sdk/pull/3600
#3832https://github.com/modelcontextprotocol/python-sdk/pull/3832
https://github.com/Shanmukh-l33t
Shanmukh-l33thttps://github.com/Shanmukh-l33t
on Nov 18, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3803#issuecomment-6989192547
@lennardmhttps://github.com/lennardm
@area51tazzhttps://github.com/area51tazz
@MrGazizhttps://github.com/MrGaziz
@area51tazzhttps://github.com/area51tazz
@lennardmhttps://github.com/lennardm
@MrGazizhttps://github.com/MrGaziz
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3803
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3803
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%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

Viewport: width=device-width


URLs of crawlers that visited me.