Docker
The mcp CLI is available as a multi-arch Docker image (amd64/arm64) on GitHub Container Registry.
Pull the image
docker pull ghcr.io/avelino/mcpAvailable tags
latest
Latest stable release
x.y.z
Pinned version (e.g. 0.1.0)
beta
Latest build from main branch
Basic usage
The CLI runs as the container entrypoint. Pass arguments directly:
docker run --rm ghcr.io/avelino/mcp --help
docker run --rm ghcr.io/avelino/mcp search githubUsing your config
There are two ways to provide configuration: file mount (traditional) or inline JSON (container-friendly).
Option A: Inline config (recommended for containers)
Pass the entire config as an environment variable — no file mounts needed:
You can also read the JSON from an existing file with $(cat ...):
This is ideal for Docker Compose, Kubernetes, and CI/CD — the config lives in the orchestrator, not the filesystem.
Option B: File mount
Mount your local config directory so the container can access your server definitions:
Passing environment variables
Servers that need API tokens or other secrets require environment variables. Pass them with -e:
You can also use an env file:
Proxy mode (long-running)
Run the MCP proxy as a long-running service:
With audit logging
The default image disables audit logging (MCP_AUDIT_ENABLED=false) because scratch images have no writable filesystem. You have two options:
Option A: Stream to stdout (no volume needed)
Audit entries are emitted as JSON lines to stdout, captured by your container log driver (CloudWatch, Datadog, etc.).
Option B: Persist to a volume
Application logs (stderr, JSON for log drivers)
Tracing logs (startup, backend discovery, request errors) go to stderr. Two env vars tune them for production:
MCP_LOG_LEVELusestracingEnvFilter syntax — global level (info/debug) or per-module (mcp=debug,hyper=warn). The example silences noisy HTTP-stack libraries while keeping the proxy atdebug.MCP_LOG_FORMAT=jsonemits newline-delimited JSON, one event per line — drop straight into Datadog, CloudWatch, Loki, etc.
Pair with MCP_AUDIT_OUTPUT=stdout and you get a single Docker log stream where every line is JSON: app/tracing on stderr, audit on stdout — both captured by docker logs.
Container environment variables
These variables are especially useful for container deployments. See the full list in the environment variables reference.
MCP_SERVERS_CONFIG
—
Inline JSON config, no file mount needed
MCP_CONFIG_DIR
~/.config/mcp
Override config directory
MCP_LOG_LEVEL
info
Log verbosity: trace, debug, info, warn, error
MCP_LOG_FORMAT
text
Log format: text or json (structured, for log drivers)
MCP_AUDIT_ENABLED
false (in Docker image)
Disable audit for read-only fs
MCP_AUDIT_OUTPUT
unset (→ file+stdout in mcp serve --http)
stdout/stderr for log driver only, file for ChronDB only (setting this env var is treated as explicit and skips auto-promotion in serve), file+stdout/file+stderr for both, none to disable
MCP_AUDIT_PATH
~/.config/mcp/db/data
Override audit data path
MCP_AUDIT_INDEX_PATH
~/.config/mcp/db/index
Override audit index path
MCP_AUTH_CONFIG
—
Inline auth.json content (read-only, writes are no-ops). Same idea as MCP_SERVERS_CONFIG.
MCP_AUTH_PATH
~/.config/mcp/auth.json
Override OAuth token storage (file path)
MCP_CLASSIFIER_CACHE
~/.config/mcp/tool-classification.json
Override classifier cache
Kubernetes
See the dedicated Kubernetes deployment guide for complete manifests with probes, security context, audit logging, and operational guidance.
Quick start:
Shell alias
For day-to-day use, create an alias so mcp works like a native command:
Then use it normally:
Piping JSON
Pipe input via stdin with -i (Docker's interactive flag):
Pinning a version
For CI/CD or reproducible environments, pin to a specific version:
Limitations
Stdio servers only work if the runtime is available inside the container. The default image includes only the
mcpbinary andca-certificates. Servers that requirenpx,python, or other runtimes won't work unless you build a custom image. HTTP servers (configured withurl) work out of the box.OAuth browser flow doesn't work in Docker. For HTTP servers that need OAuth, run
mcp add <server>on your host first to complete authentication, then either mount the config directory (which includesauth.json), setMCP_AUTH_PATHto a mounted volume, or pass the JSON inline viaMCP_AUTH_CONFIG(read-only — useful for read-only containers and Kubernetes Secrets).Audit logging is disabled by default in the Docker image because
scratchimages have no writable filesystem. UseMCP_AUDIT_OUTPUT=stdoutto stream to the container log driver, or mount a volume and setMCP_AUDIT_ENABLED=true.
Last updated
Was this helpful?