Skip to content

Commit 472dc0f

Browse files
committed
fixes
1 parent a869767 commit 472dc0f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,13 @@ from mcp.server.fastmcp import FastMCP
412412

413413
mcp = FastMCP(name="EchoServer", stateless_http=True)
414414

415+
415416
@mcp.tool(description="A simple echo tool")
416417
def echo(message: str) -> str:
417418
return f"Echo: {message}"
419+
```
418420

421+
```python
419422
# main.py
420423
from fastapi import FastAPI
421424
from routers import echo
@@ -425,7 +428,6 @@ app = FastAPI()
425428
# Use the session manager's lifespan
426429
app = FastAPI(lifespan=lambda app: echo.mcp.session_manager.run())
427430
app.mount("/echo", echo.mcp.streamable_http_app())
428-
429431
```
430432

431433
For low level server with Streamable HTTP implementations, see:
@@ -744,9 +746,13 @@ if __name__ == "__main__":
744746
Clients can also connect using streamable HTTP transport:
745747

746748
```python
749+
from mcp.client.streamable_http import streamablehttp_client
750+
from mcp import ClientSession
751+
747752

748-
# Connect to a streamable HTTP server
749-
async with streamablehttp_client(http_server_url + "/mcp") as (
753+
async def main():
754+
# Connect to a streamable HTTP server
755+
async with streamablehttp_client("example/mcp") as (
750756
read_stream,
751757
write_stream,
752758
_,

0 commit comments

Comments
 (0)