{"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,"search_vec":"'access':76 'allow':30 'allowlist':40 'arbitrari':27 'built':62 'captur':47 'claud':65 'cli':90 'command':2,11,23,28 'compos':32 'configur':44 'contain':14,34,39,81,91 'context':17,88 'depend':50 'differenti':59 'docker':1,13,31,70,74,85 'environ':42 'exec':71 'execut':10 'generic':69 'insid':12 'integr':66 'isol':82 'javascript':83 'key':58 'licens':57 'mcp':4,6,64,84 'minim':49 'mit':56 'model':16,87 'model-context-protocol':86 'protocol':18,89 'provid':19 'purpos':61 'purpose-built':60 'rather':67 'releas':54 'reli':79 'requir':73 'run':22,26 'runner':3 'secur':78 'server':5,7 'servic':33 'ship':51 'singl':21 'socket':75 'stdio':36 'stdout/stderr':48 'support':38 'timeout':45 'tool':24 'transport':37 'type':53 'typescript':52,92 'use':35 'v1.0.0':8 'variabl':43 'via':15,41 'wrapper':72","created_at":"2026-04-25T07:38:49.565988+00:00","updated_at":"2026-04-25T07:38:49.565988+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.1","cli_name":"mcp-server-docker","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/adamdude828/mcp-server-docker","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/mcp-server-docker","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","ai-ml","llm-agents"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}