Overview
The client supports three primary connection types:- STDIO: Local process communication via standard input/output
- HTTP/SSE: Remote servers via HTTP with Server-Sent Events
- WebSocket: Bidirectional streaming communication
STDIO (Standard Input/Output)
STDIO connections launch and manage MCP servers as local child processes, communicating through standard input and output streams.When to Use STDIO
- Local development: Testing servers on your local machine
- Security-sensitive operations: No network exposure required
- File system access: Direct access to local files and resources
- Simple deployment: No need for network configuration
Characteristics
- Servers run as child processes
- Communication via stdin/stdout
- Automatic process lifecycle management
- Zero network latency
- No external dependencies
Configuration Example:
HTTP/SSE (Server-Sent Events)
HTTP connections communicate with MCP servers over standard HTTP/HTTPS protocols, using Server-Sent Events for real-time updates.When to Use HTTP
- Remote servers: Connecting to servers hosted elsewhere
- Production deployment: Servers behind load balancers or API gateways
- Authentication: Servers requiring OAuth or API key authentication
- Scalability: Multiple clients connecting to the same server
Characteristics
- Servers accessible via HTTP(S) endpoints
- Support for custom headers (authentication, etc.)
- Compatible with standard web infrastructure
- Server-Sent Events for notifications
Configuration Example:
Connection Type Selection
The client automatically detects the appropriate connection type based on your configuration:| Configuration | Connection Type | Use Case |
|---|---|---|
command + args | STDIO | Local process servers |
url: http://... | HTTP/SSE | Remote HTTP servers |
url: ws://... | WebSocket | WebSocket servers |
Automatic Detection: You never need to specify the connection type explicitly. The client analyzes your configuration and selects the appropriate transport protocol automatically.
Best Practices
For Development
Use STDIO connections for local development:- Faster iteration with direct process control
- No network configuration needed
- Easy debugging with process logs
For Production
Use HTTP connections for production deployments:- Better scalability and load distribution
- Support for authentication and authorization
- Compatible with existing infrastructure
- Easier monitoring and logging
Security Considerations
- STDIO: Most secure, no network exposure
- HTTP: Use HTTPS in production, implement authentication
- WebSocket: Use WSS (WebSocket Secure) for encrypted connections