mcp-compose
Compose, manage, and run MCP servers as Docker containers. With a Unified API gateway built in.
Documentation
MCP-Compose
Docker Compose for Model Context Protocol servers. Run multiple MCP servers with unified configuration, HTTP proxy, and container orchestration.

Features
- Docker Compose-style YAML configuration
- HTTP proxy with automatic protocol translation (STDIO → HTTP)
- Native support for Docker and Podman
- Session management and connection pooling
- Built-in dashboard and monitoring
- OpenAPI spec generation
Installation
git clone https://github.com/phildougherty/mcp-compose.git
cd mcp-compose
make build
# Add to PATH
sudo cp build/mcp-compose /usr/local/bin/
# OR
export PATH="$PWD/build:$PATH"Quick Start
Interactive Setup
mcp-compose initFollow the prompts to create your configuration.
Manual Setup
Create `mcp-compose.yaml`:
version: '1'
servers:
filesystem:
protocol: stdio
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-filesystem"
- "/tmp"
capabilities: [resources, tools]Start servers:
mcp-compose upStart the HTTP proxy:
mcp-compose proxy --port 9876Test it:
curl http://localhost:9876/api/serversWorking Examples
Basic - Filesystem + Memory
version: '1'
servers:
filesystem:
protocol: stdio
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-filesystem"
- "${HOME}"
capabilities: [resources, tools]
volumes:
- "${HOME}:${HOME}:ro"
memory:
protocol: stdio
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-memory"
capabilities: [resources, tools]With Web Search
Add Brave Search (requires API key from https://brave.com/search/api/):
brave-search:
protocol: stdio
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-brave-search"
capabilities: [tools]
env:
BRAVE_API_KEY: "${BRAVE_API_KEY}"export BRAVE_API_KEY="your-api-key"
mcp-compose upSee examples/ for more configurations.
Commands
Service Management
mcp-compose up # Start all services
mcp-compose up filesystem # Start specific service
mcp-compose down # Stop all services
mcp-compose down filesystem # Stop specific service
mcp-compose restart # Restart all services
mcp-compose ps # List service status
mcp-compose logs filesystem # View logsSystem Services
System services are infrastructure components (proxy, dashboard, task-scheduler, memory).
mcp-compose system up # Start system services
mcp-compose system down # Stop system services
mcp-compose system ps # List system services
mcp-compose system status # Health overview
mcp-compose system logs proxy # View system logsProxy
mcp-compose proxy --port 9876 # Start proxy
mcp-compose proxy --api-key $(openssl rand -hex 32) # With authenticationDashboard
mcp-compose dashboard # Start web dashboard
# Access at http://localhost:3111Configuration
mcp-compose init # Interactive setup wizard
mcp-compose validate # Validate config file
mcp-compose create-config --type claude # Generate client configConfiguration Reference
Basic Structure
version: '1'
# Optional: proxy authentication
proxy_auth:
enabled: true
api_key: "${MCP_API_KEY}"
servers:
my-server:
protocol: string # stdio, http, sse
command: string # Executable (e.g., npx, python, node)
args: [string] # Command arguments
capabilities: [string] # tools, resources, prompts, sampling
env: # Environment variables
KEY: value
volumes: # Volume mounts
- "host:container:mode"Protocol Types
STDIO (most common for NPM packages):
servers:
my-server:
protocol: stdio
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]HTTP:
servers:
my-server:
protocol: http
http_port: 8080SSE (Server-Sent Events):
servers:
my-server:
protocol: sse
http_port: 8080
sse_path: /eventsVolume Mounts
volumes:
- "/host/path:/container/path:ro" # Read-only
- "/host/path:/container/path:rw" # Read-write
- "${HOME}/code:/workspace:ro" # Environment variablesEnvironment Variables
In your config:
env:
API_KEY: "${MY_API_KEY}"In your shell:
export MY_API_KEY="secret"
mcp-compose upSecurity
Never commit secrets to your config file. Use environment variables:
# Generate secure keys
export MCP_API_KEY=$(openssl rand -hex 32)
export OAUTH_CLIENT_SECRET=$(openssl rand -hex 32)Reference in config:
proxy_auth:
api_key: "${MCP_API_KEY}"Client Integration
Claude Desktop
Generate config:
mcp-compose create-config --type claude --output ./claude-configCopy contents to Claude Desktop settings.
Direct HTTP
# List tools
curl -X POST http://localhost:9876/filesystem \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# Call tool
curl -X POST http://localhost:9876/filesystem \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"tools/call",
"params":{
"name":"read_file",
"arguments":{"path":"/tmp/test.txt"}
}
}'Troubleshooting
Check Service Status
mcp-compose ps
mcp-compose system statusView Logs
mcp-compose logs filesystem
mcp-compose system logs proxyValidate Configuration
mcp-compose validateCommon Issues
Port already in use:
lsof -i :9876
mcp-compose proxy --port 9877 # Use different portContainer not starting:
mcp-compose logs my-server # Check logs
docker ps -a # Check container statusAuthentication errors:
echo $MCP_API_KEY # Verify key is setRequirements
- Docker 20.10+ or Podman 3.0+
- Linux, macOS, or Windows with WSL2
- Go 1.19+ (for building from source)
Architecture
┌──────────────────────────────┐
│ MCP-Compose Proxy │
│ (HTTP API + Authentication) │
└──────────────┬───────────────┘
│
┌──────┼──────┐
│ │ │
┌───▼──┐ ┌─▼──┐ ┌▼───┐
│ FS │ │ Mem│ │Search│
│STDIO │ │HTTP│ │ SSE │
└──────┘ └────┘ └──────┘License
GNU Affero General Public License v3.0 - see LICENSE.
Links
Frequently asked questions
What is mcp-compose?
mcp-compose is Compose, manage, and run MCP servers as Docker containers. With a Unified API gateway built in.
How do I install mcp-compose?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-compose open source?
Yes — it is hosted on GitHub at https://github.com/phildougherty/mcp-compose and has 58 stars.
Related MCP tools
eBPF-powered network observability for Kubernetes. Indexes L4/L7 traffic with full K8s context, decrypts TLS without keys. Queryable by AI agents via MCP and humans via dashboard.
GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
The missing open-source Kubernetes UI with a built-in MCP server for AI agents. See what's broken, why, and what changed. Issues, Topology, event timeline, Helm, GitOps, live service traffic, and cluster audits - all in one Go binary.
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.
The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.
Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. This MCP server for MATLAB supports a wide range of coding agents like Claude Code® and Visual Studio® Code.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP