dockerbro

dockerbro

MCP server for managing Docker containers, images, and Compose services via natural language, with configurable tool permissions and safety annotations.

Category
访问服务器

README

DockerBro

DockerBro is a proper MCP-compliant Docker management server. Speaks JSON-RPC 2.0 over stdin/stdout and talks to your local Docker daemon.

Works with Zed, Claude, Cursor, VS Code, and any other MCP-compatible AI editor.

Runs on macOS, Linux, and Windows.

pip install dockerbro

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.


Requirements

  • Python 3.9+
  • Docker installed and running

Install

Option A: From PyPI (recommended — all platforms)

Platform Command
macOS / Linux pip3 install dockerbro
Windows pip install dockerbro
Any (if pip isn't on PATH) python3 -m pip install dockerbro

command not found: pip? On macOS and many Linux distros, Python 3 installs it as pip3. On Windows it's usually pip or py -m pip. When in doubt, python3 -m pip install dockerbro works everywhere.

This puts a dockerbro command on your PATH, so your editor config needs no file paths at all.

Verify it works:

dockerbro --version 2>/dev/null; echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | dockerbro

Option B: Run from source

git clone https://github.com/ramanailearning-cpu/dockerbro.git
cd dockerbro
pip install -e .

Option C: Run in a Docker container

Build it:

docker build -t dockerbro .

Run it — the socket mount differs per platform:

macOS / Linux:

docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock dockerbro

Windows (PowerShell):

docker run --rm -i -v //./pipe/docker_engine://./pipe/docker_engine dockerbro

Connecting to the Docker daemon

DockerBro auto-detects your daemon, so this usually needs zero configuration:

Platform Default endpoint
Linux /var/run/docker.sock
macOS (Docker Desktop) /var/run/docker.sock, or ~/.docker/run/docker.sock on 4.13+
Windows Named pipe //./pipe/docker_engine

To point at a different or remote daemon, set DOCKER_HOST in your config's env block:

"env": { "DOCKER_HOST": "tcp://192.168.1.50:2375" }

macOS Docker Desktop note: if you get a connection error, enable Settings → Advanced → Allow the default Docker socket, or set DOCKER_HOST to unix:///Users/YOUR_NAME/.docker/run/docker.sock.


Zed Configuration

Add this to your Zed settings file (Cmd-Shift-P → Open Settings on macOS, Ctrl-Shift-P on Linux/Windows):

"context_servers": {
  "dockerbro": {
    "command": "dockerbro",
    "env": {
      "DOCKER_MCP_LOG": "/tmp/dockerbro.log"
    }
  }
}

Restricting tools server-side

Optionally, add env vars to limit which tools are exposed:

"env": {
  "DOCKER_MCP_LOG": "/tmp/dockerbro.log",
  "DOCKER_MCP_DENY_TOOLS": "remove_container,remove_image,exec_container,docker_compose_down"
}

Reload Zed (Cmd-Shift-P on macOS / Ctrl-Shift-P on Linux or Windows → Reload Window). The agent will have 16 Docker tools available.

Windows note: If the dockerbro command isn't found by Zed, use the full path shown by where dockerbro in your terminal.


Claude Desktop Configuration

macOS

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "dockerbro": {
      "command": "dockerbro",
      "env": {
        "DOCKER_MCP_LOG": "/tmp/dockerbro.log"
      }
    }
  }
}

Linux

Edit ~/.config/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "dockerbro": {
      "command": "dockerbro",
      "env": {
        "DOCKER_MCP_LOG": "/tmp/dockerbro.log"
      }
    }
  }
}

Windows

Edit %APPDATA%\Claude\claude_desktop_config.json (paste the path into Explorer's address bar):

{
  "mcpServers": {
    "dockerbro": {
      "command": "dockerbro",
      "env": {
        "DOCKER_MCP_LOG": "C:\\Users\\YOU\\dockerbro.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"}}}' | dockerbro

# List tools
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | dockerbro

# Call a tool
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_containers","arguments":{"all":true}}}' | dockerbro

Via MCP Inspector

npx @modelcontextprotocol/inspector dockerbro

Architecture

AI Editor (Zed / Claude / Cursor / VS Code)
    |  (stdin/stdout: JSON-RPC 2.0)
    v
dockerbro  (Python)
    |  (Docker SDK)
    v
Docker Daemon

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选