STDIO servers with packageName (e.g. @leval/mcp-grafana) need a Node.js container that runs `npx -y <package>`. Previously, packageName was used as a Docker image reference causing "invalid reference format" errors. - Add Dockerfile.node-runner: minimal node:20-alpine with npx entrypoint - Update instance.service.ts: detect npm-based servers and use node-runner image with npx command instead of treating packageName as image name - Fix NanoCPUs: only set when explicitly provided (kernel CFS not available on all hosts) - Add mcp-servers network with explicit name for container isolation - Configure MCPD_NODE_RUNNER_IMAGE and MCPD_MCP_NETWORK env vars Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: mcpctl-postgres
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_USER: mcpctl
|
|
POSTGRES_PASSWORD: mcpctl_dev
|
|
POSTGRES_DB: mcpctl
|
|
volumes:
|
|
- mcpctl-pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mcpctl"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mcpctl
|
|
|
|
mcpd:
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/Dockerfile.mcpd
|
|
container_name: mcpctl-mcpd
|
|
ports:
|
|
- "3100:3100"
|
|
environment:
|
|
DATABASE_URL: postgresql://mcpctl:mcpctl_dev@postgres:5432/mcpctl
|
|
MCPD_PORT: "3100"
|
|
MCPD_HOST: "0.0.0.0"
|
|
MCPD_LOG_LEVEL: info
|
|
MCPD_NODE_RUNNER_IMAGE: mcpctl-node-runner:latest
|
|
MCPD_MCP_NETWORK: mcp-servers
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
volumes:
|
|
# Mount container runtime socket (Docker or Podman)
|
|
# For Docker: /var/run/docker.sock
|
|
# For Podman: /run/user/<UID>/podman/podman.sock
|
|
- ${CONTAINER_SOCK:-/var/run/docker.sock}:/var/run/docker.sock
|
|
networks:
|
|
- mcpctl
|
|
- mcp-servers
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q --spider http://localhost:3100/healthz || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Base image for npm-based MCP servers (built once, used by mcpd)
|
|
node-runner:
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/Dockerfile.node-runner
|
|
image: mcpctl-node-runner:latest
|
|
profiles:
|
|
- build
|
|
entrypoint: ["echo", "Image built successfully"]
|
|
|
|
postgres-test:
|
|
image: postgres:16-alpine
|
|
container_name: mcpctl-postgres-test
|
|
ports:
|
|
- "5433:5432"
|
|
environment:
|
|
POSTGRES_USER: mcpctl
|
|
POSTGRES_PASSWORD: mcpctl_test
|
|
POSTGRES_DB: mcpctl_test
|
|
tmpfs:
|
|
- /var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mcpctl"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
profiles:
|
|
- test
|
|
|
|
networks:
|
|
mcpctl:
|
|
driver: bridge
|
|
mcp-servers:
|
|
name: mcp-servers
|
|
driver: bridge
|
|
# Not internal — MCP servers need outbound access to reach external APIs
|
|
# (e.g., Grafana, Home Assistant). Isolation is enforced by not binding
|
|
# host ports on MCP server containers; only mcpd can reach them.
|
|
|
|
volumes:
|
|
mcpctl-pgdata:
|