You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SSE server in fastmcp currently operates as a Starlette app. In addition to running it as a standalone server, it would be beneficial to provide an option to mount it to an existing ASGI server.
Suggested solution
Currently, the run(transport="sse") method and the run_sse_async() method include the code for actually serving the application. It would be better to separate this functionality and allow users to obtain an instance of the SSE server app via a method like mcp.sse_app() or mcp.starlette_app().
The text was updated successfully, but these errors were encountered:
comfuture
added a commit
to comfuture/python-sdk
that referenced
this issue
Mar 18, 2025
Fixesmodelcontextprotocol#311
Add option to mount SSE server to an existing ASGI server.
* Add a new method `sse_app` in `src/mcp/server/fastmcp/server.py` to return an instance of the SSE server app.
* Update the `run_sse_async` method in `src/mcp/server/fastmcp/server.py` to use the new `sse_app` method.
* Update the documentation in `README.md` to include instructions on how to mount the SSE server to an existing ASGI server.
* Fix the example in `README.md` to use `app.mount('/', mcp.sse_app())` instead.
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/modelcontextprotocol/python-sdk/issues/311?shareId=XXXX-XXXX-XXXX-XXXX).
The SSE server in fastmcp currently operates as a Starlette app. In addition to running it as a standalone server, it would be beneficial to provide an option to mount it to an existing ASGI server.
Suggested solution
Currently, the
run(transport="sse")
method and therun_sse_async()
method include the code for actually serving the application. It would be better to separate this functionality and allow users to obtain an instance of the SSE server app via a method likemcp.sse_app()
ormcp.starlette_app()
.The text was updated successfully, but these errors were encountered: