Skip to content

Don't conflate request and response IDs in Streamable HTTP transports #475

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Jun 3, 2025

Conversation

halter73
Copy link
Contributor

@halter73 halter73 commented May 31, 2025

This fixes a bug that's well described by #464 where the both the server and client Streamable HTTP transports improperly closed Streamable HTTP SSE response body streams early when it observed a server-to-client JsonRpcRequest, like a sampling request, with a message ID matching the ongoing client-to-server JsonRpcRequest.

This PR updates the server and client Streamable HTTP transports to only close the SSE response body stream when they observe a JsonRpcResponse or JsonRpcError with a matching ID.

Thanks @mkeeley-tricentis for the excellent issue that pointed directly to the problematic server-side code.

@halter73 halter73 merged commit 046903c into modelcontextprotocol:main Jun 3, 2025
12 of 14 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StreamableHttpPostTransport incorrectly disposes the SSE response stream when sending sampling/createMessage
2 participants