This document provides real-world configuration examples for common MCP servers. Each example includes installation instructions, configuration, and use cases.
The most common way to run the Git MCP server.
Installation:
npm install -g @modelcontextprotocol/server-gitConfiguration:
servers:
git:
name: "git"
binary: "npx"
args:
- "-y"
- "@modelcontextprotocol/server-git"
timeout: 60s
max_restarts: 5
auto_start: falseUse Cases:
- Repository operations
- File read/write in repos
- Git commands (diff, log, status)
- Commit history analysis
Args Explanation:
-y: Skip confirmation prompts@modelcontextprotocol/server-git: Package name
Run Git MCP in an isolated container.
Configuration:
servers:
git:
name: "git"
binary: "docker"
args:
- "run"
- "-i"
- "--rm"
- "mcp/git-server"
timeout: 60s
auto_start: falseBenefits:
- Isolated environment
- No local dependencies
- Easy to clean up
Installation:
npm install -g @modelcontextprotocol/server-filesystemConfiguration:
servers:
filesystem:
name: "filesystem"
binary: "/usr/bin/node"
args:
- "/path/to/mcp-filesystem-server/index.js"
- "--allowed-directory=/data"
env:
HOME: "/home/user"
timeout: 30s
max_restarts: 3
auto_start: trueSecurity:
--allowed-directory: Restricts access to specific directories- Never expose
/or sensitive directories - Use read-only mode when possible
Recommended:
servers:
filesystem:
binary: "/usr/bin/node"
args:
- "/path/to/server/index.js"
- "--allowed-directory=/data"
- "--read-only"Alternative installation using uvx.
Installation:
pip install mcp-server-filesystemConfiguration:
servers:
filesystem:
name: "filesystem"
binary: "uvx"
args:
- "mcp-server-filesystem"
- "--allowed-directory=/home/user/projects"
timeout: 30s
max_restarts: 3Use Cases:
- File operations
- Directory browsing
- Document processing
- Code analysis
Temporary storage for sessions and state.
Configuration:
servers:
memory:
name: "memory"
binary: "docker"
args:
- "run"
- "-i"
- "--rm"
- "mcp/memory-server:latest"
timeout: 30s
auto_start: falseUse Cases:
- Key-value storage
- Session memory
- Temporary data
- Cache
Run your own MCP server.
Configuration:
servers:
custom:
name: "custom"
binary: "/home/user/my-mcp-server"
args:
- "--port"
- "9000"
- "--config"
- "/etc/myserver/config.json"
env:
MY_SECRET: "${MY_SECRET}"
timeout: 60s
max_restarts: 3
auto_start: falseRequirements:
- Binary must be executable (
chmod +x) - Binary must output JSON-RPC to stdout
- Each message must end with newline (
\n)
servers:
calculator:
name: "calculator"
binary: "./calc-server"
args:
- "--port"
- "9001"
timeout: 30s
max_restarts: 2
auto_start: falseRunning multiple servers simultaneously.
Configuration:
bridge:
port: 8080
allowed_origins:
- http://localhost:3000
connection_limit: 10
request_size_limit: 2097152
servers:
git:
name: "git"
binary: "npx"
args: ["-y", "@modelcontextprotocol/server-git"]
timeout: 60s
max_restarts: 5
auto_start: true
filesystem:
name: "filesystem"
binary: "uvx"
args: ["mcp-server-filesystem", "--allowed-directory=/data"]
timeout: 30s
max_restarts: 3
auto_start: true
memory:
name: "memory"
binary: "docker"
args: ["run", "-i", "mcp/memory-server"]
timeout: 30s
max_restarts: 2
auto_start: falseNamespace Routing:
- Git tools:
/mcp/git/tools/call - Filesystem tools:
/mcp/filesystem/tools/call - Memory tools:
/mcp/memory/tools/call
Benefits:
- Isolated server processes
- Independent restart policies
- Separate timeouts
servers:
git:
auto_start: true # Always ready
max_restarts: 5 # Forgiving
filesystem:
auto_start: true # Always ready
max_restarts: 3 # Moderate
memory:
auto_start: false # Start on demand
max_restarts: 2 # StrictFile: /etc/systemd/system/mcp-bridge.service
[Unit]
Description=MCP HTTP Bridge
After=network.target
[Service]
Type=simple
User=bridge
WorkingDirectory=/opt/mcp-bridge
ExecStart=/opt/mcp-bridge/bin/bridge --config /etc/mcp-bridge/config.yaml
Restart=on-failure
RestartSec=10
Environment="NODE_ENV=production"
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable mcp-bridge
sudo systemctl start mcp-bridgeMonitor:
sudo systemctl status mcp-bridge
sudo journalctl -u mcp-bridge -fservers:
git:
env:
REPO_PATH: "/data/${REPO_NAME}"
API_KEY: "${API_KEY}"
DEBUG: "${DEBUG:-false}" # Default value if not setBehavior:
${VAR_NAME}- Environment variable${VAR:-default}- Environment variable with default- No shell expansion
servers:
fast:
timeout: 10s # Fast server
slow:
timeout: 120s # Slow server (filesystem)servers:
unstable:
max_restarts: 10 # Allow more restarts
timeout: 60sservers:
custom:
env:
HOME: "/home/user"
PATH: "/usr/local/bin:/usr/bin"
NODE_ENV: "production"
API_KEY: "${API_KEY}"Wrong:
binary: "my-server" # Not in PATHRight:
binary: "/usr/local/bin/my-server" # Absolute pathFix:
chmod +x /path/to/binaryChange port:
bridge:
port: 8081 # Use different portCheck:
# Verify binary exists
which npx
# Check permissions
ls -la /path/to/binary
# Test manually
npx -y @modelcontextprotocol/server-git- Use absolute paths for binaries
- Restrict
allowed_directoryfor filesystem server - Use
allowed_originsto limit CORS - Use
allowed_argsto restrict server arguments - Argument sanitization is always enabled by default
- Set
auto_start: truefor frequently-used servers - Adjust
timeoutbased on server characteristics - Use
connection_limitappropriately - Monitor restart counts
- Set reasonable
max_restartslimits - Use
idle_timeoutto clean up connections - Monitor subprocess health via
/health/{namespace} - Enable logging for troubleshooting
bridge:
port: 8080
allowed_origins:
- http://localhost:3000
servers:
git:
name: "git"
binary: "npx"
args: ["-y", "@modelcontextprotocol/server-git"]bridge:
port: 8080
allowed_origins:
- http://localhost:3000
request_timeout: 30s
idle_timeout: 5m
connection_limit: 10
servers:
git:
name: "git"
binary: "npx"
args: ["-y", "@modelcontextprotocol/server-git"]
timeout: 60s
max_restarts: 5
auto_start: true
filesystem:
name: "filesystem"
binary: "/usr/bin/node"
args:
- "/path/to/server"
- "--allowed-directory=/data"
timeout: 30s
max_restarts: 3
auto_start: trueFor configuration reference, see CONFIG.md. For API details, see API.md.