docs: Update examples to use stateless HTTP with JSON responses (#1499)
Some checks failed
Main branch checks / checks (push) Has been cancelled

This commit is contained in:
adam jones 2025-11-20 15:06:37 +00:00 • committed by GitHub
commit fcffa14b5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,15 +5,15 @@ Run from the repository root:
from mcp.server.fastmcp import FastMCP
# Stateful server (maintains session state)
mcp = FastMCP("StatefulServer")
# Stateless server with JSON responses (recommended)
mcp = FastMCP("StatelessServer", stateless_http=True, json_response=True)
# Other configuration options:
# Stateless server (no session persistence)
# Stateless server with SSE streaming responses
# mcp = FastMCP("StatelessServer", stateless_http=True)
# Stateless server (no session persistence, no sse stream with supported client)
# mcp = FastMCP("StatelessServer", stateless_http=True, json_response=True)
# Stateful server with session persistence
# mcp = FastMCP("StatefulServer")
# Add a simple tool to demonstrate the server