
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A Model Context Protocol (MCP) server that enables AI agents to interact with Docker containers locally or remotely via SSH. Provides comprehensive Docker management capabilities including container operations, logs, monitoring, and cleanup.
Docker MCP is a MCP tool that help AI Agent interact with docker containers in a specific VM or local machine, so that user (who use AI Agent) can manage and troubleshoot containers without any docker knowledge.
Stack: NodeJS LTS, npm, dockerode, MCP.
The Docker MCP server supports connecting to remote Docker daemons via SSH. This allows you to manage Docker containers on remote VMs or servers from your local machine.
Set up SSH tunnel:
./scripts/setup-ssh-tunnel.sh your-remote-host
Connect via tunnel:
DOCKER_MCP_HOST=tcp://localhost:2375 node dist/index.js
Use the provided script to create an SSH tunnel:
# Using SSH config host
./scripts/setup-ssh-tunnel.sh my-vm
# Using explicit user@host
./scripts/setup-ssh-tunnel.sh ubuntu@192.168.1.100
# Then connect via tunnel
DOCKER_MCP_HOST=tcp://localhost:2375 node dist/index.js
Use the ssh:// protocol format for direct SSH connections to remote Docker daemons:
# Direct SSH connection using SSH config host
export DOCKER_MCP_HOST=ssh://my-vm
# Direct SSH connection with explicit host
export DOCKER_MCP_HOST=ssh://192.168.1.100
export DOCKER_MCP_USERNAME=ubuntu
export DOCKER_MCP_PRIVATE_KEY=~/.ssh/id_rsa
# Force local Docker daemon (default behavior)
export DOCKER_MCP_LOCAL=true
The server automatically reads SSH configuration from ~/.ssh/config. Define your remote hosts there:
Host my-vm
HostName 192.168.1.100
User ubuntu
Port 22
IdentityFile ~/.ssh/id_rsa
Then simply use:
export DOCKER_MCP_HOST=ssh://my-vm
📖 For detailed remote Docker setup instructions, see REMOTE_DOCKER.md
# Required - use ssh:// protocol format
export DOCKER_MCP_HOST=ssh://192.168.1.100 # SSH host with ssh:// prefix
export DOCKER_MCP_USERNAME=ubuntu # SSH username
# Optional
export DOCKER_MCP_PORT=22 # SSH port (default: 22)
export DOCKER_MCP_PRIVATE_KEY=~/.ssh/id_rsa # SSH private key path
export DOCKER_MCP_PASSPHRASE=mypassphrase # SSH key passphrase
export DOCKER_MCP_SOCKET_PATH=/var/run/docker.sock # Remote Docker socket
export DOCKER_MCP_TIMEOUT=10000 # Connection timeout (ms)
# No configuration needed - auto-detects local Docker
npm start
# Or explicitly force local
DOCKER_MCP_LOCAL=true npm start
# Uses SSH config for host details with ssh:// protocol
DOCKER_MCP_HOST=ssh://my-vm npm start
# Explicit configuration with ssh:// protocol
DOCKER_MCP_HOST=ssh://192.168.1.100 \
DOCKER_MCP_USERNAME=ubuntu \
DOCKER_MCP_PRIVATE_KEY=~/.ssh/id_rsa \
npm start
# Show configuration help
node dist/index.js --help
# Show current configuration
node dist/index.js --config
Based on the updated README.md with the added "Cleanup unused resources" feature, here's the updated and expanded tool list for your Docker MCP server:
The cleanup tools would utilize dockerode's built-in pruning methods:
docker.pruneImages() for unused imagesdocker.pruneVolumes() for unused volumesdocker.pruneNetworks() for unused networksdocker.pruneContainers() for stopped containersdocker.pruneBuilder() for build cachedocker-mcp/
├── src/
│ ├── index.ts # Main entry point - server setup and transport
│ ├── server/
│ │ ├── DockerMcpServer.ts # Main MCP server class
│ │ └── config.ts # Server configuration
│ ├── tools/
│ │ ├── index.ts # Tool registry/exports
│ │ ├── docker_container_list.ts
│ │ ├── docker_container_inspect.ts
│ │ ├── docker_container_start.ts
│ │ ├── docker_container_stop.ts
│ │ ├── docker_container_restart.ts
│ │ ├── docker_container_remove.ts
│ │ ├── docker_container_create.ts
│ │ ├── docker_container_logs.ts
│ │ ├── docker_container_logs_follow.ts
│ │ ├── docker_container_stats.ts
│ │ ├── docker_container_exec.ts
│ │ ├── docker_container_detect_restart_loops.ts
│ │ ├── docker_container_processes.ts
│ │ ├── docker_container_port_mappings.ts
│ │ ├── docker_container_file_changes.ts
│ │ ├── docker_container_export.ts
│ │ ├── docker_container_copy_from.ts
│ │ ├── docker_container_copy_to.ts
│ │ ├── docker_compose_up.ts
│ │ ├── docker_compose_down.ts
│ │ ├── docker_compose_pull.ts
│ │ ├── docker_compose_logs.ts
│ │ ├── docker_image_list.ts
│ │ ├── docker_image_pull.ts
│ │ ├── docker_image_remove.ts
│ │ ├── docker_image_inspect.ts
│ │ ├── docker_network_list.ts
│ │ ├── docker_network_inspect.ts
│ │ ├── docker_volume_list.ts
│ │ ├── docker_volume_inspect.ts
│ │ ├── docker_system_info.ts
│ │ ├── docker_system_version.ts
│ │ ├── docker_system_df.ts
│ │ ├── docker_cleanup_unused_images.ts
│ │ ├── docker_cleanup_unused_volumes.ts
│ │ ├── docker_cleanup_unused_networks.ts
│ │ ├── docker_cleanup_unused_containers.ts
│ │ ├── docker_cleanup_build_cache.ts
│ │ ├── docker_cleanup_all.ts
│ │ └── docker_cleanup_summary.ts
│ ├── services/
│ │ ├── DockerService.ts # Docker API wrapper using dockerode
│ │ └── ComposeService.ts # Docker Compose wrapper using dockerode-compose
│ ├── types/
│ │ ├── docker.ts # Docker-related type definitions
│ │ ├── mcp.ts # MCP-specific types
│ │ └── index.ts # Type exports
│ └── utils/
│ ├── validation.ts # Input validation helpers
│ ├── error.ts # Error handling utilities
│ └── logger.ts # Logging utilities
├── config/
│ ├── default.json # Default configuration
│ └── production.json # Production configuration
├── tests/
│ ├── tools/
│ │ ├── docker_container_*.test.ts
│ │ ├── docker_compose_*.test.ts
│ │ ├── docker_image_*.test.ts
│ │ ├── docker_network_*.test.ts
│ │ ├── docker_volume_*.test.ts
│ │ ├── docker_system_*.test.ts
│ │ └── docker_cleanup_*.test.ts
│ ├── services/
│ └── utils/
├── examples/
│ ├── stdio-server.ts # Example stdio server
│ ├── http-server.ts # Example HTTP server
│ └── client-example.ts # Example client usage
├── docker/
│ ├── Dockerfile # Container for the MCP server
│ └── docker-compose.yml # For testing with Docker
├── docs/
│ ├── API.md # Tool documentation
│ ├── SETUP.md # Setup instructions
│ └── EXAMPLES.md # Usage examples
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI
├── package.json
├── tsconfig.json
├── yarn.lock
├── .gitignore
├── .eslintrc.js
├── .prettierrc
└── README.md
To start the Docker MCP server:
# Development mode (with auto-reload)
npm run dev
# Production mode
npm run build
npm start
The server can be tested using JSON-RPC 2.0 requests via stdio. Here are some example commands:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_container_list", "arguments": {"all": true}}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_system_version", "arguments": {}}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_container_inspect", "arguments": {"containerId": "container_name"}}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_container_start", "arguments": {"containerId": "container_name"}}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_container_logs", "arguments": {"containerId": "container_name", "tail": 10, "timestamps": true}}}' | node dist/index.js
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "docker_container_stop", "arguments": {"containerId": "container_name"}}}' | node dist/index.js
The server provides the following MCP tools:
The server automatically detects the appropriate Docker socket path:
Local Docker:
~/.orbstack/run/docker.sock~/.docker/run/docker.sock/var/run/docker.sockRemote Docker:
/var/run/docker.sock (on remote host)DOCKER_MCP_SOCKET_PATH environment variableLocal Docker:
Remote Docker:
FAQs
A Model Context Protocol (MCP) server that enables AI agents to interact with Docker containers locally or remotely via SSH. Provides comprehensive Docker management capabilities including container operations, logs, monitoring, and cleanup.
We found that docker-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.