DockerBro
DockerBro is a proper MCP-compliant Docker management server. Speaks JSON-RPC 2.0 over stdin/stdout and communicates with the Docker daemon via /var/run/docker.sock.
Works with Zed, Claude, Cursor, VS Code, and any other MCP-compatible AI editor.
Features
| Tool | What it does | Safety |
|---|---|---|
list_containers |
List all containers with status, image, ports | Read-only |
inspect_container |
Detailed container info (network, mounts, env) | Read-only |
start_container |
Start a stopped container | Reversible |
stop_container |
Stop a running container | Reversible |
restart_container |
Restart a container | Reversible |
remove_container |
Remove a container (with optional force) | ⚠️ Destructive |
logs_container |
Get recent log output | Read-only |
exec_container |
Run a command inside a running container | ⚠️ Destructive |
list_images |
List local Docker images | Read-only |
pull_image |
Pull an image from a registry | Reversible |
run_container |
Run a new container with ports, env, etc. | Reversible |
remove_image |
Remove a local image | ⚠️ Destructive |
docker_compose_ps |
List Compose services | Read-only |
docker_compose_up |
Start Compose services | Reversible |
docker_compose_down |
Stop and remove Compose services | ⚠️ Destructive |
docker_compose_logs |
Get Compose service logs | Read-only |
Pre-approving tools
Each tool is annotated with MCP spec annotations (readOnlyHint, destructiveHint, idempotentHint) so spec-aware clients (Claude Code, Cursor, etc.) can auto-approve read-only tools without prompting.
You can also restrict tools at the server level via environment variables, enforced before anything reaches the client:
| Env var | Effect |
|---|---|
DOCKER_MCP_ALLOW_TOOLS |
Comma-separated allowlist — only these tools are exposed and callable |
DOCKER_MCP_DENY_TOOLS |
Comma-separated denylist — always blocked (deny wins over allow) |
Example: only safe read-only tools
Pass the env var in your Zed config (add to the env object):
"env": {
"DOCKER_MCP_ALLOW_TOOLS": "list_containers,inspect_container,logs_container,list_images,docker_compose_ps,docker_compose_logs"
}
If a tool is not pre-approved, the server returns an error:
Tool 'remove_container' is not pre-approved (blocked by server allow/deny config).
Note: Client-side approval (e.g. Zed's
agent.tool_permissions) and server-side pre-approval are independent. The server-side list controls which tools are visible and callable at all; the client controls which of those require a confirmation prompt.
Setup
Option A: Run locally (recommended for Zed)
-
Install dependencies:
pip3 install docker
-
Make sure Docker is running and
/var/run/docker.sockis accessible. -
Test it works:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | python3 docker_mcp_server.py
-
Add to Zed (see Zed Configuration below).
Option B: Run in Docker container
docker build -t dockerbro .
docker run --rm -i \
-v /var/run/docker.sock:/var/run/docker.sock \
dockerbro
Zed Configuration
Add this to ~/.config/zed/settings.json inside the root object:
"context_servers": {
"dockerbro": {
"command": "python3",
"args": ["/Users/YOUR_USERNAME/Desktop/docker-mcp-server/docker_mcp_server.py"],
"env": {
"DOCKER_MCP_LOG": "/tmp/docker-mcp-server.log"
}
}
}
Optionally, restrict tools server-side by adding env vars:
"env": {
"DOCKER_MCP_LOG": "/tmp/docker-mcp-server.log",
"DOCKER_MCP_DENY_TOOLS": "remove_container,remove_image,exec_container,docker_compose_down"
}
Replace YOUR_USERNAME with your macOS username.
Then reload Zed (cmd-shift-p > Reload Window). The agent will have 16 Docker tools available.
Claude Desktop Configuration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"dockerbro": {
"command": "python3",
"args": ["/Users/YOUR_USERNAME/Desktop/docker-mcp-server/docker_mcp_server.py"],
"env": {
"DOCKER_MCP_LOG": "/tmp/docker-mcp-server.log"
}
}
}
}
Testing
Via terminal (pipe JSON-RPC)
# Initialize
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | python3 docker_mcp_server.py
# List tools
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | python3 docker_mcp_server.py
# Call a tool
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_containers","arguments":{"all":true}}}' | python3 docker_mcp_server.py
Via MCP Inspector
npx @modelcontextprotocol/inspector python3 docker_mcp_server.py
Architecture
AI Editor (Zed/Claude/Cursor)
| (stdin/stdout: JSON-RPC 2.0)
v
docker_mcp_server.py
| (Python docker SDK)
v
/var/run/docker.sock
|
v
Docker Daemon
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dockerbro-1.0.0.tar.gz.
File metadata
- Download URL: dockerbro-1.0.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ed8164914424ffc2070311835ef08388831fd1df80b0c45cb6081789146e770
|
|
| MD5 |
f0b15a58c04bebba49a9bf630b1c0e2b
|
|
| BLAKE2b-256 |
65ed013a85ead76d4e3331ec503ad443aa974f36b4ec820c3e0e92d7fd700376
|
File details
Details for the file dockerbro-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dockerbro-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
650187543a21b98524dfe1bd9cf537504cd3c826d1b237c4a834dfe760aff820
|
|
| MD5 |
1c1e76f8a89341a03690aaf92a75342c
|
|
| BLAKE2b-256 |
26a0c3b2962d035c8235e30ffafb6fb99719ec1ff3e046c3fc3816577a958c76
|