Server Types
MCP Gateway supports three transport modes for connecting to MCP servers. Choose based on your server's capabilities and your deployment requirements.
Comparison
| Transport | Memory | Startup | Best For |
|---|---|---|---|
| HTTP | ~60 MB | ~1.5s | Servers with native HTTP support |
| Stdio | ~100 MB | ~2.5s | Traditional npm MCP packages |
| Docker | ~70 MB | ~4s | Isolation, complex dependencies |
HTTP Mode
The most efficient mode. The server runs as an HTTP service and the gateway communicates via JSON-RPC over HTTP.
{
"playwright": {
"command": "npx",
"args": ["-y", "@playwright/mcp-server", "--port", "9001"],
"transport": "http",
"url": "http://localhost:9001/mcp"
}
}
When to use HTTP
- Server supports native HTTP mode (Playwright, Context7)
- You need the lowest overhead
- You want direct port control
Pros
- No wrapper overhead
- Fastest startup
- Direct HTTP communication
Cons
- Not all servers support it
- Manual port management
Stdio Mode (Default)
The gateway spawns the server as a child process and communicates via stdin/stdout. A thin HTTP wrapper is automatically generated.
{
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"transport": "stdio"
}
}
info
"transport": "stdio" is the default and can be omitted.
When to use Stdio
- Traditional MCP servers from npm
- Servers without native HTTP support
- No Docker available
Pros
- Works with any stdio-based server
- Auto-generated HTTP wrapper
- No Docker required
Cons
- Wrapper adds overhead (~50MB)
- Slightly slower startup
Docker Mode
Runs the MCP server inside a Docker container. Best for servers with complex dependencies or when you need isolation.
{
"fetch": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-p", "9002:8080",
"mcp/fetch:latest"
],
"transport": "docker",
"url": "http://localhost:9002/mcp"
}
}
When to use Docker
- Server has complex dependencies (Python, system libs)
- You need sandboxed execution
- Consistent environment across machines
Pros
- Isolated environment
- Consistent dependencies
- Security sandbox
Cons
- Requires Docker installed
- Slowest startup (image pull)
- Container overhead
Choosing a Transport
Does server support native HTTP?
├─ YES → Use HTTP mode
└─ NO
└─ Need isolation or Docker?
├─ YES → Use Docker mode
└─ NO → Use Stdio mode
Mixed Configuration
You can mix transport types in a single configuration:
{
"mcpServers": {
"playwright": {
"transport": "http",
"command": "npx",
"args": ["-y", "@playwright/mcp-server", "--port", "9001"],
"url": "http://localhost:9001/mcp"
},
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
},
"fetch": {
"transport": "docker",
"command": "docker",
"args": ["run", "--rm", "-p", "9002:8080", "mcp/fetch:latest"],
"url": "http://localhost:9002/mcp"
}
}
}