docker-vm-mcp
Provides full lifecycle management of Docker containers as lightweight VMs, including create, start, stop, restart, delete, exec commands, logs, stats, and SSH credential management through the local Docker daemon.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@docker-vm-mcpCreate a VM called 'test' with 1 CPU and 512MB RAM"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
docker-vm-mcp
Built by sundar.
An MCP server that gives an AI agent full VM lifecycle control — create, SSH
login, exec commands, stop/start/restart, delete, logs, and resource stats —
over lightweight "VMs" backed by Docker containers. Each VM is a real Ubuntu
system running an actual sshd, with sudo and a persistent disk, so it
behaves like a normal box you can log into — no cloud account and no nested
virtualization required. The server itself is containerized and published as
a Docker image, and is driven entirely through the Model Context Protocol.
Once this is set up you can just ask Claude things like:
"Create a VM called dev-box with 2 CPUs and 2GB RAM"
"SSH me into dev-box" / "What's the SSH login for dev-box?"
"Install nginx on dev-box and start it"
"Stop dev-box" / "Delete dev-box"
"List all my VMs"
and Claude will drive the whole lifecycle through the tools below.
How it works
Each "VM" is a Docker container built from a small Ubuntu 22.04 image
(vm-image/Dockerfile) that runs a real sshd, has sudo, and gets a named
Docker volume mounted as its home directory (so files survive stop/restart,
similar to an EBS volume attached to an EC2 instance). The MCP server itself
talks to your local Docker daemon over /var/run/docker.sock — it does not
run VMs itself, it drives your existing Docker Desktop installation.
Claude <--MCP/stdio--> docker-vm-mcp container <--docker.sock--> Docker Desktop
|
vm-dev-box (Ubuntu + sshd)
vm-staging (Ubuntu + sshd)
...Related MCP server: Docker MCP Server
Prerequisites
Docker Desktop installed and running on your Mac
Node.js 20+ only if you want to run the server outside Docker (not required)
1. Build
From this folder:
docker build -t docker-vm-mcp:latest .This builds only the MCP server image. The VM base image
(docker-vm-mcp/vm-base:latest) is built automatically the first time you
call vm_create — the server bundles vm-image/Dockerfile and builds it
against your Docker daemon on first use. You can also pre-build it yourself:
docker build -t docker-vm-mcp/vm-base:latest ./vm-image2. Run / register with Claude Desktop
MCP servers over stdio are launched by the client (Claude Desktop), not run
standalone. Add this to your Claude Desktop config
(~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"docker-vm-mcp": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-v", "docker-vm-mcp-state:/data",
"docker-vm-mcp:latest"
]
}
}
}Then restart Claude Desktop. The two mounts are both required:
/var/run/docker.sock— lets the server create/start/stop/exec into VM containers on your machine.docker-vm-mcp-state(a named volume) — where the server remembers each VM's generated SSH password across restarts. Without it,vm_ssh_infoloses saved passwords whenever the MCP server container restarts (the VM containers themselves are unaffected — they keep running).
You can sanity-check the image runs and can reach Docker before wiring it into Claude Desktop:
docker run -i --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v docker-vm-mcp-state:/data \
docker-vm-mcp:latest
# should print nothing and just wait on stdin (that's correct — it's
# speaking MCP, not a REPL). Ctrl+C to exit.Tools this server exposes
Tool | What it does |
| Create + start a new VM. Params: |
| List all managed VMs with status and SSH port. |
| Start a stopped VM. |
| Stop a running VM (disk is preserved). |
| Reboot a VM. |
| Permanently delete a VM (and its disk volume, unless |
| Run a shell command inside a VM directly via Docker (no SSH needed). |
| Get the SSH command, host, port, user, and password for a VM. |
| Set or regenerate a VM's SSH password (also resyncs |
| Tail a VM's console/system log output. |
| Live CPU % / memory usage for a running VM. |
Logging in yourself
Every VM binds its SSH port to your Mac, so once Claude creates one you can also just SSH in directly from a terminal:
ssh vmuser@localhost -p <port> # port and password from vm_create / vm_ssh_infoPass sshPublicKey to vm_create (your ~/.ssh/id_ed25519.pub contents) to
skip the password and log in with your key instead.
Publishing this image
To share it (e.g. so a teammate or another machine can just docker pull
instead of building from source):
docker tag docker-vm-mcp:latest <your-dockerhub-username>/docker-vm-mcp:latest
docker push <your-dockerhub-username>/docker-vm-mcp:latestNothing secret is baked into the image — credentials are generated per-VM at
runtime and stored only in the local docker-vm-mcp-state volume on
whichever machine runs the container. It's safe to publish.
Security notes (read before exposing this beyond your own machine)
The Docker socket mount is root-equivalent. Anything with access to
/var/run/docker.sockcan control every container on your machine, not just the VMs this tool creates. Only run this image with that mount on a machine you trust, and never expose the MCP server itself (or a port to it) to untrusted callers.SSH passwords are stored in plaintext in the
docker-vm-mcp-statevolume (/data/credentials.json) sovm_ssh_infocan hand them back to you later. That's fine for a personal local dev tool; don't repurpose this for multi-tenant or production use without hardening it (e.g. switch to key-only auth and stop persisting passwords).VM containers publish their SSH port on
0.0.0.0by default (Docker's default), meaning other devices on your local network could reach it if your firewall allows it. Pass an explicitsshPortand firewall it, or bind to127.0.0.1only, if that matters to you (edit thePortBindingshost IP insrc/tools/createVm.tsto127.0.0.1and rebuild).
Real-world validation: ServiceNow Discovery
This project has been used as a live Discovery target for a real ServiceNow instance, via a locally-run MID Server (also Dockerized) — proof it behaves like a genuine SSH-reachable Linux host, not just a toy:
Standard Discovery, MID Server → VM over the Mac's LAN IP and the VM's published SSH port (e.g.
192.168.x.x:<port>) — successfully created acmdb_ci_linux_serverCI with hostname, OS, RAM, and CPU details pulled live over SSH.Quick Discovery also works the same way.
Since the MID Server container and the VM container both sit on Docker's default
bridgenetwork, they can alternatively reach each other directly by internal container IP on the standard SSH port (22) — no published port needed, and no dependency on the Mac's LAN IP (which changes across networks).One quirk worth knowing if you try this yourself: discovered CPU manufacturer shows as "Apple". That's correct, not a bug — Docker Desktop for Mac runs containers inside a
linuxkitVM booted directly on the host's own Apple Silicon chip, so SSH probes reading/proc/cpuinfosee the real hardware underneath, the same as they would on any other host.
Project structure
docker-vm-mcp/
├── Dockerfile # MCP server image
├── package.json
├── tsconfig.json
├── vm-image/
│ └── Dockerfile # base "VM" image (Ubuntu + sshd), built on first vm_create
└── src/
├── index.ts # MCP server entrypoint (stdio transport)
├── docker.ts # Docker client, image-build, container lookup helpers
├── state.ts # local credential store (/data/credentials.json)
├── util.ts # exec/log demuxing helpers
└── tools/
├── createVm.ts
├── listVms.ts
├── startVm.ts
├── stopVm.ts
├── restartVm.ts
├── deleteVm.ts
├── execVm.ts
├── sshInfo.ts
├── setPassword.ts
├── logsVm.ts
└── statsVm.tsA note on how this was verified
This was built and type-checked in a sandboxed environment without access to
the npm registry, so npm install / npm run build could not be run
end-to-end here. The TypeScript was checked against Node's own type
definitions with no errors; the only remaining checks are against
@modelcontextprotocol/sdk, dockerode, and zod's own types, which
weren't installable in that sandbox. Run this once after copying the project
to your Mac, before your first docker build:
npm install
npm run buildIf tsc reports anything beyond what's already handled above, it's most
likely a version-specific API shift in @modelcontextprotocol/sdk (it's a
fast-moving package) — the fix is almost always a small adjustment to the
import paths in src/index.ts (@modelcontextprotocol/sdk/server/mcp.js /
.../server/stdio.js) to match whatever version npm install resolved.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that allows managing Docker containers through natural language, enabling users to compose, introspect, and debug containers without running commands themselves.736GPL 3.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables managing Docker containers through natural language commands, allowing users to create, list, and delete containers. It facilitates automated container orchestration and integrates with VS Code via the Cline extension.163MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for VMware vSphere/vCenter operations, enabling natural language control of VMs, hosts, and infrastructure.Apache 2.0
- AlicenseBqualityDmaintenanceAn AI-powered MCP server for managing Docker infrastructure, enabling creation, deployment, and lifecycle management of containerized services with automated DNS and SSL.10MIT
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for generating rough-draft project plans from natural-language prompts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/suvenkat79/docker-vm-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server