Ensure FastMCP handles nested SSE and SHTTP apps properly in ASGI frameworks #390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #365
Closes #370
Closes #382
Closes #234
Closes #225
Closes #189
Addresses the following low-level / FastMCP 1.0 issues: modelcontextprotocol/python-sdk#673, modelcontextprotocol/python-sdk#563, modelcontextprotocol/python-sdk#507, modelcontextprotocol/python-sdk#464, modelcontextprotocol/python-sdk#412
Since it is unclear if the low-level SDK will merge modelcontextprotocol/python-sdk#659, we are adding a patched low-level SSEServerTransport to FastMCP (and can remove it if/when the bug is fixed). This should resolve issues with nested ASGI applications.
However, note that you must pass the MCP lifespan to the outer-most app, due to the current design of the
StreamableHTTPSessionManager
. We are looking at whether we can replace that implementation with a more self-contained one.This also includes complete documentation for ASGI framework integration and tests for nested SSE and SHTTP starlette apps.