{"id":18536,"library":"mcp-server-docker","title":"Docker Command Runner MCP Server","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/adamdude828/mcp-server-docker","tags":["javascript","mcp","docker","model-context-protocol","cli","container","typescript"],"install":[{"cmd":"npm install mcp-server-docker","lang":"bash","label":"npm"},{"cmd":"yarn add mcp-server-docker","lang":"bash","label":"yarn"},{"cmd":"pnpm add mcp-server-docker","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Docker engine API client used to execute commands in containers","package":"dockerode","optional":false}],"imports":[{"note":"Package exports a named class, not a default export.","wrong":"import DockerServer from 'mcp-server-docker'","symbol":"DockerServer","correct":"import { DockerServer } from 'mcp-server-docker'"},{"note":"Package is ESM-only—no CommonJS support.","wrong":"const { runCommand } = require('mcp-server-docker')","symbol":"runCommand","correct":"import { runCommand } from 'mcp-server-docker'"},{"note":"TypeScript type export, not a runtime value. Use `import type` to avoid runtime inclusion.","wrong":"import { DockerConfig } from 'mcp-server-docker'","symbol":"DockerConfig","correct":"import type { DockerConfig } from 'mcp-server-docker'"}],"quickstart":{"code":"import { DockerServer } from 'mcp-server-docker';\n\nconst server = new DockerServer({\n  allowedContainers: process.env.ALLOWED_CONTAINERS?.split(',') ?? [\n    'app:app_container',\n  ],\n  defaultService: process.env.DEFAULT_SERVICE ?? 'laravel_app',\n  commandTimeout: parseInt(process.env.COMMAND_TIMEOUT ?? '300000', 10),\n});\n\nserver.start().catch((err: Error) => {\n  console.error('Failed to start server:', err);\n  process.exit(1);\n});","lang":"typescript","description":"Initialize and start the Docker MCP server using environment variables for configuration."},"warnings":[{"fix":"Replace direct instantiation with `new DockerServer(config).start()`.","message":"v1.0.0 removed support for STDIO transport as default; must now explicitly use start() method.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Set environment variable like `ALLOWED_CONTAINERS=web:web-1,worker:celery-1` or pass array to constructor. Do not use spaces.","message":"ALLOWED_CONTAINERS must be a comma-separated list of 'service:container' pairs. If misconfigured, no containers will be allowed.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set COMMAND_TIMEOUT environment variable or pass commandTimeout in config (milliseconds).","message":"Default command timeout is 300000 ms (5 minutes). Long-running commands may timeout.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass `defaultService` in constructor config object instead of relying on environment variable.","message":"The `DEFAULT_SERVICE` environment variable is deprecated in favor of using the `defaultService` option in constructor.","severity":"deprecated","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"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.","cause":"The service name provided does not match any service defined in docker-compose.yml.","error":"Error: \"Service not found\""},{"fix":"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`).","cause":"The Docker socket (/var/run/docker.sock) is not accessible or Docker is not running.","error":"Error: \"Cannot connect to Docker daemon\""},{"fix":"Increase COMMAND_TIMEOUT environment variable or commandTimeout in config. Alternatively, break the command into smaller parts.","cause":"The command ran longer than the configured timeout (default 5 minutes).","error":"Error: \"Command timed out\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}