Docker MCP Server
Provides tools for managing Docker on the user's behalf: listing, creating, running, recreating, starting, stopping, removing, inspecting, and monitoring containers; reading logs, stats, health, and processes; and working with Buildx builders, build history, cache, and build logs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Docker MCP Server list my running containers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
đ Docker MCP server
An MCP server for managing Docker with natural language â maintained, with Buildx tooling and bounded, LLM-friendly output.
uvx --from mcp-server-docker-dboeckli mcp-server-dockerMaintenance status: the upstream project
ckreiling/mcp-server-dockerlast releasedv0.3.0and is effectively unmaintained. This repository is its maintained continuation: it keeps the upstream Docker MCP surface and is released independently asmcp-server-docker-dboeckli(PyPI) andghcr.io/dboeckli/mcp-server-docker(GHCR).Credit for the original server belongs to Christian Kreiling and the upstream contributors. Maintained by dboeckli; not affiliated with or endorsed by the upstream maintainer, Docker, Inc., or the Model Context Protocol project. Fixes are maintained here only and are not contributed back upstream.
See the Quickstart below for Claude Desktop, container and source setups.
đ§ Why this repository exists
This repository keeps the upstream Docker MCP surface and adds what is needed to
run it from agent sandboxes and day-to-day LLM clients. It is based on upstream
main at 57a7df2 (v0.3.0) and is released independently as
mcp-server-docker-dboeckli (PyPI) and
ghcr.io/dboeckli/mcp-server-docker (GHCR).
The differences that matter in practice:
Buildx tooling: builders, build history, cache usage, inspection and build logs.
Bounded, LLM-friendly output: compact
summarylistings plus capped log and attached-run output withtruncated/bytesmetadata.More read-only tools: container health, processes, stats, events, disk usage, version and system info.
Read-only mode (
--read-only) for gateway allow-listing.Docker Desktop correctness: label filters in the CLI map form and unset filter fields omitted instead of sent as
null.Packaging: PyPI package, GHCR image and an independent release history.
This is an independent downstream project, not an upstream contribution channel: fixes are maintained here only and are not contributed back upstream. See docs/upstream-tracking.md for the repositories we monitor and CHANGELOG.md for release history.
Related MCP server: Docker MCP Server
đĒŠ What can it do?
đ Compose containers with natural language
đ Introspect & debug running containers
đ Manage persistent data with Docker volumes
â Who is this for?
Server administrators: connect to remote Docker engines for e.g. managing a public-facing website.
Tinkerers: run containers locally and experiment with open-source apps supporting Docker.
AI enthusiasts: push the limits of what an LLM is capable of!
Docker sandbox users: expose the host Docker daemon and Buildx to a sandbox through an MCP gateway without mounting the Docker socket.
đ´ What this repository adds
Buildx tools:
docker_buildx_list,docker_buildx_history, anddocker_buildx_logsClear tool error messages, including Docker and Buildx failures
A published container image:
ghcr.io/dboeckli/mcp-server-dockerA published PyPI package:
mcp-server-docker-dboeckliDocker/Buildx integration tests and coverage in CI
Automated dependency updates (Dependabot and Renovate)
đ Upstream tracking
We track the upstream base repository and, in addition, the X1pheR community
fork, which carries ready branches for several open upstream issues. Monitored
sources, the branch-to-issue map and the commands to check for new activity are
documented in docs/upstream-tracking.md.
đ§ą Use case: Docker sandbox
This server was originally designed for direct Docker management from an MCP client. It can also serve as the host-side bridge for a Docker sandbox (for example opencode-sandbox-kit):
The sandbox keeps its own isolated Docker daemon; the host Docker socket is not mounted into it and port
2375is not exposed.This server runs on the host and is registered with an MCP gateway (for example the
sbxMCP gateway).The sandbox reaches the gateway over MCP and only sees the tools the gateway allows.
Read-only tools (
docker_list_*,docker_fetch_container_logs,docker_buildx_*) can be allow-listed; write tools should stay behindaskor be denied.The Buildx tools added by this repository are meant for this setup: inspecting builders, build history and build logs from inside the sandbox.
This is not a sandbox boundary by itself: the host-side server still has access to the host Docker daemon. Use the gateway's permission rules and review them.
đī¸ Quickstart
Install
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
The package is published to PyPI as
mcp-server-docker-dboeckli.
That is fast to start (a wheel download, no clone and no build) and needs no
Git.
The PyPI name
mcp-server-dockerbelongs to the upstream project and stops at0.3.0. It does not contain the Buildx tools of this repository.
If you don't have uv installed, follow the installation instructions for your
system:
link
Then add the following to your MCP servers file:
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"--from",
"mcp-server-docker-dboeckli==0.11.0",
"mcp-server-docker"
]
}
}Every release attaches the built wheel and sdist. This works without PyPI and without cloning the repository:
uvx --from https://github.com/dboeckli/mcp-server-docker/releases/download/v0.11.0/mcp_server_docker_dboeckli-0.11.0-py3-none-any.whl \
mcp-server-dockerPins the Git tag and builds from source on first start. Use this only when you want to run unreleased commits; it needs Git and is slower to start than the PyPI or wheel install.
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/dboeckli/mcp-server-docker@v0.11.0",
"mcp-server-docker"
]
}
}Purely for convenience, the server can run in a Docker container. A prebuilt image is published to GHCR:
docker run -i --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/dboeckli/mcp-server-docker:0.11.0Alternatively, build the image locally:
docker build -t mcp-server-docker:0.11.0 .And then add the following to your MCP servers file:
"mcpServers": {
"mcp-server-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
"ghcr.io/dboeckli/mcp-server-docker:0.11.0"
]
}
}Note that we mount the Docker socket as a volume; this ensures the MCP server can connect to and control the local Docker daemon. The image does not include the Docker CLI, so the Buildx tools only work when the server runs where the CLI is installed.
đ Resources
The server exposes resource templates rather than enumerating currently-running containers:
docker://containers/{container_id}/logs(text/plain)docker://containers/{container_id}/stats(application/json)
Read either URI with a Docker container ID or name.
đ¨ Tools
Breaking in 0.8.0: every tool name is prefixed with
docker_so the flat MCP gateway namespace stays collision-free (for examplelist_containersis nowdocker_list_containers). Update gateway allow-lists and prompts that name tools directly. Resource URIs and thedocker_composeprompt are unchanged.
Containers
docker_list_containersdocker_create_containerdocker_run_containerdocker_recreate_containerdocker_start_containerdocker_fetch_container_logsdocker_stop_containerdocker_remove_containerdocker_container_inspectdocker_container_healthdocker_container_processesdocker_container_stats
docker_container_inspect redacts environment values like
docker_image_inspect. docker_container_health returns a compact summary
instead of the full inspect
payload: state, health status with the last health log entry, restart count,
exit code, OOMKilled, start/finish timestamps, image and command. It builds a
fresh response, so no environment value is included.
docker_container_processes is the equivalent of docker top.
docker_container_stats returns a one-shot CPU, memory, network and block-IO
snapshot (stream=false), so it never blocks a tool call; the
docker://containers/{container_id}/stats
resource stays available for clients that read resources.
docker_run_container with detach=false returns mode: "attached", the
decoded output, the original byte count (bytes) and a truncated flag.
Only the last 20 KiB of raw output are returned, so an attached process cannot
flood the client with unbounded text. ports accepts JSON arrays too, e.g.
{"80/tcp": 8080}, {"80/tcp": [8080, 8081]} for several host ports, or
{"80/tcp": ["127.0.0.1", 8080]} for a host IP and port.
docker_fetch_container_logs returns at most the last 20 KiB of raw log bytes,
split on newlines into logs, together with truncated and the original byte
count (bytes); invalid UTF-8 is replaced.
docker_recreate_container keeps its original stop/remove/run behaviour by
default. With preserve_configuration=true it rebuilds the container from its
inspected configuration instead: environment, mounts/volume identity, networks,
ports, labels, healthcheck and restart policy are preserved, the replacement
image is checked before anything is removed, and the original configuration is
restored if creating the replacement fails. In that mode pass only
container_id/name and optionally image (omitted image reuses the current
one); explicit overrides are rejected.
Every list tool returns a single JSON array. docker_list_containers,
docker_list_images and docker_list_volumes accept format: the default
summary returns a compact docker ps-style row (no health-check logs, nested
image object, labels or digests), while full returns the inspect-level object
with each health-check log entry capped at 500 characters. docker_list_containers
mirrors docker ps: without filters it returns the same containers as the CLI,
and a label filter is sent in the CLI's map form. That matters on Docker Desktop
hosts with the Kubernetes integration: the engine hides Kubernetes containers
from unfiltered listings but reveals them for a label filter, so
docker_list_containers {"all": true, "filters": {"label": ["io.kubernetes.pod.namespace=kube-system"]}} returns them just like
docker ps --filter label=.... Unset filter fields are not forwarded.
Images
docker_list_imagesdocker_pull_imagedocker_push_imagedocker_build_imagedocker_remove_imagedocker_image_inspectdocker_image_history
docker_image_inspect replaces environment values with <redacted>.
docker_image_history is not redacted: layer CreatedBy commands can contain
secrets baked into the image.
Buildx
docker_buildx_listdocker_buildx_dudocker_buildx_inspectdocker_buildx_historydocker_buildx_logs
These tools invoke the docker CLI, so the docker binary (with the Buildx
plugin) must be available on PATH. The container image built from this
repository does not include the Docker CLI, so the Buildx tools are only usable
when the server runs where the CLI is installed.
CLI output is decoded as UTF-8 with malformed bytes replaced by īŋŊ (U+FFFD),
independent of the host code page, so build logs with non-UTF-8 bytes cannot
crash a tool on Windows.
docker_buildx_logs accepts progress="plain" and progress="rawjson". The
tty mode needs a terminal, which a stdio MCP server never has, so the tool
rejects it with an explanatory error instead of calling the CLI.
System
docker_system_dfdocker_versiondocker_system_info
docker_system_df uses the docker CLI and reports the same summary as
docker system df, including reclaimable space. Pass verbose=true for the
per-image, per-container, per-volume, and build-cache detail.
docker_system_df and docker_system_info take their numbers straight from
the engine, while docker_list_containers mirrors docker ps. Some engines
(Docker Desktop's Kubernetes integration, for example) hide containers from
unfiltered container listings while still counting them in /info and
/system/df, so system_info.ContainersRunning can exceed the number of
containers returned without filters. Pass a label filter to
docker_list_containers to list them.
Events
docker_events_list
docker_events_list reports recent Docker events (die, oom, unhealthy,
restart loops) for a window that always ends now, so a call can never wait
for future
events:
window_seconds(default900, clamped to1..86400) is how far back to look. There is nountilparameter on purpose. The window end is rounded up to the next full second, so events from the current second are included.limit(default100, clamped to1..1000) keeps the newest events and setstruncated=truewhen the window holds more.filtersacceptstype,event,container,imageandlabel, each a list, and maps them to repeated--filter key=valuearguments.The CLI call itself is bounded too: if
docker eventsdoes not return in time, the events collected so far are returned withtruncated=trueandtruncated_reason="timeout"instead of a generic timeout error.
Like the Buildx tools, docker_events_list invokes the docker CLI and needs
it on PATH.
Networks
docker_list_networksdocker_network_inspectdocker_create_networkdocker_remove_network
docker_network_inspect returns the full network attributes, including driver,
IPAM configuration and connected containers.
Volumes
docker_list_volumesdocker_volume_inspectdocker_create_volumedocker_remove_volume
docker_volume_inspect returns the full volume attributes, including driver,
mountpoint, labels and options.
Both inspect tools apply the same environment redaction as
docker_container_inspect (<redacted>), so the reading posture stays uniform
even if the daemon adds a Config.Env section.
đ Prompts
đģ docker_compose
Optional: turns a project name and a container description into a plan+apply
loop for containers, volumes, and networks. Reusing an existing project name
lets the LLM see the current state, which is useful for cleanup.
This prompt is not required to use the server; the tools work directly without it.
đ Read-only mode
Start the server with --read-only, or set
MCP_SERVER_DOCKER_READ_ONLY=1, to expose only tools annotated with
readOnlyHint=true. Write and destructive tools are not registered at all:
they are absent from tools/list and calls to them return Unknown tool.
Default: all 36 tools.
Read-only: the 22 read-only tools, including all
docker_list_*, log, stats, inspect,docker_container_health,docker_events_list, disk-usage, and Buildx inspection tools.The container log/stats resources and the
docker_composeprompt remain available.
Example with uvx:
"args": [
"--from",
"git+https://github.com/dboeckli/mcp-server-docker@v0.11.0",
"mcp-server-docker",
"--read-only"
]Or with the environment variable:
"env": {
"MCP_SERVER_DOCKER_READ_ONLY": "1"
}For the sbx MCP gateway, append --read-only to the comma-separated --args
list, e.g. sbx mcp add docker --args "--from,...,mcp-server-docker,--read-only".
Read-only mode is a best-effort guardrail, not a sandbox boundary. The process still has host Docker access; keep gateway policy and sandbox isolation in place.
đ§ Disclaimers
Sensitive Data
DO NOT CONFIGURE CONTAINERS WITH SENSITIVE DATA. This includes API keys, database passwords, etc.
Any sensitive data exchanged with the LLM is inherently compromised, unless the LLM is running on your local machine.
If you are interested in securely passing secrets to containers, file an issue on this repository with your use-case.
Reviewing Created Containers
Be careful to review the containers that the LLM creates. Docker is not a secure sandbox, and therefore the MCP server can potentially impact the host machine through Docker.
For safety reasons, this MCP server doesn't support sensitive Docker options
like --privileged or --cap-add/--cap-drop. If these features are of interest
to you, file an issue on this repository with your use-case.
đ ī¸ Configuration
This server uses the Python Docker SDK's from_env method. For configuration
details, see
the documentation.
Connect to Docker over SSH
This MCP server can connect to a remote Docker daemon over SSH.
Simply set a ssh:// host URL in the MCP server definition:
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/dboeckli/mcp-server-docker@v0.11.0",
"mcp-server-docker"
],
"env": {
"DOCKER_HOST": "ssh://myusername@myhost.example.com"
}
}
}đ Changelog
Release notes and the history of notable changes live in CHANGELOG.md.
đģ Development
Prefer using Devbox to configure your development environment. The server uses
MCP Python SDK v2's high-level MCPServer API and can be inspected directly:
uv sync --all-groups
uv run mcp dev src/mcp_server_docker/server.py:app
# or: npx @modelcontextprotocol/inspector uv run mcp-server-dockerRun the hermetic test and lint suite without a Docker daemon:
uv run pytest
uv run pytest --cov=mcp_server_docker --cov-report=term-missing
uv run ruff format --check src tests
uv run ruff check src testsCI also writes target/reports/coverage.xml and target/reports/junit.xml
and runs SonarCloud analysis when the SONAR_TOKEN repository secret is
configured.
Run the Docker integration tests (requires Docker and Buildx):
uv run pytest -o addopts= -m integrationSee the devbox.json for helpful development commands.
After setting up devbox you can configure your Claude MCP config to use it:
{
"mcpServers": {
"docker": {
"command": "/path/to/repo/.devbox/nix/profile/default/bin/uv",
"args": [
"--directory",
"/path/to/repo/",
"run",
"mcp-server-docker"
]
}
}
}đ License
This project is distributed under the GNU General Public License v3.0 (GPL-3.0-only); see LICENSE.
It is a modified version of
ckreiling/mcp-server-docker.
Upstream copyright and authorship remain with Christian Kreiling and the
upstream contributors. Modifications in this repository are maintained by
dboeckli under the same license. See
NOTICE and CHANGELOG.md for the recorded changes.
This repository is not affiliated with or endorsed by the upstream maintainer, Docker, Inc., or the Model Context Protocol project.
Available Tools
36 toolsdocker_build_imageC
Build a Docker image from a Dockerfile
Inputs: tag (required), path (required), dockerfile. Returns: object
docker_buildx_duBRead-onlyIdempotent
Show Docker Buildx cache usage per builder
Inputs: builder, verbose. Returns: result
docker_buildx_historyCRead-onlyIdempotent
List Docker Buildx build records
Inputs: builder. Returns: result
docker_buildx_inspectCRead-onlyIdempotent
Inspect a Docker Buildx builder instance
Inputs: builder. Returns: result
docker_buildx_listBRead-onlyIdempotent
List Docker Buildx builder instances
Inputs: no named parameters. Returns: result
docker_buildx_logsCRead-onlyIdempotent
Show the logs of a Docker Buildx build record
Inputs: ref (required), builder, progress. Returns: result
docker_container_healthBRead-only
Summarise container health, restart count and exit state without environment values
Inputs: container_id (required). Returns: object
docker_container_inspectBRead-onlyIdempotent
Inspect a Docker container with environment values redacted
Inputs: container_id (required). Returns: object
docker_container_processesCRead-onlyIdempotent
List the processes running in a Docker container
Inputs: container_id (required). Returns: object
docker_container_statsARead-only
Show a one-shot CPU, memory, network and block-IO snapshot for a container
Inputs: container_id (required). Returns: object
docker_create_containerC
Create a new Docker container
Inputs: image (required), name, ports, detach, +7 more. Returns: object
docker_create_networkC
Create a Docker network
Inputs: name (required), driver, labels, internal. Returns: object
docker_create_volumeB
Create a Docker volume
Inputs: name (required), driver, labels. Returns: object
docker_events_listBRead-only
List recent Docker events for a bounded window, newest first
Inputs: limit, filters, window_seconds. Returns: object
docker_fetch_container_logsCRead-onlyIdempotent
Fetch logs for a Docker container
Inputs: container_id (required), tail. Returns: object
docker_image_historyCRead-onlyIdempotent
Show the layer history of a Docker image
Inputs: image (required). Returns: result
docker_image_inspectBRead-onlyIdempotent
Inspect a Docker image with environment values redacted
Inputs: image (required). Returns: object
docker_list_containersARead-onlyIdempotent
List all Docker containers (same container set as docker ps)
Inputs: all, format, filters. Returns: result
docker_list_imagesCRead-onlyIdempotent
List Docker images
Inputs: all, name, format, filters. Returns: result
docker_list_networksCRead-onlyIdempotent
List Docker networks
Inputs: filters. Returns: result
docker_list_volumesCRead-onlyIdempotent
List Docker volumes
Inputs: format. Returns: result
docker_network_inspectBRead-onlyIdempotent
Inspect a Docker network with environment values redacted
Inputs: network_id (required). Returns: object
docker_pull_imageC
Pull a Docker image
Inputs: repository (required), tag. Returns: object
docker_push_imageC
Push a Docker image
Inputs: repository (required), tag. Returns: object
docker_recreate_containerADestructive
Stop and remove a container, then run a new container. With preserve_configuration, rebuild from the inspected configuration and restore the original if replacement creation fails.
Inputs: name, image, ports, detach, +9 more. Returns: object
docker_remove_containerCDestructive
Remove a Docker container
Inputs: container_id (required), force. Returns: object
docker_remove_imageCDestructive
Remove a Docker image
Inputs: image (required), force. Returns: object
docker_remove_networkCDestructive
Remove a Docker network
Inputs: network_id (required). Returns: object
docker_remove_volumeCDestructive
Remove a Docker volume
Inputs: volume_name (required), force. Returns: object
docker_run_containerA
Run an image in a new Docker container (preferred over docker_create_container + docker_start_container)
Inputs: image (required), name, ports, detach, +7 more. Returns: object
docker_start_containerC
Start a Docker container
Inputs: container_id (required). Returns: object
docker_stop_containerB
Stop a Docker container
Inputs: container_id (required). Returns: object
docker_system_dfARead-onlyIdempotent
Show Docker disk usage, including reclaimable space
Inputs: verbose. Returns: object
docker_system_infoBRead-onlyIdempotent
Show curated Docker host and storage-driver diagnostics
Inputs: no named parameters. Returns: object
docker_versionARead-onlyIdempotent
Show the Docker server version
Inputs: no named parameters. Returns: object
docker_volume_inspectARead-onlyIdempotent
Inspect a Docker volume with environment values redacted
Inputs: volume_name (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogâĻ
TDQS
Scored across 36 tools
Each tool pairs a Docker resource with a distinct action, and descriptions clarify borderline cases (e.g., docker_run_container is explicitly 'preferred over create+start'). The only mild overlaps are docker_system_df vs docker_system_info vs docker_version and inspect vs health/stats/processes, but these resolve cleanly.
All tools use snake_case with a consistent docker_ prefix, making them predictable. There is a minor ordering inconsistency where some tools are verb_noun (docker_list_images, docker_remove_image) and others noun_verb (docker_image_inspect, docker_container_health), but grouping remains readable.
36 tools is on the heavy side (25+), though the breadth largely reflects Docker's genuinely wide surface across containers, images, networks, volumes, buildx, and system. Most tools earn their place, but a few could be consolidated (e.g., system_df/info, image history) to reduce the surface.
Coverage is strong: full container lifecycle (create/run/start/stop/remove/recreate/logs/stats/inspect), image build/pull/push/list/remove, and volume/network CRUD. Notable gaps include container exec, restart/pause, image tag, and network connect/disconnect, but agents can work around most of these.
Maintenance
Related MCP Connectors
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Read-only Linux server and Docker monitoring for AI assistants: CPU, memory, disk, network.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Free OpenAI-compatible inference with signed provenance receipts and 3 focused MCP tools.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables natural language interaction with Docker commands and operations. Supports container management, image operations, system information, and Docker Compose through conversational requests.141MIT
- AlicenseNot gradedqualityDmaintenanceEnables natural language management of Docker containers, images, networks, and volumes with support for both local and remote Docker engines. Features automated container composition, debugging capabilities, and persistent data management through an intuitive conversational interface.GPL 3.0
- AlicenseBqualityDmaintenanceEnables AI assistants to manage Docker containers and Kubernetes resources through natural language, supporting operations like container management, image building, and pod/deployment/service management.9MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to manage Docker containers and Compose stacks through natural language, including lifecycle operations, logs, stats, and secure remote access.2112 npm3MIT