apps/docs/docs/features/mcp/server-transports.md
Model Context Protocol (MCP) supports three primary transport mechanisms for communication between Roo Code and MCP servers: Standard Input/Output (STDIO), Streamable HTTP (the modern standard), and Server-Sent Events (SSE) (for legacy use). Each has distinct characteristics, advantages, and use cases.
STDIO transport runs locally on your machine and communicates via standard input/output streams.
Client Server
| |
|---- JSON message ------>| (via STDIN)
| | (processes request)
|<---- JSON message ------| (via STDOUT)
| |
STDIO transport is ideal for:
import { Server } from "@modelcontextprotocol/sdk/server/index.js"
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
const server = new Server({ name: "local-server", version: "1.0.0" })
// Register tools...
// Use STDIO transport
const transport = new StdioServerTransport(server)
transport.listen()
Streamable HTTP transport is the modern standard for remote MCP server communication, replacing the older HTTP+SSE transport. It operates over HTTP/HTTPS and allows for more flexible server implementations.
Client Server
| |
|---- HTTP POST /mcp_endpoint ---->| (client request)
| | (processes request)
|<--- HTTP Response / SSE Stream --| (server response / stream)
| |
Streamable HTTP transport is ideal for:
Configuration in settings.json:
{
"mcpServers": {
"StreamableHTTPMCPName": {
"type": "streamable-http",
"url": "http://localhost:8080/mcp"
}
}
}
For server-side implementation, refer to the MCP SDK documentation for StreamableHTTPClientTransport.
Clients and servers can maintain backwards compatibility with the deprecated HTTP+SSE transport (from protocol version 2024-11-05).
Servers wanting to support older clients should:
/events) and POST (/message) endpoints of the old transport, alongside the new “MCP endpoint” defined for the Streamable HTTP transport.Server-Sent Events (SSE) transport is a legacy method for remote server communication over HTTP/HTTPS. For new implementations, Streamable HTTP transport is recommended. SSE remains available for compatibility with older MCP servers.
Client Server
| |
|---- HTTP GET /events ----------->| (establish SSE connection)
|<---- SSE event stream -----------| (persistent connection)
| |
|---- HTTP POST /message --------->| (client request)
|<---- SSE event with response ----| (server response)
| |
SSE transport is better for:
import { Server } from "@modelcontextprotocol/sdk/server/index.js"
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"
import express from "express"
const app = express()
const server = new Server({ name: "remote-server", version: "1.0.0" })
// Register tools...
// Use SSE transport
const transport = new SSEServerTransport(server)
app.use("/mcp", transport.requestHandler())
app.listen(3000, () => {
console.log("MCP server listening on port 3000")
})
The choice between STDIO and SSE transports directly impacts how you'll deploy and manage your MCP servers.
STDIO servers run locally on the same machine as Roo Code, which has several important implications:
A local file search tool using STDIO would:
Streamable HTTP (recommended) and legacy SSE servers can be deployed to remote servers and accessed over the network:
A database query tool using SSE would:
Some scenarios benefit from a hybrid approach:
| Consideration | STDIO | Streamable HTTP | SSE (Legacy) |
|---|---|---|---|
| Location | Local machine only | Local or remote | Local or remote |
| Clients | Single client | Multiple clients | Multiple clients |
| Performance | Lower latency | Higher latency (network overhead) | Higher latency (network overhead) |
| Setup Complexity | Simpler | More complex (requires HTTP server) | More complex (requires HTTP server, potentially two endpoints) |
| Security | Inherently secure | Requires explicit security measures | Requires explicit security measures |
| Network Access | Not needed | Required | Required |
| Scalability | Limited to local machine | Can distribute across network | Can distribute across network |
| Deployment | Per-user installation | Centralized installation | Centralized installation |
| Updates | Distributed updates | Centralized updates | Centralized updates |
| Resource Usage | Uses client resources | Uses server resources | Uses server resources |
| Dependencies | Client-side dependencies | Server-side dependencies | Server-side dependencies |
| Recommendation | Ideal for local, secure, single-client tools | Modern standard for all new remote servers | Legacy, for existing older servers |
For detailed information on configuring STDIO, Streamable HTTP, and SSE (Legacy) transports in Roo Code, including example configurations, see the Understanding Transport Types section in the Using MCP in Roo Code guide.