MCP server (v1.0.0) that executes commands inside Docker containers via Model Context Protocol. Provides a single `run_command` tool for running arbitrary commands in allowed Docker Compose service containers. Uses STDIO transport, supports container allowlisting via environment variables, configurable timeouts, and captures stdout/stderr. Minimal dependencies, ships TypeScript types. Released under MIT license. Key differentiator: purpose-built for MCP (Claude) integration rather than generic Docker exec wrappers. Requires Docker socket access and security relies on container isolation.
npm install mcp-server-dockerVerified import paths — ran on the pinned version, not inferred.
Initialize and start the Docker MCP server using environment variables for configuration.
Replace direct instantiation with `new DockerServer(config).start()`.
Set environment variable like `ALLOWED_CONTAINERS=web:web-1,worker:celery-1` or pass array to constructor. Do not use spaces.
Set COMMAND_TIMEOUT environment variable or pass commandTimeout in config (milliseconds).
Pass `defaultService` in constructor config object instead of relying on environment variable.
Verify the service name exists in your docker-compose.yml and that the Docker Compose project is running. Use `docker-compose ps` to list services.
Ensure Docker is installed and running. If using a remote host, set DOCKER_HOST environment variable or mount the socket volume (e.g., `-v /var/run/docker.sock:/var/run/docker.sock`).
Increase COMMAND_TIMEOUT environment variable or commandTimeout in config. Alternatively, break the command into smaller parts.