MCP Server Connection Types
MCP supports multiple connection types that define how clients communicate with servers. This section focuses on the two most common protocols:
STDIO
— for local, lightweight server executionSSE
(Server-Sent Events) — for remote, web-hosted servers
MCP Connection Types
An MCP connection type defines how the client opens a communication channel with the server. Clients must use one of the supported protocols to start a session, send tool requests, and receive results.
Type | Transport | Example Use |
---|---|---|
STDIO | Standard Input/Output | Run server from local script file |
SSE | Server-Sent Events over HTTP | Connect to hosted API endpoint |
STDIO: Local Execution
- Launches a script file locally (
.py
,.js
) - Communicates via system I/O streams
- No internet required
Required Config Fields
Field | Description | Example |
---|---|---|
command | What to run | python , node |
args | Script and arguments | [index.js] |
env | Environment vars (optional) | { UV_PATH: "/path/to/uv" } |
"server": {
"type": "stdio",
"command": "node",
"args": ["dist/index.js"],
"env": {
"UV_PATH": "/Users/you/.cargo/bin/uv"
}
}
SSE: Remote Access via HTTP
- Sends requests to a hosted API server
- Listens to streaming responses over HTTP
- Ideal for production deployment
Required Config Fields
Field | Description | Example |
---|---|---|
type | Must be sse | "sse" |
url | Endpoint for receiving events | https://yourdomain.com/api/mcp |
headers | Optional auth headers | { Authorization: "Bearer xxx" } |
"server": {
"type": "sse",
"url": "https://api.example.com/mcp-server",
"headers": {
"Authorization": "Bearer your-token"
}
}