mcp-docker-agentic
Click on "Deploy 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., "@mcp-docker-agentic Run ps aux in my-app container"
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.
mcp-docker-agentic
An MCP server for agentic Docker container operations. It uses the local docker binary, so authentication, networking, volumes, and context are whatever docker on your machine is configured for.
Concept
This is the Docker twin of mcp-ssh-agentic. Where the SSH server targets user@host[:port], this server targets a Docker container name or id. The tool names are parallel (ssh_* → docker_*) so existing muscle memory transfers across.
Related MCP server: Docker MCP Server
Running with npx
After release, the package is on npmjs and GitHub Packages as @jahrulnr/mcp-docker-agentic.
npmjs (simplest):
{
"mcpServers": {
"docker-agentic": {
"command": "npx",
"args": ["-y", "@jahrulnr/mcp-docker-agentic"]
}
}
}GitHub Packages (needs a PAT with read:packages in ~/.npmrc):
@jahrulnr:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_PAT{
"mcpServers": {
"docker-agentic": {
"command": "npx",
"args": ["-y", "--registry=https://npm.pkg.github.com", "@jahrulnr/mcp-docker-agentic"]
}
}
}The container must already exist and be running. Pass the container name or id as container, for example my-app or a1b2c3d4.
Available Tools
docker_ping, docker_read_file, docker_write_file, docker_read_image, docker_list_dir, docker_mkdir, docker_grep, docker_apply_patch, docker_delete, docker_exec, docker_interactive_exec, docker_interactive_input, docker_interactive_close, docker_interactive_list, docker_cp_to, docker_cp_from, docker_close
Examples:
docker_ping("my-app")
docker_read_file("my-app", "/app/config.json")
docker_write_file("my-app", "/app/.env", "PORT=3000\n")
docker_mkdir("my-app", "/app/releases/42")
docker_list_dir("my-app", "/var/log")
docker_grep("my-app", "TODO", "/app", "*.js")
docker_exec("my-app", "ps aux")
# Commands that may require interactive input:
docker_interactive_exec("my-app", "apt-get upgrade")
docker_interactive_input(session_id="abc123", input="Y")
docker_interactive_close("abc123")
docker_cp_to("my-app", "./dist/app.tar.gz", "/app/app.tar.gz")
docker_cp_from("my-app", "/app/logs/app.log", "./app.log")Behavior Notes
docker_deleteusesrm -ffor files andrm -rfonly whenrecursive=true.docker_write_filewrites or overwrites a container file directly from text. Useappend=trueto append instead of overwrite. Parent directories are created automatically unlesscreate_dirs=false.docker_mkdiris equivalent tomkdir -pinside the container.docker_exechas a default timeout of 30 seconds and a maximum output size of 5 MiB.docker_read_imagesupports files up to 20 MiB.docker_write_fileaccepts content up to 5 MiB.docker_cp_*operations default to a 120-second timeout.All container commands run inside a non-login, non-interactive shell (
bash --noprofile --norc -c, falling back tosh -c) so broken profile scripts cannot corrupt output.docker_execalways returnsexit_code=Nalong with stdout. If stderr is present, it is included in a[stderr]section. Non-zero exit codes setisError, but stdout is still returned.Interactive sessions (TTY):
docker_interactive_execrunsdocker exec -it, allocating a pseudo-terminal so programs that require a real terminal (sudo,passwd, confirmation prompts, setup wizards, REPLs) behave correctly. The server waits until output has been quiet forquiet_ms(default: 500 ms) or the process exits, then returns the collected output along with asession_id. Continue the session usingdocker_interactive_input(leaveinputempty to simply wait for more output without sending anything). This mechanism is based on output inactivity rather than prompt detection. Commands that continuously produce output may cause the tool call to wait longer. The server allows up to 8 concurrent interactive sessions, automatically cleans up sessions after 10 minutes of inactivity, and terminates all active sessions when the server exits. Usedocker_interactive_listto view active sessions anddocker_interactive_closeto close them manually.docker_greptreats "no matches" as a successful result and still returns partial matches even if some paths cannot be read.docker_cp_toanddocker_cp_fromsupportrecursive=truefor directories. Local parent directories are created automatically when downloading. Remote parent directories must already exist before uploading (usedocker_mkdirif needed).docker_closeis a no-op because Docker does not keep a persistent connection per tool call.
Local Development
npm install
npm run check
npm test
npm startUnit tests use createMockTransport() — the same Docker contract (exec / cp / close / spawnInteractive) executed in a local sandbox, without a real container.
To test the MCP protocol, use MCP Inspector or any MCP client that supports stdio transport.
CI / Release
GitHub Actions (.github/workflows/ci.yml):
Unit test (any branch/PR) — Node 18 / 22 / 24 →
npm run check+npm run test:unitMCP test (after unit) — same Node matrix × (
nodebin |npxfromnpm pack) withMCP_DOCKER_AGENTIC_MOCK=1Push to
master— after both pass, if tagvX.Y.Zis new: create tag → publish to GitHub Packages + npmjs
Local: npm run test:all
Bump version in package.json before merging to master for a new release. Re-merging the same version skips tag/publish.
Secrets: NPM_TOKEN. GitHub Packages uses GITHUB_TOKEN (packages: write).
Available Tools
19 toolsdocker_apply_patchA
Apply a unified diff inside a Docker container. Tries apply_patch (strip=0 only), then git apply, then patch. Supports dry-run and strip level.
Inputs: patch (required), container (required), strip, dry_run.
docker_closeA
No-op for Docker: the transport does not keep a persistent connection. Always succeeds.
Inputs: no named parameters.
docker_cp_fromA
Copy a file or directory from a Docker container to the local machine (analogous to docker cp container:path local).
Inputs: container (required), local_path (required), remote_path (required), recursive, +1 more.
docker_cp_toA
Copy a local file or directory into a Docker container (analogous to docker cp local container:path).
Inputs: container (required), local_path (required), remote_path (required), recursive, +1 more.
docker_deleteA
Delete a file or directory inside a Docker container. Directories require recursive=true.
Inputs: path (required), container (required), recursive.
docker_execA
Execute an intentional shell command inside a Docker container. Supports stdin, cwd, env, custom output limit, and acceptable exit codes. Set background=true to run a command detached and get a job_id; stdin is not allowed for background jobs. Use docker_exec_result to poll/wait and docker_exec_kill to stop or clean up.
Inputs: command (required), container (required), cwd, env, +5 more.
docker_exec_killA
Send a signal to a background job started with docker_exec background=true. Optionally remove the job log directory.
Inputs: job_id (required), signal, cleanup.
docker_exec_resultA
Check the status and output of a background job started with docker_exec background=true. Optionally wait until it exits.
Inputs: job_id (required), wait, timeout_ms.
docker_grepA
Search text files recursively inside a Docker container with ripgrep, falling back to grep. Output format is file:line:match.
Inputs: pattern (required), container (required), glob, path, +5 more.
docker_interactive_closeA
Kill and remove an interactive Docker session started with docker_interactive_exec.
Inputs: session_id (required).
docker_interactive_execA
Start a command inside a Docker container with a TTY allocated, for programs that prompt for input (sudo password, y/N confirmations, setup wizards, REPLs). Waits until output goes quiet (likely waiting for input) or the process exits, then returns the output so far plus a session_id. If the command finishes without prompting, the session is closed automatically and there is nothing further to do. Otherwise, use docker_interactive_input to reply or poll, and docker_interactive_close when finished. Idle sessions auto-expire after 10 minutes.
Inputs: command (required), container (required), quiet_ms.
docker_interactive_inputA
Send a line of input to a running docker_interactive_exec session (e.g. answer a sudo password or y/N prompt), or just poll for more output if input is omitted. Returns newly produced output and status.
Inputs: session_id (required), input, newline, quiet_ms.
docker_interactive_listA
List currently open interactive Docker sessions.
Inputs: no named parameters.
docker_list_dirA
List a directory inside a Docker container with file metadata in ls -lAh style.
Inputs: container (required), path.
docker_mkdirA
Create a directory (and parents) inside a Docker container, equivalent to mkdir -p.
Inputs: path (required), container (required).
docker_pingB
Test that a Docker container is reachable and return its identity.
Inputs: container (required).
docker_read_fileA
Read a UTF-8 text file from a Docker container. offset and limit select a 1-based line range; limit=0 means unlimited. Defaults to first 200 lines.
Inputs: path (required), container (required), limit, offset.
docker_read_imageA
Read a file from a Docker container and return it as an MCP image. Supports common raster formats.
Inputs: path (required), container (required).
docker_write_fileA
Write UTF-8 text content directly to a file inside a Docker container (creates or overwrites; use append=true to append instead).
Inputs: path (required), content (required), container (required), append, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool has a clearly distinct purpose: file operations, exec, interactive sessions, background jobs, copying, and a no-op close. The most similar pair (docker_exec and docker_interactive_exec) is well-differentiated by TTY allocation and interactive input handling, so there is no real ambiguity.
All tools consistently use snake_case with a docker_ prefix, and related tools share predictable sub-patterns (e.g., exec_result, exec_kill, interactive_*, cp_to/from). Minor style deviations like docker_mkdir and docker_grep are command-style but still readable and consistent with the overall naming convention.
19 tools is slightly above the typical well-scoped range, but the count is justified by the broad domain of Docker interactions—file manipulation, execution, interactive sessions, background jobs, and copying. Each tool serves a distinct operational need, so the count feels appropriate rather than bloated.
The toolset comprehensively covers file operations, execution, background jobs, interactive sessions, and copying. However, it lacks container lifecycle management (e.g., listing, starting, stopping, inspecting containers), which would be expected for a broad Docker agentic server. This gap limits the toolset when discovering or managing containers rather than operating on a known one.
Maintenance
Related MCP Connectors
Develop, manage, and debug Railway projects, services, and deployments from within agents.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Read-only Linux server and Docker monitoring for AI assistants: CPU, memory, disk, network.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Docker containers through safe, permission-controlled access to inspect, manage, and diagnose containers, images, and compose services with built-in timeouts and AI-powered analysis.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers, images, networks, volumes, and Compose services through the Model Context Protocol. It supports system operations, command execution within containers, and integration with Docker Hub and GitHub Container Registry.167 npm2MIT
- AlicenseCqualityDmaintenanceEnables AI assistants to manage Docker containers, images, networks, volumes, and Docker Compose services through the Model Context Protocol.27MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers and images, including starting, stopping, listing, and building operations.2-