Title: [v2] Expose the SSE max_event_size setting in Streamable HTTP clients · Issue #3332 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: [v2] Expose the SSE max_event_size setting in Streamable HTTP clients · Issue #3332 · modelcontextprotocol/python-sdk
X Title: [v2] Expose the SSE max_event_size setting in Streamable HTTP clients · Issue #3332 · modelcontextprotocol/python-sdk
Description: What happened? MCP Python SDK v2.0.0 constructs httpx2.EventSource(response) directly when parsing a Streamable HTTP POST response. Since HTTPX2 2.10, a single SSE event is limited to 1 MiB by default. When a valid tools/call result is l...
Open Graph Description: What happened? MCP Python SDK v2.0.0 constructs httpx2.EventSource(response) directly when parsing a Streamable HTTP POST response. Since HTTPX2 2.10, a single SSE event is limited to 1 MiB by defa...
X Description: What happened? MCP Python SDK v2.0.0 constructs httpx2.EventSource(response) directly when parsing a Streamable HTTP POST response. Since HTTPX2 2.10, a single SSE event is limited to 1 MiB by defa...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3332
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[v2] Expose the SSE max_event_size setting in Streamable HTTP clients","articleBody":"## What happened?\n\nMCP Python SDK v2.0.0 constructs `httpx2.EventSource(response)` directly when parsing a Streamable HTTP POST response. Since HTTPX2 2.10, a single SSE event is limited to 1 MiB by default.\n\nWhen a valid `tools/call` result is larger than 1 MiB and is returned as one SSE event, HTTPX2 raises `SSEError`. The SDK catches that transport error and the caller receives the generic MCP error:\n\n```text\nSSE stream ended without a response\n```\n\nThere is currently no public Streamable HTTP setting that lets callers raise the SSE event-size limit. The transport also creates SSE readers in multiple places: the POST response path constructs `EventSource(response)` directly, while the GET and reconnection paths call `AsyncClient.sse()` without a transport-level event-size setting.\n\n## What did you expect?\n\nI expected the Streamable HTTP client/transport to expose an SSE event-size setting and apply it consistently to:\n\n- POST SSE responses;\n- the GET stream; and\n- reconnection streams.\n\nOne possible API shape would be a `max_event_size` argument on `streamable_http_client()` and `StreamableHTTPTransport`, matching HTTPX2 terminology. The exact public API is open for maintainer direction.\n\nIf an event exceeds the configured limit, the original JSON-RPC request should receive a clear request-scoped error. The already-sent POST should not be replayed, and sibling requests sharing the session should remain usable.\n\n## Reproduction\n\nUse an MCP Streamable HTTP server whose tool returns more than 1 MiB of text in a single SSE event, then call that tool with the v2 client:\n\n```python\nresult = await client.call_tool(\"large_result\", {})\n```\n\nWith a 2 MiB single-event response, the call fails with `SSE stream ended without a response`. The same response succeeds when the underlying `EventSource` is constructed with a larger `max_event_size`.\n\nI can contribute an implementation and exact boundary tests if maintainers agree with exposing this setting.\n\n## Environment\n\n- Python 3.11\n- MCP Python SDK 2.0.0\n- HTTPX2 2.10.0\n- Area: Client transports / Streamable HTTP\n\n## Reference\n\n- HTTPX2 support and the 1 MiB default: https://github.com/pydantic/httpx2/pull/1071\n\nThis issue was prepared with AI assistance and reviewed by the reporter.\n","author":{"url":"https://github.com/Zhangs-11","@type":"Person","name":"Zhangs-11"},"datePublished":"2026-08-18T14:47:43Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3332"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b08443c9-3d64-e042-0270-b56352daa15e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B970:23CF06:20D3F90:29D54DE:6B0160D9 |
| html-safe-nonce | 09b942e308043e147b591e8a7cf3259d0a6ca84ca90cc38df0be1de36dd81883 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTcwOjIzQ0YwNjoyMEQzRjkwOjI5RDU0REU6NkIwMTYwRDkiLCJ2aXNpdG9yX2lkIjoiNjA3MzYzOTI3MzcwNDI4NDM3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae8325ece44ee5193a637feb6b660fb87500caa3f046ccbd4a7eef20d7f82736 |
| hovercard-subject-tag | issue:5183111570 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3332/issue_layout |
| twitter:image | https://opengraph.githubassets.com/33b4386eae4fb86916afb8de5b21ab8eeb49c1b5647dfe18ab1d7be330834de0/modelcontextprotocol/python-sdk/issues/3332 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/33b4386eae4fb86916afb8de5b21ab8eeb49c1b5647dfe18ab1d7be330834de0/modelcontextprotocol/python-sdk/issues/3332 |
| og:image:alt | What happened? MCP Python SDK v2.0.0 constructs httpx2.EventSource(response) directly when parsing a Streamable HTTP POST response. Since HTTPX2 2.10, a single SSE event is limited to 1 MiB by defa... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Zhangs-11 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width