Skip to main content

Docker MCP server exposing Docker operations as MCP tools

Project description

Docker MCP Server

A Model Context Protocol (MCP) server that exposes Docker operations as tools — manage containers, images, compose services, volumes, and networks directly from Claude.

Installation

pip install docker-mcp

Or with uvx (no install needed):

uvx docker-mcp

MCP Configuration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

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

Claude Code

claude mcp add docker -- uvx docker-mcp

Or add manually to your project's .claude/settings.json:

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

Docker (SSE mode)

Run the server as a container and connect over HTTP:

docker run -d \
  -p 8000:8000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  ghcr.io/firasmosbahi/docker-mcp:latest

Then configure your MCP client to connect to http://localhost:8000/sse.

Available Tools

Containers

Tool Description
list_containers List containers (all=true includes stopped)
create_container Create a container without starting it
run_container Create and start a container in one step
start_container Start a stopped container
stop_container Stop a running container
restart_container Restart a container
remove_container Remove a container (force=true for running)
get_container_logs Get container logs (configurable tail lines)
exec_in_container Execute a command inside a running container
inspect_container Get full container details as JSON
container_stats Get CPU and memory usage for a container

Examples:

List all containers including stopped ones
→ list_containers(all=true)

Run an nginx container on port 8080
→ run_container(image="nginx", name="my-nginx", ports={"80/tcp": 8080}, detach=true)

Get the last 50 lines of logs from my-app
→ get_container_logs(container_id="my-app", tail=50)

Execute a command inside a container
→ exec_in_container(container_id="my-app", command="env")

Images

Tool Description
list_images List all local images with size
pull_image Pull an image from a registry
build_image Build an image from a Dockerfile
tag_image Tag an image with a new name
remove_image Remove an image
inspect_image Get full image details as JSON

Examples:

Pull the latest Alpine image
→ pull_image(image="alpine", tag="latest")

Build an image from the current directory
→ build_image(path="/my/project", tag="my-app:v1")

Tag an image for pushing to a registry
→ tag_image(image="my-app:v1", repository="myrepo/my-app", tag="v1.0.0")

Compose

Tool Description
compose_up Start services (detached by default)
compose_down Stop and remove services
compose_build Build or rebuild services
compose_restart Restart services
compose_ps List service status
compose_logs Get service logs

Examples:

Start all services in a project
→ compose_up(project_directory="/my/project")

Rebuild a specific service without cache
→ compose_build(project_directory="/my/project", service="api", no_cache=true)

Get logs for the web service
→ compose_logs(project_directory="/my/project", service="web", tail=100)

Volumes

Tool Description
list_volumes List all volumes
create_volume Create a named volume
remove_volume Remove a volume
inspect_volume Get volume details

Networks

Tool Description
list_networks List all networks
create_network Create a network
remove_network Remove a network
inspect_network Get network details
connect_container_to_network Connect a container to a network
disconnect_container_from_network Disconnect a container from a network

System

Tool Description
system_info Docker version, OS, container/image counts, disk usage
prune_containers Remove all stopped containers
prune_images Remove unused (dangling) images
prune_volumes Remove unused volumes
prune_networks Remove unused networks

Examples:

Check Docker system status and disk usage
→ system_info()

Free up space by removing unused resources
→ prune_containers()
→ prune_images()
→ prune_volumes()

Transport Modes

# stdio (default) — for MCP clients that manage the process
docker-mcp

# SSE — for HTTP-based MCP clients
docker-mcp --transport sse --port 8000

Requirements

  • Python 3.11+
  • Docker daemon running and accessible (Docker Desktop or Docker Engine)

Development

git clone https://github.com/firasmosbahi/docker-mcp
cd docker-mcp
poetry install
poetry run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docker_mcp_server-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docker_mcp_server-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file docker_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: docker_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.3.0

File hashes

Hashes for docker_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d97ec1e4fc41aa4493f01aba6be7776dff36fa848b6e83f7963511be8ab6badd
MD5 ada647762c93e99f2566ce8729c53850
BLAKE2b-256 13fcd5111a0a87cb49f08da57c81d20ff3a9e1fdccca75503eb16eb010838e4a

See more details on using hashes here.

File details

Details for the file docker_mcp_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docker_mcp_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/25.3.0

File hashes

Hashes for docker_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09430af49540a9cec6b7a472d76cc5160c49676c197d0b434c0c282fc1216adb
MD5 2199571fafcf0593c3a7651b212ae5cb
BLAKE2b-256 4e312efaa746a18065fa2fe8f9d63f2e5c6d2f70bbdcc60bb7d003d664ba2d42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page