MCP Docker Server

Category Status
Build & CI CI CodeQL Pre-commit Documentation codecov
Security OpenSSF Scorecard Bandit Dependabot
Package GitHub release PyPI version
Technology Python 3.11-3.14 Docker License: MIT Code style: ruff

A local Model Context Protocol server for Docker visibility and light lifecycle control.

12 tools | stdio transport only | no destructive Docker operations

Quick Start

Claude Code:

claude mcp add --transport stdio docker uvx mcp-docker@latest

Codex:

codex mcp add docker -- uvx mcp-docker@latest

Claude Desktop — add to claude_desktop_config.json:

{
  "mcpServers": {
    "docker": {
      "command": "uvx",
      "args": ["mcp-docker"]
    }
  }
}

The Docker socket is auto-detected for your OS. This package intentionally runs over stdio only; it is not a network-exposed Docker administration service.

Tools

Container

Tool Description Safety
docker_list_containers List containers with filters Safe
docker_inspect_container Detailed container info Safe
docker_container_logs Get container logs Safe
docker_container_stats Resource usage stats Safe
docker_start_container Start container Moderate
docker_stop_container Stop container gracefully Moderate
docker_restart_container Restart container Moderate

Image

Tool Description Safety
docker_list_images List images Safe
docker_inspect_image Image details Safe

Network

Tool Description Safety
docker_list_networks List networks Safe

Volume

Tool Description Safety
docker_list_volumes List volumes Safe

System

Tool Description Safety
docker_version Docker version info Safe

Safety

Safe tools are read-only and always allowed. Moderate tools are reversible lifecycle operations and are allowed by default.

# Read-only mode: list, inspect, logs, stats, version only
SAFETY_ALLOW_MODERATE_OPERATIONS=false

The package does not expose destructive tools such as remove, prune, build, push, or exec.

Configuration

Variable Default Description
DOCKER_BASE_URL Auto-detected Docker daemon socket URL
DOCKER_TIMEOUT 60 Docker operation timeout in seconds
SAFETY_ALLOW_MODERATE_OPERATIONS true Allow reversible start/stop/restart tools
SAFETY_DEFAULT_TOOL_TIMEOUT 30 Tool timeout in seconds, 0 disables
SAFETY_MAX_RESPONSE_BYTES 1048576 Maximum tool response size, 0 disables
MCP_LOG_LEVEL INFO Logging level
MCP_JSON_LOGGING false Emit JSON logs
MCP_DEBUG_MODE false Show unsanitized errors for local debugging

Development

uv sync --group dev
uv run pytest tests/unit/ -v
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run mypy src/mcp_docker/

Requirements

  • Python 3.11+
  • Docker 20.10+
  • Key dependencies: fastmcp, docker, pydantic, pydantic-settings, loguru

License

MIT — see LICENSE.