Skip to content

fix(client): resume Streamable HTTP SSE streams independently - #1171

Merged
devcrocod merged 2 commits into
mainfrom
devcrocod/streamable-http-independent-sse-streams
Nov 12, 2026
Merged

devcrocod merged 2 commits into
mainfrom
devcrocod/streamable-http-independent-sse-streams

Conversation

@devcrocod

Copy link
Copy Markdown
Contributor

Run the standalone GET stream and each resumed request stream in separate jobs, so resuming one no longer cancels the others. A resumption stops when its request is cancelled. Protocol no longer sends notifications/cancelled with the request's resumption token, which made the transport resume a stream instead of sending the cancel.

fixes #1170

How Has This Been Tested?

Integration tests against a scripted server: the GET stream survives a resumption, concurrent resumptions both complete, and a cancelled request stops resuming, both inline and with resumptionToken. A Protocol test checks the cancel options. Also checked against a TypeScript SDK 1.30.1 server with MCP-Protocol-Version set.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the stream-isolation and cancellation changes.

No open issues 🎉

What changed in this PR

Fixes #1170 by isolating Streamable HTTP SSE streams in the Kotlin SDK client, so resuming one request no longer cancels other streams.

Changes:

  • Runs standalone and resumed request streams in separate jobs, stopping resumptions when their requests are cancelled.
  • Sends cancellation notifications without the original request’s resumption token.
  • Adds regression tests for concurrent streams, cancellation, and cancellation send options.
File Description
kotlin-sdk-core/​src/​commonTest/​kotlin/​io/​modelcontextprotocol/​kotlin/​sdk/​shared/​ProtocolOutboundCancellationTest.kt Verifies cancellation preserves relatedRequestId but omits the resumption token.
kotlin-sdk-core/​src/​commonMain/​kotlin/​io/​modelcontextprotocol/​kotlin/​sdk/​shared/​Protocol.kt Removes resumption options from cancellation sends.
kotlin-sdk-client/​src/​commonMain/​kotlin/​io/​modelcontextprotocol/​kotlin/​sdk/​client/​StreamableHttpClientTransport.kt Separates stream jobs and cancels resumptions by request ID.
integration-test/​src/​jvmTest/​kotlin/​io/​modelcontextprotocol/​kotlin/​sdk/​integration/​streamablehttp/​StreamableHttpClientTransportIntegrationTest.kt Tests stream independence and cancellation using scripted server routes.

Review effort: Balanced

@devcrocod
devcrocod requested a review from e5l November 10, 2026 16:22

@e5l e5l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good

Copilot AI balanced review requested due to automatic review settings November 12, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the changes isolating SSE resumptions and handling request cancellation.

No open issues 🎉

Review effort: Balanced

@devcrocod
devcrocod merged commit 6150050 into main Nov 12, 2026
27 of 28 checks passed
@devcrocod
devcrocod deleted the devcrocod/streamable-http-independent-sse-streams branch November 12, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resuming a request stream cancels the other SSE streams in StreamableHttpClientTransport

3 participants