Use streamable-http consistently in examples (#1389)

This commit is contained in:
Max Isbey 2025-09-23 20:19:14 +01:00 • committed by GitHub
commit c0f165776d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -71,4 +71,4 @@ mcp> quit
## Configuration
- `MCP_SERVER_PORT` - Server URL (default: 8000)
- `MCP_TRANSPORT_TYPE` - Transport type: `streamable_http` (default) or `sse`
- `MCP_TRANSPORT_TYPE` - Transport type: `streamable-http` (default) or `sse`

View file

@ -150,7 +150,7 @@ class CallbackServer:
class SimpleAuthClient:
"""Simple MCP client with auth support."""
def __init__(self, server_url: str, transport_type: str = "streamable_http"):
def __init__(self, server_url: str, transport_type: str = "streamable-http"):
self.server_url = server_url
self.transport_type = transport_type
self.session: ClientSession | None = None
@ -334,10 +334,10 @@ async def main():
# Default server URL - can be overridden with environment variable
# Most MCP streamable HTTP servers use /mcp as the endpoint
server_url = os.getenv("MCP_SERVER_PORT", 8000)
transport_type = os.getenv("MCP_TRANSPORT_TYPE", "streamable_http")
transport_type = os.getenv("MCP_TRANSPORT_TYPE", "streamable-http")
server_url = (
f"http://localhost:{server_url}/mcp"
if transport_type == "streamable_http"
if transport_type == "streamable-http"
else f"http://localhost:{server_url}/sse"
)

View file

@ -43,7 +43,7 @@ uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --tra
```bash
cd examples/clients/simple-auth-client
# Start client with streamable HTTP
MCP_SERVER_PORT=8001 MCP_TRANSPORT_TYPE=streamable_http uv run mcp-simple-auth-client
MCP_SERVER_PORT=8001 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client
```
## How It Works
@ -101,7 +101,7 @@ uv run mcp-simple-auth-legacy --port=8002
```bash
# Test with client (will automatically fall back to legacy discovery)
cd examples/clients/simple-auth-client
MCP_SERVER_PORT=8002 MCP_TRANSPORT_TYPE=streamable_http uv run mcp-simple-auth-client
MCP_SERVER_PORT=8002 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client
```
The client will: