Skip to content

Add support for MCP's Streamable HTTP transport #1716

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

BrandonShar
Copy link

This adds support for the new Streamable HTTP transport that was just added to MCP in v1.8. I based the implementation off of how FastMCP handled it here.

I set it up to be a non-breaking change (with deprecations) and updated the tests accordingly, but there wasn't an SSE integration test that I noticed. I did test this in my project locally and it worked well. Happy to collaborate on some additional testing!

Resolves #1632

@ankit-kapur
Copy link

🙌🏽 Waiting for this to get merged soon

@DouweM
Copy link
Contributor

DouweM commented May 19, 2025

@BrandonShar Thanks Brandon, this looks great! My only concern is that GitHub shows that uv.lock has "2,039 additions, 2,038 deletions". Can you please revert that and run make install again? I'd expect to just see changes related to the mcp package.

@BrandonShar
Copy link
Author

BrandonShar commented May 20, 2025

Hey @DouweM thanks for the review! Turns out I needed to upgrade my version of uv (I was on 0.6.*). Looks like that made it want to rebuild the entire lock file. Should be good now!

@DouweM DouweM changed the title Add Support for MCP's Streamable HTTP server Add support for MCP's Streamable HTTP transport May 21, 2025
@DouweM
Copy link
Contributor

DouweM commented May 21, 2025

@BrandonShar Thanks, the code looks good. Can you please update https://ai.pydantic.dev/mcp/client/#sse-client as well? It currently says "The name "HTTP" is used since this implemented will be adapted in future to use the new Streamable HTTP currently in development.", which should be dropped, and it should be made explicit that we support both the older SSE and newer MCP endpoints.

@GustavoRonconi
Copy link

very much looking forward to it! @BrandonShar , you need some help?

@DouweM
Copy link
Contributor

DouweM commented May 22, 2025

@BrandonShar Note that we have some conflicts from some other changes we just merged

@BrandonShar BrandonShar force-pushed the add-streamable-http branch from fc539da to a8ed6e1 Compare May 22, 2025 21:55
Copy link
Contributor

hyperlint-ai bot commented May 22, 2025

PR Change Summary

Added support for the Streamable HTTP transport in MCP, ensuring compatibility with existing functionality while introducing new capabilities.

  • Implemented Streamable HTTP transport support in MCPServerHTTP
  • Updated documentation to reflect changes in transport type
  • Ensured non-breaking changes with deprecations and updated tests accordingly

Modified Files

  • docs/mcp/client.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@BrandonShar
Copy link
Author

@DouweM I tweaked the docs a bit and resolved the conflicts. Just an FYI, a few were just formatting, but the linter seems happy with what I already had.

@@ -25,17 +25,16 @@ Examples of both are shown below; [mcp-run-python](run-python.md) is used as the

### SSE Client
Copy link
Contributor

Choose a reason for hiding this comment

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

HTTP Client

@BrandonShar
Copy link
Author

@DouweM changes made. Good call on the docs improvements, I appreciate your attention to detail there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Streamable HTTP Implementaion
4 participants