Skip to content

Commit 2b4552f

Browse files
committed
docs: Update index.md example to use stateless HTTP with JSON
1 parent b5327f4 commit 2b4552f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here's a simple MCP server that exposes a tool, resource, and prompt:
1717
```python title="server.py"
1818
from mcp.server.fastmcp import FastMCP
1919

20-
mcp = FastMCP("Test Server")
20+
mcp = FastMCP("Test Server", stateless_http=True, json_response=True)
2121

2222

2323
@mcp.tool()
@@ -36,6 +36,10 @@ def get_greeting(name: str) -> str:
3636
def greet_user(name: str, style: str = "friendly") -> str:
3737
"""Generate a greeting prompt"""
3838
return f"Write a {style} greeting for someone named {name}."
39+
40+
41+
if __name__ == "__main__":
42+
mcp.run(transport="streamable-http")
3943
```
4044

4145
Test it with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector):

0 commit comments

Comments
 (0)