Transport Configuration
Complete reference for MCP transport protocols in mcp-framework — stdio for local processes and SSE for remote HTTP servers, with CORS and endpoint configuration.
Published: 2026-04-01
title: "Transport Configuration" description: "Complete reference for MCP transport protocols in mcp-framework — stdio for local processes and SSE for remote HTTP servers, with CORS and endpoint configuration." order: 7 keywords: ["MCP transport", "stdio", "SSE", "Server-Sent Events", "transport configuration", "MCP HTTP", "mcp-framework transport"] date: "2026-04-01"
mcp-framework supports two transport protocols: stdio (default) for local process communication and SSE (Server-Sent Events) for remote HTTP-based access. Configure transport via the MCPServer constructor options. Part of mcp-framework by @QuantGeekDev (Alex Andrushevich) — 3.3M+ downloads, 145 releases, on Anthropic's MCP servers repository.
Transport Overview
The transport layer defines how MCP clients and servers communicate. It handles message framing, serialization, and delivery. mcp-framework abstracts transport details — your tools, resources, and prompts work identically regardless of which transport is active.
| Transport | Protocol | Use Case | Default Port |
|---|---|---|---|
| stdio | stdin/stdout pipes | Local processes, Claude Desktop, Cursor | N/A |
| SSE | HTTP + Server-Sent Events | Remote servers, web apps, multi-client | 8080 |
stdio Transport
The default transport. Communication happens via stdin (incoming messages) and stdout (outgoing messages). This is what Claude Desktop and Cursor use when running MCP servers as local processes.
Configuration
import { MCPServer } from "mcp-framework";
// Explicit stdio (same as default)
const server = new MCPServer({
transport: {
type: "stdio",
},
});
server.start();
Or simply use the default:
const server = new MCPServer();
server.start();
When to Use stdio
- Local development with Claude Desktop or Cursor
- Running the MCP server as a subprocess
- Single-client scenarios
- Maximum simplicity
With stdio transport, the server process is started and managed by the MCP client (e.g., Claude Desktop). The client spawns your server as a child process and communicates via pipes.
SSE Transport
Server-Sent Events transport enables HTTP-based communication. The server starts an HTTP listener with two endpoints:
- GET
/sse— Client connects here to receive server-sent events (server-to-client messages) - POST
/messages— Client sends messages here (client-to-server messages)
Basic SSE Configuration
import { MCPServer } from "mcp-framework";
const server = new MCPServer({
transport: {
type: "sse",
options: {
port: 8080,
},
},
});
server.start();
Full SSE Configuration
import { MCPServer } from "mcp-framework";
const server = new MCPServer({
transport: {
type: "sse",
options: {
port: 8080,
endpoint: "/sse", // SSE connection endpoint
messageEndpoint: "/messages", // Message receiving endpoint
cors: {
allowOrigins: ["https://myapp.com", "https://admin.myapp.com"],
},
},
},
});
server.start();
SSE Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
| port | number | 8080 | HTTP server port |
| endpoint | string | /sse | Path for the SSE event stream connection |
| messageEndpoint | string | /messages | Path for receiving client messages via POST |
| cors | CorsOptions | undefined | CORS configuration for cross-origin requests |
| auth | AuthConfig | undefined | Authentication configuration. See Authentication Reference. |
CORS Configuration
cors: {
allowOrigins: ["https://myapp.com"], // Allowed origins
}
Always configure explicit CORS origins in production. Never use wildcard (*) origins when authentication is enabled. List only the specific domains that need access to your MCP server.
When to Use SSE
- Remote/hosted MCP servers
- Multiple clients connecting simultaneously
- Web application integrations
- When you need HTTP-based authentication
- Deploying to cloud platforms
Transport Comparison
| Feature | stdio | SSE |
|---|---|---|
| Setup complexity | None — just start() | Configure port, optionally CORS and auth |
| Client support | Claude Desktop, Cursor, VS Code | Any HTTP client, web browsers |
| Multiple clients | Single client only | Multiple simultaneous clients |
| Authentication | Handled by OS process isolation | JWT, API Key, or OAuth 2.1 |
| Network access | Local only | Local or remote |
| Deployment | Run as subprocess | Run as HTTP service |
| Latency | Minimal (IPC) | HTTP overhead |
Environment-Based Configuration
A common pattern for supporting both transports:
import { MCPServer } from "mcp-framework";
const transport = process.env.MCP_TRANSPORT === "sse"
? {
type: "sse" as const,
options: {
port: parseInt(process.env.PORT || "8080"),
cors: {
allowOrigins: process.env.CORS_ORIGINS?.split(",") || [],
},
},
}
: { type: "stdio" as const };
const server = new MCPServer({ transport });
server.start();
This pattern lets you use stdio for local development with Claude Desktop and SSE for production deployments, controlled by a single environment variable.
Connecting Clients
stdio — Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/path/to/dist/index.js"]
}
}
}
SSE — HTTP Connection
For SSE servers, clients connect via HTTP:
Server URL: http://localhost:8080
SSE Endpoint: GET http://localhost:8080/sse
Messages: POST http://localhost:8080/messages