mait.sh1.132.1

Private beta: features and content may change. No warranty; use at your own risk.

Use cases

Seven things you ask your agent to do with containers, from checking the selected daemon to reviewing cleanup results.

Beta
MCP Docker

Output varies by version and machine.

Look around

Check the selected daemon and its resources.

You are about to work on a host and want to know what is on it before anything changes.

The version result identifies MCP Docker, rather than establishing daemon connectivity. Also ask for the daemon information and verify the expected daemon identity.

Capturedmcp-docker 0.7.4
YouWhat docker service are you using, and what is running?
Tool callsystem { "query": "version" }
What happensReturns MCP Docker 0.7.4 and the MCP protocol version.
Tool calllist_containers { "fields": ["id", "name", "state"] }
What happensAn empty list: the service manages no containers.
Tool calllist_images { "fields": ["id", "repository", "tag"] }
What happensReturns the images on the host, each with its id, repository and tag.
AgentI am using MCP Docker 0.7.4. I manage no containers, and the host holds the images listed above.
Build and run

Build an image and run it.

You have an approved project folder and Dockerfile on the MCP server host. Its default program is a short task expected to finish well within the served request deadline. You want to see it run.

Illustrative conversation
YouBuild this project's image, run it and tell me what it prints.
Tool callbuild_image { "context_path": "/work/app", "tags": ["app:test"] }
What happensThe image is built and tagged app:test.
Tool callrun_container { "image": "app:test", "name": "app-test" }
What happensThe container starts and is recorded as owned by this connection.
Tool callwait_container { "container_id": "app-test" }
What happensReturns the container id and exit code 0.
Tool callcontainer_logs { "container_id": "app-test", "tail": 20 }
What happensReturns the last twenty lines the program printed.
Tool callremove_container { "container_id": "app-test", "force": false }
What happensRemoves the completed disposable container.
AgentThe image built and the program exited with code 0. Its last lines are above. I removed the container; app:test remains until its tags and dependants are reviewed for separate image removal.
Run a service

Try a service with its limits and ports.

You want a database running for a test, with a memory cap and a port only you can reach.

Illustrative conversation
YouStart Postgres for this test, limited to 512 MB, reachable on localhost only.
Tool callrun_container { "image": "postgres:16", "name": "test-db", "env": { "POSTGRES_PASSWORD": "<test password>" }, "ports": [{ "host_ip": "127.0.0.1", "host_port": 5433, "container_port": 5432 }], "resources": { "memory_mb": 512 } }
What happensThe container starts with the port bound to the loopback address and a 512 MB memory limit.
Tool callinspect_container { "container_id": "test-db", "fields": ["info.state"] }
What happensReturns the current container state, which must be Running before the readiness command.
Tool callcontainer_port { "container_id": "test-db", "private_port": 5432 }
What happensCheck that the returned binding is 127.0.0.1:5433; stop and reconcile an unexpected binding.
Tool callcontainer_stats { "container_id": "test-db", "stream": false }
What happensRead stats.memory_stats.limit and compare the observed value with the intended 536870912-byte limit; do not infer a match from missing data.
Tool callexec_command { "container_id": "test-db", "command": ["pg_isready", "-U", "postgres"] }
What happensInspect exit_code, stdout and stderr. Exit code 0 establishes this readiness check; a starting database can require a later bounded retry.
AgentI report the actual binding, observed memory limit and readiness result. I will not claim readiness or the requested limit if a check is missing or differs.
Look inside

Work inside a running container.

A container misbehaves and you want to know why.

Illustrative conversation
YouWhy is the web container slow? Look inside it.
Tool callcontainer_stats { "container_id": "web" }
What happensCPU, memory and network figures for the container.
Tool callcontainer_top { "container_id": "web", "ps_options": "aux" }
What happensLists the processes running in it; one program uses most of the CPU.
Tool callexec_command { "container_id": "web", "command": ["sh", "-c", "tail -n 5 /var/log/app.log"] }
What happensReturns the last lines of the application log, with exit code 0.
AgentOne worker process is using almost all the CPU, and the log shows it retrying a failing request. That is the cause.
Networks

Connect two services.

Two disposable containers need to find each other on an approved network.

Illustrative conversation
YouConnect two test containers and verify name resolution.
Tool callcreate_network { "name": "docs-test-net", "internal": true }
What happensRetain the returned network_id; use that ID in place of docs-test-net below if the name differs.
Tool callrun_container { "image": "busybox:1.36", "name": "docs-peer-a", "command": ["sleep", "300"] }
What happensRetain the first returned container_id.
Tool callrun_container { "image": "busybox:1.36", "name": "docs-peer-b", "command": ["sleep", "300"] }
What happensRetain the second returned container_id.
Tool callconnect_network { "network": "docs-test-net", "container": "docs-peer-a", "aliases": ["peer-a"] }
What happensThe first container joins the network.
Tool callconnect_network { "network": "docs-test-net", "container": "docs-peer-b", "aliases": ["peer-b"] }
What happensThe second container joins the network.
Tool callexec_command { "container_id": "docs-peer-a", "command": ["ping", "-c", "1", "peer-b"] }
What happensInspect exit_code and output; only a successful result confirms this check.
AgentI report the command result, stop and remove both disposable containers, then remove docs-test-net. Failed cleanup requires inspecting remaining attachments before retrying.

Use unique names and returned IDs in a shared daemon. If any creation or attachment fails, reconcile the exact IDs already created. Preserve a useful image for reuse or review its shared dependants before separate removal.

Adopt

Take over a container someone else started.

A container was started by another session, or by you at a prompt, and the agent has to stop it.

Illustrative conversation
YouStop the old build container.
Tool callcontainer_control { "action": "stop", "container_id": "old-build" }
What happensRefused: the container does not belong to this session.
AgentThat container is not mine. I can adopt it first if you want me to take responsibility for it.
YouYes, adopt it and stop it.
Tool calladopt { "action": "container", "container_id": "old-build" }
What happensThe container is tracked as owned by this connection.
Tool callcontainer_control { "action": "stop", "container_id": "old-build", "timeout": 10 }
What happensThe container stops.
AgentI adopted the old build container and stopped it.
Clean up

Review and retire disposable resources.

An agent tried several things and you want nothing left running or taking disk space.

Illustrative conversation
YouRemove everything you created, and tell me what is left.
Tool callcleanup_session { "force": true }
What happensReturns the number of containers, networks and volumes removed, and an errors list with one entry: a volume still in use.
Tool callsystem { "query": "df" }
What happensDisk use of images, containers and volumes on the daemon.
AgentI removed three containers and one network. One volume is still in use, so I left it; here is its name.