GUIDE

Docker MCP \u2014 Safe AI Tool Execution

Run filesystem, terminal, and development tools safely inside Docker containers, controlled by AI assistants via MCP.

WHY

Why Docker MCP

AI assistants need real tools to be useful. But running them directly on your machine is risky.

AI assistants need tools to be useful: file editing, terminal commands, package management. Running these directly on your machine is risky — accidental deletions, system changes, or even malware. Docker MCP sandboxes all tool execution inside containers.

Isolation

Every tool call runs inside a container. Your host system is never directly touched.

Reproducibility

Containers start from known images. Same setup, every time, on every machine.

Safety

Accidental rm -rf or rogue installs stay inside the container. Your real files are untouched.

Audit trail

All tool calls flow through MCP protocol, giving you a complete log of every action taken.

How it works

AI Assistant
MCP Protocol
Docker MCP Gateway
Container
Tools

Docker Desktop's MCP gateway translates MCP tool calls into container operations. Each tool call runs in an isolated environment. Results flow back through the same path to your AI assistant.

SETUP

Prerequisites

  • Docker Desktop — with MCP plugin support enabled
  • SPEC4AI Link (macOS menu bar app) or Claude Desktop
  • A workspace directory to mount (e.g., /Volumes/Z4/SPEC4)

QUICK START

Get started in 4 steps

1

Create a workspace

mkdir -p /Volumes/Z4/SPEC4
2

Enable Docker MCP in SPEC4AI Link

Open SPEC4AI Link → Settings → Docker Runtime → Enable

Or configure in Claude Desktop's MCP settings.

3

Start the Docker MCP gateway

docker mcp gateway run --transport stdio
4

Verify tools are available

Your AI assistant should now see Docker MCP tools. Try:

“List files in my workspace” or “Create a hello.txt file”

TOOLS

Available tools

Docker MCP exposes tool categories that AI assistants can call via the MCP protocol.

filesystemRead, write, list, search files in mounted volumes
terminalExecute shell commands inside containers
containerManage container lifecycle (start, stop, inspect)
imagePull and manage Docker images

ADVANCED

Volume mounting

Mount any directory as a workspace for your containerized tools.

Mount a project directory

docker run -v /path/to/project:/workspace ...

Mount external drives

Mount external drives for large datasets or shared project volumes.

Read-only mounts for sensitive data

-v /data:/data:ro

Combine multiple volumes

Use multiple -v flags for complex setups that span several directories.

SECURITY

Security benefits

  • Container isolation — tools can’t access host filesystem outside mounts
  • Network isolation — containers run in isolated networks by default
  • Resource limits — CPU and memory constraints prevent runaway processes
  • Ephemeral containers — each session starts clean, no state leakage
  • Read-only mounts — protect sensitive directories from modification
  • Audit trail — all tool calls logged through MCP protocol

Ready to try safe AI tool execution?

Get SPEC4AI Link and start running AI-controlled tools inside Docker containers today.