python-sdk/src/mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
comfuture a9aca20205
Option to mount SSE server to existing ASGI server (#312)
* Option to mount SSE server to existing ASGI server

Fixes #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).

* Add `sse_app` method and update `run_sse_async` method in `server.py`

* Add `sse_app` method to return an instance of the SSE server app
* Update `run_sse_async` method to use the new `sse_app` method

Update `README.md` to include instructions for mounting SSE server

* Add section on mounting the SSE server to an existing ASGI server

* fix: Move import statements to the top of the file/

* docs: Update README to reflect changes in mounting SSE server with Starlette

* docs: Formatting of SSE server mounting example in README
2025-03-19 05:26:49 +01:00
..
cli Improve readability of CLI help option (#295) 2025-03-17 10:24:26 +00:00
client Strict types on the client side (#285) 2025-03-14 10:56:48 +00:00
server Option to mount SSE server to existing ASGI server (#312) 2025-03-19 05:26:49 +01:00
shared Strict types on the client side (#285) 2025-03-14 10:56:48 +00:00
__init__.py rename mcp_python to mcp 2024-11-11 12:40:32 +00:00
py.typed rename mcp_python to mcp 2024-11-11 12:40:32 +00:00
types.py Revert "refactor: reorganize message handling for better type safety and clar…" (#282) 2025-03-14 09:50:46 +00:00