Skip to content

fix(streamable-http): fail request when resumable SSE stream can't complete - #2732

Closed
Epochex wants to merge 14 commits into
modelcontextprotocol:mainfrom
Epochex:fix/1577-streamable-http-disconnect-error
Closed

Epochex wants to merge 14 commits into
modelcontextprotocol:mainfrom
Epochex:fix/1577-streamable-http-disconnect-error

Conversation

@Epochex

@Epochex Epochex commented May 30, 2026

Copy link
Copy Markdown

Fixes #1577.

When a POST responds with ext/event-stream and the stream disconnects before a terminal JSON-RPC response/error arrives, the client transport tries to resume via GET + Last-Event-ID. If the server is gone (session 404s) or resumption otherwise can't succeed, the current code returns silently after exhausting retries.

Because ClientSession defaults to
ead_timeout_seconds=None, the original send_request() waits forever on the missing response.

Changes:

  • If an SSE response stream ends without completion and we have no resumable event id, send a CONNECTION_CLOSED JSON-RPC error for the original request id.
  • If resumption retries are exhausted, send the same request-scoped error (includes the last event id in data).

Tests:

  • Adds an interaction regression test that closes a call's SSE stream and deletes the server-side session on the first reconnect GET, asserting the call fails (no hang).

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/mcp/client/streamable_http.py
Comment thread tests/client/test_streamable_http.py Outdated
@maxisbey

maxisbey commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR, and sorry it sat here without a proper review.

We're closing most of the open PR backlog. v2 is out and changed a lot of the SDK, so many older PRs no longer apply as written, and we're a small team that realistically doesn't have the capacity to work through the rest.

If this still matters to you on v2, the most useful thing you can do is open an issue (or comment on the existing one) with your use case and a repro. Hearing why it matters to you is what we use to decide what to prioritise.

AI Disclaimer

@maxisbey maxisbey closed this Oct 5, 2026
@maxisbey maxisbey added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client tool call hangs forever if server crashes or connection dies when using streamable-http

2 participants