Open-source MCP server orchestration platform. Container-based isolation, secrets management, call tracing, and a centralized proxy for AI tool access via the Model Context Protocol.
Docker MCP Gateway is a Docker CLI plugin (docker mcp) that manages the lifecycle of
Model Context Protocol servers running in isolated Docker containers. It acts as a centralized proxy,
aggregating tools from multiple MCP servers behind a single endpoint that AI clients connect to.
The gateway follows a "no build step" philosophy for MCP servers -- each server is a self-contained Docker image with embedded metadata. The gateway handles all lifecycle management, secret injection, and protocol routing so individual servers remain simple and focused on tool implementation.
The gateway is the central nervous system of the platform. It presents a unified MCP interface to clients while internally managing a fleet of containerized MCP servers. Tool calls are routed to the correct backend server, and responses are aggregated transparently.
When a client sends tools/list, the gateway fans out to every connected server, collects their tool inventories, and returns a single merged list. Clients see one flat namespace.
The tool registry maps each tool name to its owning server. When tools/call arrives, the router resolves the target container and forwards the request via stdio.
Requests and responses pass through a configurable interceptor pipeline. Built-in interceptors handle logging, call tracing, and request validation before routing.
Profiles can restrict which tools are exposed per server. This prevents accidental exposure of dangerous tools and enables least-privilege configurations.
Each MCP server runs in its own Docker container with minimal host privileges. The gateway
manages the full container lifecycle including resource allocation, network policy, and
cleanup. Containers are ephemeral by default and can be retained with the --keep flag.
| Isolation Layer | Mechanism | Configuration |
|---|---|---|
| Process | Each server runs in its own PID namespace inside a Docker container | Default: isolated. No host PID sharing. |
| Network | Containers get restricted network access; can be fully blocked with --block-network |
Per-server network policy via profiles |
| Filesystem | Read-only root filesystem by default. Explicit volume mounts for data access. | Configurable mounts via server metadata labels |
| Resources | CPU and memory limits enforced by Docker cgroups | Default: 1 CPU, 2GB RAM. Customizable per server. |
| Secrets | Injected at runtime, never baked into images or environment variables | Docker Desktop secrets store or .env fallback |
| Image Integrity | Signature verification for server images before execution | --block-unsigned flag for strict mode |
MCP server images can embed their configuration via the io.docker.server.metadata
Docker label. This label contains the server name, description, command, environment variables,
required secrets, and config schemas. The gateway reads this at startup -- no external catalog
entry is required.
The gateway provides a layered secrets management system that keeps credentials out of
environment variables and image layers. It supports Docker Desktop's native secrets store,
local .env file fallback, and built-in OAuth token flows for services that
require browser-based authentication.
Primary secrets backend. Credentials are stored encrypted in Docker Desktop's credential store and injected into containers at startup time.
For environments without Docker Desktop (Docker CE, WSL2), the gateway reads secrets from a local .env file as a fallback mechanism.
Built-in OAuth support for services like GitHub and Slack. The gateway manages the browser-based auth flow and stores tokens for subsequent container starts.
The secretsscan package detects accidentally exposed credentials in server configurations and image metadata before containers launch.
The MCP protocol defines a request/response pattern for tool discovery and invocation. The gateway acts as an MCP server to clients and an MCP client to backend servers, performing protocol translation and request fan-out transparently.
The gateway's interceptor system provides built-in call tracing. Every tool invocation
is logged with its call ID, tool name, arguments, result, and duration. The
telemetry package provides structured metrics, while the logs
package handles persistent log storage and retrieval.
When a backend server's tool inventory changes (new tools added, tools removed),
it sends a tools/list_changed notification. The gateway catches this,
re-queries the affected server, updates its merged registry, and propagates the
change notification upstream to all connected clients.
Profiles are the primary organizational unit -- named collections of MCP servers with per-server configuration and tool allowlists. Catalogs are OCI-based registries that distribute pre-configured server definitions. Together they enable shareable, reproducible AI tool environments.
| Reference Type | Format | Description |
|---|---|---|
| Catalog | catalog://mcp/docker-mcp-catalog/github |
References a server definition from a registered catalog. Default catalog ships with Docker Desktop. |
| OCI Image | docker://my-server:latest |
Direct reference to a Docker image. Image must include MCP server metadata label. |
| MCP Registry | https://registry.modelcontextprotocol.io/v0/servers/<id> |
Fetches server definition from the official MCP registry. Resolved to a Docker image at runtime. |
| Local File | file://./server.yaml |
YAML file defining the server locally. Useful for development and testing. |
The codebase is organized as a Go module under cmd/docker-mcp (CLI entry point)
and pkg/ (library packages). Below is the internal dependency graph showing how
the major packages compose into the gateway system.
Core gateway server implementation. Handles client connections, tool aggregation, request routing, and the interceptor pipeline. The central orchestrator.
Pure MCP protocol implementation. JSON-RPC message types, tool schemas, resource definitions, and prompt templates conforming to MCP spec 2025-11-25.
Docker Engine API client. Container creation, lifecycle management, log streaming, resource limits, and network configuration.
Catalog management for server discovery. Supports multiple catalog sources, OCI push/pull, and the Docker MCP Catalog as a default source.
Middleware-style request/response interceptors. Pluggable chain for logging, tracing, rate limiting, and custom transformations on MCP messages.
OAuth 2.0 client with browser-based authorization code flow. Manages token refresh, storage, and injection for servers requiring OAuth credentials.
The gateway supports three transport modes for client-to-gateway communication. The transport between the gateway and backend servers is always stdio (stdin/stdout of the container process). Client-facing transport is configurable.
| Transport | Clients | Protocol | Use Case |
|---|---|---|---|
| stdio | Single | stdin/stdout pipes | Default mode. Direct integration with Claude Desktop, VS Code, Cursor via MCP client config. |
| SSE | Multiple | HTTP Server-Sent Events | Multi-client access. Gateway listens on a configurable port. Clients subscribe to event streams. |
| Streaming | Multiple | HTTP request/response | HTTP-based transport with configurable ports. Supports concurrent multi-client access. |
The gateway can run as a Docker Compose service itself, with the Docker socket mounted
as a volume (/var/run/docker.sock). This enables deployment alongside
other services in a development stack, with the gateway managing sibling containers
on the same Docker engine.
The gateway ships as a Docker CLI plugin (docker mcp) built from
cmd/docker-mcp. It also works as a standalone binary for environments
without Docker Desktop. Commands organize around profiles, catalogs, gateways, and tools.
Create, list, and configure profiles. Add servers with specific reference types. Enable/disable individual tools per server. Set server-specific config via dot notation.
Manage server catalogs. Push profiles to OCI registries for team sharing. Pull shared catalogs. Add third-party catalog sources beyond Docker's default.
Start the gateway with a specific profile and transport mode. Monitor running gateway status. Resource limits, network blocking, and watch mode for config auto-reload.
List all available tools across running servers. Inspect tool schemas and documentation. Directly invoke tools from the command line for testing and debugging.
The plugin installs to ~/.docker/cli-plugins/docker-mcp via
make docker-mcp. Requires Go 1.24+ for development builds.
Docker Desktop 4.59+ includes the MCP Toolkit with pre-built binaries.
The environment variable CLAUDE_CONFIG_DIR can override the
default Claude Code config path for separate installations.