Skip to content

Commit 563f8c9

Browse files
committed
suggested changes
1 parent f3ace1e commit 563f8c9

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,31 @@ def echo(message: str) -> str:
418418
return f"Echo: {message}"
419419
```
420420

421+
```python
422+
# math.py
423+
from mcp.server.fastmcp import FastMCP
424+
425+
mcp = FastMCP(name="MathServer", stateless_http=True)
426+
427+
428+
@mcp.tool(description="A simple add tool")
429+
def add_two(n: int) -> str:
430+
return n + 2
431+
```
432+
421433
```python
422434
# main.py
423435
from fastapi import FastAPI
424-
from routers import echo
436+
from mcp.echo import echo
437+
from mcp.math import math
438+
425439

426440
app = FastAPI()
427441

428442
# Use the session manager's lifespan
429443
app = FastAPI(lifespan=lambda app: echo.mcp.session_manager.run())
430444
app.mount("/echo", echo.mcp.streamable_http_app())
445+
app.mount("/math", math.mcp.streamable_http_app())
431446
```
432447

433448
For low level server with Streamable HTTP implementations, see:
@@ -445,7 +460,7 @@ The streamable HTTP transport supports:
445460

446461
### Mounting to an Existing ASGI Server
447462

448-
> **Note**: SSE transport is being superseded by streamable HTTP transport. Consider using streamable HTTP for production deployments.
463+
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
449464
450465
You can mount the SSE server to an existing ASGI server using the `sse_app` method. This allows you to integrate the SSE server with other ASGI applications.
451466

@@ -679,7 +694,7 @@ if __name__ == "__main__":
679694

680695
### Writing MCP Clients
681696

682-
The SDK provides a high-level client interface for connecting to MCP servers using various transports:
697+
The SDK provides a high-level client interface for connecting to MCP servers using various [transports](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports):
683698

684699
```python
685700
from mcp import ClientSession, StdioServerParameters, types
@@ -743,7 +758,7 @@ if __name__ == "__main__":
743758
asyncio.run(run())
744759
```
745760

746-
Clients can also connect using streamable HTTP transport:
761+
Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
747762

748763
```python
749764
from mcp.client.streamable_http import streamablehttp_client

0 commit comments

Comments
 (0)