-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
68 lines (66 loc) · 1.93 KB
/
docker-compose.yml
File metadata and controls
68 lines (66 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# MCP Proxy Server — Docker Compose example
#
# Option A — Inline config (no file mount):
# Edit the MCP_SERVERS_CONFIG value below, then:
# docker compose up --build
#
# Tip: load from file with shell substitution:
# MCP_SERVERS_CONFIG="$(cat servers.json)" docker compose up --build
#
# Option B — File mount (traditional):
# cp servers.example.json servers.json # edit with your backends and tokens
# docker compose --profile file-mount up --build
#
# Test:
# curl http://localhost:8080/health
# curl http://localhost:8080/mcp \
# -H "Authorization: Bearer change-me-alice" \
# -H "Content-Type: application/json" \
# -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
services:
# Option A: inline config via environment variable
mcp-proxy:
build:
context: .
dockerfile: Dockerfile
command: ["serve", "--http", "0.0.0.0:8080", "--insecure"]
ports:
- "8080:8080"
environment:
MCP_SERVERS_CONFIG: |
{
"mcpServers": {
"example": {
"url": "https://example.com/mcp",
"headers": {"Authorization": "Bearer $${EXAMPLE_TOKEN}"}
}
},
"serverAuth": {
"provider": "bearer",
"tokens": ["change-me-alice"]
}
}
# EXAMPLE_TOKEN: "your-token-here"
restart: unless-stopped
healthcheck:
test: ["CMD", "mcp", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3
# Option B: file-mounted config (activate with --profile file-mount)
mcp-proxy-file:
profiles: ["file-mount"]
build:
context: .
dockerfile: Dockerfile
command: ["serve", "--http", "0.0.0.0:8080", "--insecure"]
ports:
- "8080:8080"
volumes:
- ./servers.json:/root/.config/mcp/servers.json:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "mcp", "healthcheck"]
interval: 30s
timeout: 5s
retries: 3