-
Notifications
You must be signed in to change notification settings - Fork 980
Streamable HTTP support #361
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
Conversation
Nice work @jlowin, I was thinking of implementing this today :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Streamable HTTP support to the FastMCP server while introducing new settings, transports, and session management routines as well as updating associated tests. Key changes include:
- Introducing and integrating the streamable-http transport in server and client modules.
- Adding new settings (streamable_http_path, json_response, stateless_http) and a session manager (StreamableHTTPSessionManager).
- Updating tests to reflect new module imports and transport support.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/server/test_lifespan.py | Updates import paths to use the new fastmcp module structure. |
tests/client/test_streamable_http.py | Adds tests for ping and header validation using streamable-http. |
src/fastmcp/settings.py | Adds new settings for streamable HTTP support. |
src/fastmcp/server/streamable_http_manager.py | Introduces session management for Streamable HTTP. |
src/fastmcp/server/server.py | Updates transport methods to include “streamable-http”. |
src/fastmcp/server/http.py | Implements creation of the streamable-http app and middleware changes. |
src/fastmcp/client/transports.py | Adjusts transport inference to support the “streamable-http” transport. |
Comments suppressed due to low confidence (1)
tests/server/test_lifespan.py:21
- The import change reflects the updated module structure. Please verify that all related test code references now align with the new import path to avoid any linkage issues.
from fastmcp import Context, FastMCP
Streamable HTTP support
This implementation is based on changes introduced to the low-level server in modelcontextprotocol/python-sdk#641, and requires the new objects introduced there. However we need to do more work to abstract out auth and routes to avoid polluting the
FastMCP
object further, as it is at risk of becoming as configuration-heavy as the low-level server. Since Streamable HTTP is so popular, it's ok to merge this and risk some breaking changes in auth (which can be made backwards compatible via deprecation) in order to get to a more sane configuration setup.Vendors the changes in # 641 until merged.