4. MCP StreamableHTTP Transport Protocol
Date: 2025-10-11Status
AcceptedCategory
Core ArchitectureContext
The Model Context Protocol (MCP) needs a transport layer to communicate between clients and servers. The original MCP specification supported two transports:- stdio: Standard input/output (pipes)
- SSE (Server-Sent Events): HTTP-based streaming
- True bidirectional communication
- Better error handling
- More efficient streaming
- Modern HTTP semantics
- Broader client support
- stdio: Claude Desktop app, local CLI tools
- StreamableHTTP: Web clients, cloud deployments, production services
Decision
We will support two MCP server implementations:-
src/mcp_server_langgraph/mcp/server_streamable.py (PRIMARY - StreamableHTTP)
- Modern StreamableHTTP transport
- Production-recommended
- Full HTTP features (CORS, auth headers, rate limiting)
- Port 8000
-
src/mcp_server_langgraph/mcp/server_stdio.py (stdio)
- For Claude Desktop integration
- Local development tool
- No network overhead
Consequences
Positive Consequences
- Future-Proof: Aligned with latest MCP specification
- Better Streaming: More efficient than SSE
- Bidirectional: Client can stream to server
- Standard HTTP: Works with existing HTTP infrastructure
- Cloud-Ready: Ideal for Kubernetes/Docker deployments
- Health Checks: Built-in
/healthendpoints - API Docs: FastAPI auto-generates OpenAPI docs
- Flexibility: Multiple transports for different use cases
Negative Consequences
- Multiple Servers: Two separate server files to maintain
- Confusion: Users must choose correct server (stdio vs StreamableHTTP)
- Documentation: Must explain when to use each transport
Neutral Consequences
- Code Duplication: Some shared logic across servers (mitigated with imports)
- Testing: Must test both transports
Alternatives Considered
1. stdio Only
Description: Only support stdio transport Pros:- Simplest implementation
- Perfect for Claude Desktop
- No network complexity
- Lowest latency
- Can’t deploy to cloud
- No web client support
- No remote access
- Not scalable
2. SSE Only
Description: Only support SSE transport Pros:- HTTP-based
- Good browser support
- Simpler than bidirectional
- Deprecated in MCP spec
- Unidirectional only
- Less efficient
- Not future-proof
3. WebSocket
Description: Use WebSocket instead of StreamableHTTP Pros:- Truly bidirectional
- Real-time
- Efficient
- Not in MCP specification
- More complex protocol
- Harder to debug
- Connection management overhead
4. gRPC
Description: Use gRPC for transport Pros:- Very efficient
- Bidirectional streaming
- Type-safe
- Not in MCP spec
- Complex setup
- Poor browser support
- Requires protobuf
5. Single Unified Server
Description: One server supporting multiple transports Pros:- Single codebase
- Easier to maintain
- Less confusion
- Complex implementation
- Port conflicts
- Harder to configure
- Mixed concerns
Implementation Details
StreamableHTTP Server (Primary)
stdio Server
Docker Configuration
Usage Examples
Client Configuration
Migration Path
Phase 1
All three transports supportedStreamableHTTP recommendedSSE marked as deprecated
Phase 2 (6 months)
SSE warnings in logsDocumentation updatedMigration guide published
Phase 3 (COMPLETED 2025-10-11)
- ✅ Removed SSE server (mcp_server_http.py)
- ✅ Only StreamableHTTP + stdio remain
- ✅ Removed sse-starlette dependency
References
- MCP Specification
- MCP Transport Documentation
- FastAPI Documentation
- Related Files:
src/mcp_server_langgraph/mcp/server_streamable.py,src/mcp_server_langgraph/mcp/server_stdio.py - Related ADRs: OpenAPI validation (planned for future ADR)
Changelog
- 2025-10-11: Removed SSE transport (mcp_server_http.py) and sse-starlette dependency. Updated decision to reflect two transports only (StreamableHTTP + stdio).