Skip to content

Commit 8dbdfb2

Browse files
committed
Address feedback: remove stateless_http from examples, keep json_response
Remove stateless_http=True from examples to avoid going "all-in" on stateless before it's properly documented in the MCP spec. Keep json_response=True for client compatibility. Changes: - Remove stateless_http from quickstart and other examples - Keep json_response=True as recommended option
1 parent cbfb9d8 commit 8dbdfb2

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Run from the repository root:
139139
from mcp.server.fastmcp import FastMCP
140140

141141
# Create an MCP server
142-
mcp = FastMCP("Demo", stateless_http=True, json_response=True)
142+
mcp = FastMCP("Demo", json_response=True)
143143

144144

145145
# Add an addition tool
@@ -901,7 +901,6 @@ class SimpleTokenVerifier(TokenVerifier):
901901
# Create FastMCP instance as a Resource Server
902902
mcp = FastMCP(
903903
"Weather Service",
904-
stateless_http=True,
905904
json_response=True,
906905
# Token verifier for authentication
907906
token_verifier=SimpleTokenVerifier(),
@@ -1283,7 +1282,7 @@ from starlette.routing import Mount
12831282
from mcp.server.fastmcp import FastMCP
12841283

12851284
# Create MCP server
1286-
mcp = FastMCP("My App", stateless_http=True, json_response=True)
1285+
mcp = FastMCP("My App", json_response=True)
12871286

12881287

12891288
@mcp.tool()
@@ -1320,7 +1319,7 @@ from starlette.routing import Host
13201319
from mcp.server.fastmcp import FastMCP
13211320

13221321
# Create MCP server
1323-
mcp = FastMCP("MCP Host App", stateless_http=True, json_response=True)
1322+
mcp = FastMCP("MCP Host App", json_response=True)
13241323

13251324

13261325
@mcp.tool()
@@ -1357,8 +1356,8 @@ from starlette.routing import Mount
13571356
from mcp.server.fastmcp import FastMCP
13581357

13591358
# Create multiple MCP servers
1360-
api_mcp = FastMCP("API Server", stateless_http=True, json_response=True)
1361-
chat_mcp = FastMCP("Chat Server", stateless_http=True, json_response=True)
1359+
api_mcp = FastMCP("API Server", json_response=True)
1360+
chat_mcp = FastMCP("Chat Server", json_response=True)
13621361

13631362

13641363
@api_mcp.tool()
@@ -1410,7 +1409,6 @@ from mcp.server.fastmcp import FastMCP
14101409
# This server will mount at the root of wherever it's mounted
14111410
mcp_at_root = FastMCP(
14121411
"My Server",
1413-
stateless_http=True,
14141412
json_response=True,
14151413
streamable_http_path="/",
14161414
)

docs/index.md

Lines changed: 1 addition & 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", stateless_http=True, json_response=True)
20+
mcp = FastMCP("Test Server", json_response=True)
2121

2222

2323
@mcp.tool()

examples/snippets/servers/fastmcp_quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from mcp.server.fastmcp import FastMCP
99

1010
# Create an MCP server
11-
mcp = FastMCP("Demo", stateless_http=True, json_response=True)
11+
mcp = FastMCP("Demo", json_response=True)
1212

1313

1414
# Add an addition tool

examples/snippets/servers/oauth_server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ async def verify_token(self, token: str) -> AccessToken | None:
2020
# Create FastMCP instance as a Resource Server
2121
mcp = FastMCP(
2222
"Weather Service",
23-
stateless_http=True,
2423
json_response=True,
2524
# Token verifier for authentication
2625
token_verifier=SimpleTokenVerifier(),

examples/snippets/servers/streamable_http_basic_mounting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mcp.server.fastmcp import FastMCP
1212

1313
# Create MCP server
14-
mcp = FastMCP("My App", stateless_http=True, json_response=True)
14+
mcp = FastMCP("My App", json_response=True)
1515

1616

1717
@mcp.tool()

examples/snippets/servers/streamable_http_host_mounting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mcp.server.fastmcp import FastMCP
1212

1313
# Create MCP server
14-
mcp = FastMCP("MCP Host App", stateless_http=True, json_response=True)
14+
mcp = FastMCP("MCP Host App", json_response=True)
1515

1616

1717
@mcp.tool()

examples/snippets/servers/streamable_http_multiple_servers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from mcp.server.fastmcp import FastMCP
1212

1313
# Create multiple MCP servers
14-
api_mcp = FastMCP("API Server", stateless_http=True, json_response=True)
15-
chat_mcp = FastMCP("Chat Server", stateless_http=True, json_response=True)
14+
api_mcp = FastMCP("API Server", json_response=True)
15+
chat_mcp = FastMCP("Chat Server", json_response=True)
1616

1717

1818
@api_mcp.tool()

examples/snippets/servers/streamable_http_path_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# This server will mount at the root of wherever it's mounted
1515
mcp_at_root = FastMCP(
1616
"My Server",
17-
stateless_http=True,
1817
json_response=True,
1918
streamable_http_path="/",
2019
)

0 commit comments

Comments
 (0)