Skip to content

Conversation

@AdrianMiska
Copy link
Contributor

Re-throw exceptions in StreamableHttpClientTransport so Protocol doesn't hang indefinitely.

Motivation and Context

Fixes the issue described in #226

How Has This Been Tested?

I've verified that my test case reproduces the error without my fix, and verified with breakpoints that the hang occurred where I described it.

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

Additional context

I am unsure about the dispatcher I used for the real-time timeout here. I could not get the test to work otherwise, as kotlinx.coroutines.test was always tripping my timeout, with or without the fix. This is seemingly unrelated to the test case though, as removing my timeout results in the timeout in Protocol being tripped, even though that's not the point of the indefinite hang.

@devcrocod devcrocod force-pushed the fix-streamablehttp-hang branch from e8e7c52 to c0a435f Compare September 12, 2025 15:54
@AdrianMiska
Copy link
Contributor Author

AdrianMiska commented Sep 12, 2025

I just realized that at some point I removed the dispatcher I was talking about.

@kpavlov kpavlov force-pushed the fix-streamablehttp-hang branch from 2ba8aea to f317041 Compare September 13, 2025 22:16
@AdrianMiska
Copy link
Contributor Author

I've just checked again that all tests on all platforms pass on my machine (except for browser, I couldn't get those to work).
So this failure is either in the browser tests (seems unlikely to me if all other platforms pass) or something that only happens on the GitHub runner.

@kpavlov kpavlov force-pushed the fix-streamablehttp-hang branch from f317041 to 21a8076 Compare September 15, 2025 10:53
@devcrocod devcrocod force-pushed the fix-streamablehttp-hang branch from 21a8076 to c423d1b Compare September 15, 2025 12:07
Copy link
Contributor

@devcrocod devcrocod left a comment

Choose a reason for hiding this comment

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

lgtm
thanks for your contribution

@devcrocod devcrocod merged commit ee9f477 into modelcontextprotocol:main Sep 15, 2025
3 checks passed
svc-squareup-copybara pushed a commit to cashapp/misk that referenced this pull request Sep 16, 2025
| Package | Type | Package file | Manager | Update | Change |
|---|---|---|---|---|---|
|
[io.modelcontextprotocol:kotlin-sdk-server](https://github.com/modelcontextprotocol/kotlin-sdk)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`0.7.0` -> `0.7.1` |
|
[io.modelcontextprotocol:kotlin-sdk-core](https://github.com/modelcontextprotocol/kotlin-sdk)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`0.7.0` -> `0.7.1` |
|
[com.autonomousapps.dependency-analysis](https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin)
| plugin | misk/gradle/libs.versions.toml | gradle | patch | `3.0.2` ->
`3.0.3` |
| [software.amazon.awssdk:sdk-core](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:sqs](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:s3](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:regions](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
|
[software.amazon.awssdk:dynamodb-enhanced](https://aws.amazon.com/sdkforjava)
| dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:dynamodb](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:aws-core](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:bom](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |
| [software.amazon.awssdk:auth](https://aws.amazon.com/sdkforjava) |
dependencies | misk/gradle/libs.versions.toml | gradle | patch |
`2.33.9` -> `2.33.10` |

---

### Release Notes

<details>
<summary>modelcontextprotocol/kotlin-sdk
(io.modelcontextprotocol:kotlin-sdk-server)</summary>

###
[`v0.7.1`](https://github.com/modelcontextprotocol/kotlin-sdk/releases/tag/0.7.1)

[Compare
Source](modelcontextprotocol/kotlin-sdk@0.7.0...0.7.1)

##### What's Changed

- Bump io.github.oshai:kotlin-logging from 7.0.7 to 7.0.11 by
[@&#8203;dependabot](https://github.com/dependabot)\[bot] in
[#&#8203;211](modelcontextprotocol/kotlin-sdk#211)
- Bump org.jlleitschuh.gradle.ktlint from 13.0.0 to 13.1.0 by
[@&#8203;dependabot](https://github.com/dependabot)\[bot] in
[#&#8203;241](modelcontextprotocol/kotlin-sdk#241)
- Bump com.anthropic:anthropic-java from 0.8.0 to 2.6.0 by
[@&#8203;dependabot](https://github.com/dependabot)\[bot] in
[#&#8203;246](modelcontextprotocol/kotlin-sdk#246)
- Fix upload reports in GitHub actions by
[@&#8203;skarpovdev](https://github.com/skarpovdev) in
[#&#8203;264](modelcontextprotocol/kotlin-sdk#264)
- Bump ktor from 3.2.3 to 3.3.0 by
[@&#8203;dependabot](https://github.com/dependabot)\[bot] in
[#&#8203;265](modelcontextprotocol/kotlin-sdk#265)
- fix hang caused by StreamableHttpClientTransport
([#&#8203;226](modelcontextprotocol/kotlin-sdk#226))
by [@&#8203;AdrianMiska](https://github.com/AdrianMiska) in
[#&#8203;227](modelcontextprotocol/kotlin-sdk#227)
- Bump kotlin from 2.2.0 to 2.2.10 by
[@&#8203;dependabot](https://github.com/dependabot)\[bot] in
[#&#8203;230](modelcontextprotocol/kotlin-sdk#230)
- Add module documentation and enhance Dokka configuration by
[@&#8203;kpavlov](https://github.com/kpavlov) in
[#&#8203;261](modelcontextprotocol/kotlin-sdk#261)
- Mark `testMultipleClientParallel` as ignored due to flakiness by
[@&#8203;devcrocod](https://github.com/devcrocod) in
[#&#8203;267](modelcontextprotocol/kotlin-sdk#267)

##### New Contributors

- [@&#8203;AdrianMiska](https://github.com/AdrianMiska) made their first
contribution in
[#&#8203;227](modelcontextprotocol/kotlin-sdk#227)

**Full Changelog**:
<modelcontextprotocol/kotlin-sdk@0.7.0...0.7.1>

</details>

<details>
<summary>autonomousapps/dependency-analysis-android-gradle-plugin
(com.autonomousapps.dependency-analysis)</summary>

###
[`v3.0.3`](https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/blob/HEAD/CHANGELOG.md#Version-303)

- \[Fix]: compare versions via `VersionNumber`, not raw strings.
- \[Fix] Forcibly downgrade kotlin-stdlib to 2.0.21 for Gradle 8.11
support.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 6pm every weekday,before 2am
every weekday" in timezone Australia/Melbourne, Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

GitOrigin-RevId: 5f728b0acc73a9742f56946b97f85ad1e3355442
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.

2 participants