Skip to content

Commit 06f1c73

Browse files
committed
docs: clarify CORS comment and drop stale README bullets
streamable_http_app() enforces localhost-only Origin by default, so the 'Allow all origins' CORS comment was misleading — preflight would succeed but the actual POST would return 403 for non-localhost origins. Also removed README bullets that described the manual lifespan/task-group wiring that no longer exists in these examples.
1 parent 8bcf9e9 commit 06f1c73

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

examples/servers/simple-streamablehttp-stateless/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ A stateless MCP server example demonstrating the StreamableHttp transport withou
77
- Uses the StreamableHTTP transport in stateless mode (mcp_session_id=None)
88
- Each request creates a new ephemeral connection
99
- No session state maintained between requests
10-
- Task lifecycle scoped to individual requests
1110
- Suitable for deployment in multi-node environments
1211

1312
## Usage

examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def main(
108108
# for browser-based clients (ensures 500 errors get proper CORS headers)
109109
starlette_app = CORSMiddleware(
110110
starlette_app,
111-
allow_origins=["*"], # Allow all origins - adjust as needed for production
111+
allow_origins=["*"], # Note: streamable_http_app() enforces localhost-only Origin by default
112112
allow_methods=["GET", "POST", "DELETE"], # MCP streamable HTTP methods
113113
expose_headers=["Mcp-Session-Id"],
114114
)

examples/servers/simple-streamablehttp/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ A simple MCP server example demonstrating the StreamableHttp transport, which en
66

77
- Uses the StreamableHTTP transport for server-client communication
88
- Supports REST API operations (POST, GET, DELETE) for `/mcp` endpoint
9-
- Task management with anyio task groups
109
- Ability to send multiple notifications over time to the client
11-
- Proper resource cleanup and lifespan management
1210
- Resumability support via InMemoryEventStore
1311

1412
## Usage

examples/servers/simple-streamablehttp/mcp_simple_streamablehttp/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def main(
132132
# for browser-based clients (ensures 500 errors get proper CORS headers)
133133
starlette_app = CORSMiddleware(
134134
starlette_app,
135-
allow_origins=["*"], # Allow all origins - adjust as needed for production
135+
allow_origins=["*"], # Note: streamable_http_app() enforces localhost-only Origin by default
136136
allow_methods=["GET", "POST", "DELETE"], # MCP streamable HTTP methods
137137
expose_headers=["Mcp-Session-Id"],
138138
)

0 commit comments

Comments
 (0)