Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Read the linked file before judging a substantive change to that area.
|---|---|---|
| `server.py`, `docker_mcp/tools/` | [architecture/server.md](architecture/server.md) | `_slim_schema` or `_apply_host_schema` changing validation rather than display; a disabled capability registered-then-refusing instead of absent |
| `_hosts.py`, host selection | [architecture/hosts.md](architecture/hosts.md) | `use_context=False` dropped; `system_reconnect` gaining the ability to retarget an arbitrary URL; a write path that no longer requires an explicit `host` in multi-host mode |
| `_cli.py`, `_ssh_proxy.py`, CLI-backed tools | [architecture/cli-shell-out.md](architecture/cli-shell-out.md) | `subprocess.run` called directly; `shell=True`; a missing `timeout=`; the remote-exec fallback preferred over a usable local CLI; staging consequences absent from the docstring |
| `docker_mcp/redaction/`, the `redact` host option | [architecture/redaction.md](architecture/redaction.md) | `Host.redact` read directly instead of `settings.redacts` / `settings.host_redacted` (misses the global switch); a malformed setting accepted rather than failing at startup; a setting's error message repeating the value it was given |
| `_cli.py`, `_ssh_proxy.py`, CLI-backed tools | [architecture/cli-shell-out.md](architecture/cli-shell-out.md) | `subprocess.run` called directly; `shell=True`; a missing `timeout=`; a caller's value put in argv as `KEY=VALUE` where `cli_variables` / `values_by_name` should carry it in the CLI's environment; the remote-exec fallback preferred over a usable local CLI; staging consequences absent from the docstring |
| any `@tool()` docstring | [architecture/tool-descriptions.md](architecture/tool-descriptions.md) | the checklist below |
| code calling `docker` | [architecture/docker-sdk.md](architecture/docker-sdk.md) | an unverified method; a hand-built route that is not in the Engine API spec; a reach-in past the public SDK introduced without recorded sign-off |
| `Dockerfile`, `manifest.json`, `server.json`, `claude-plugin/`, release workflows | [architecture/distribution.md](architecture/distribution.md) | a version-declaring file missing from the bump checklist there, `preflight`, or the version tests; a registry ownership marker no longer matching `server.json`'s `name` |
Expand Down Expand Up @@ -105,6 +106,14 @@ uv run pre-commit install
# Regenerate the measured figures MCP_VS_SKILLS.md quotes (reports only; add --json for the
# structured form). Self-contained: pins its own tiktoken, installs the working tree editable.
uv run scripts/measure-comparison-figures.py

# Regenerate the measured figures REDACTION.md quotes: what redaction catches and misses (sweep) and
# what it costs (cost). Reports only; starts and removes a throwaway privileged dind daemon by default.
uv run scripts/measure-redaction.py sweep --swarm --configuration all
uv run scripts/measure-redaction.py cost
# Everyday requests to a headless Claude Code, read-only and writable, scored for leaks and outcome
# (costs model usage; see architecture/redaction.md).
uv run scripts/measure-redaction.py agents
```

## Architecture
Expand Down Expand Up @@ -412,8 +421,9 @@ re-proposes these; it has no memory of last time.
guard instead, and needs no cap remembered in advance. Flag only a change that silently narrows that
guard. The same question - cap or guard? - applies to any new direct dependency whose import surface
this project touches.
- **No `cryptography` pin.** It is transitive, and a wheels-only Intel-macOS resolve landing on a
vulnerable version is accepted. Do not propose pinning it or asserting it in CI.
- **No `cryptography` pin.** It is a direct dependency, declared without a bound, because redaction's
markers import it (it also comes in through paramiko), and a wheels-only Intel-macOS resolve landing
on a vulnerable version is accepted. Do not propose pinning it or asserting it in CI.
- **`scripts/measure-comparison-figures.py` is deliberately not a CI gate.** Token figures move a few
tokens on any docstring edit, so asserting them would fail constantly and signal nothing. A weekly
routine watches for drift instead. Do not propose promoting it.
Expand Down
2 changes: 2 additions & 0 deletions DOCKERHUB.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Set these in the client's `env` block. Three switches restrict which tools are r
- **`DOCKER_MCP_SERVER_NO_DESTRUCTIVE`** - everything except destructive tools (`*_remove`, `*_prune`, `container_kill`, `compose_down`, ...).
- **`DOCKER_MCP_SERVER_DISABLE`** - comma-separated *domains* to drop wholesale (e.g. `swarm,services,nodes,configs,secrets` for a single-host server).

**`DOCKER_MCP_SERVER_REDACT`** replaces credentials in everything the server returns with `[REDACTED:...]` markers; `(redact)` on a host in `DOCKER_MCP_SERVER_HOSTS` does it for that host alone. **This reduces accidental exposure only; it is not access control, and an agent that can run commands in a container can still read a credential.** Use it with `DOCKER_MCP_SERVER_READONLY`, and read [REDACTION.md](https://github.com/L337-org/docker-mcp/blob/main/REDACTION.md) before relying on it.

`DOCKER_HOST` / `DOCKER_TLS_VERIFY` / `DOCKER_CERT_PATH` retarget the daemon (e.g. `-e DOCKER_HOST=tcp://remote-host:2375`).

See the [full configuration reference](https://github.com/L337-org/docker-mcp#configuration) for the complete list and examples.
Expand Down
73 changes: 40 additions & 33 deletions MCP_VS_SKILLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ We have no commercial interest in either. Both are MIT-licensed and free.
| **Runtime auditability** | `tool-catalog` resource reports exactly what is registered | None |
| **Updates** | Version-pinned via `uvx`/image tag | Manual re-download; goes stale silently |
| **Trim the surface to fit the job** | `DOCKER_MCP_SERVER_DISABLE` drops whole domains; read-only / no-destructive drop categories - **and the router and prompts shrink with them** | Not really - the router is one file, though you can delete reference files you'll never use |
| **Token cost, eager client, idle** | **~47,200** at full surface; **~19,400** trimmed to a triage-shaped config. Add up to ~2,100 for a client that also loads prompts, resources and resource templates | **~140** |
| **Token cost, eager client, idle** | **~47,700** at full surface; **~19,500** trimmed to a triage-shaped config. Add up to ~2,100 for a client that also loads prompts, resources and resource templates | **~140** |
| **Token cost, lazy client, idle** | ~1,000 full; ~400 trimmed | ~140 |
| **Token cost, typical task** | **~1,400-2,600** (lazy) | ~7,100-10,200 |
| **Failure mode** | Server can fail to start / resolve deps; a wrong argument is rejected before anything runs | Cannot fail to "start"; a wrong command usually errors, but some wrong values exit 0 with a plausible result (see below) |
Expand Down Expand Up @@ -101,7 +101,7 @@ roughly level, with the server ahead on unusual or easily-confused operations an
the common ones.

**Getting the arguments right is where the server is properly ahead**, and this is the substantial
half. Across 583 parameters, every one carries a declared type, 80% carry an explicit default and
half. Across 589 parameters, every one carries a declared type, 80% carry an explicit default and
115 are marked required. That schema is enforced by the client before the call reaches the server,
so a wrong argument name or type is rejected as a validation error with nothing executed. The skill
composes a shell string, and a wrong flag is caught by Docker itself at execution, which may be
Expand All @@ -113,7 +113,7 @@ macOS, `status` fatal as a variable name in zsh, `jq -s` applied to something th
array. A JSON Schema makes that entire class of mistake unrepresentable. Nothing in the skill can,
because the CLI has no machine-readable description of its own flags.

One honest qualification: only 13 of those 583 parameters carry an `enum`. The other 98% have their
One honest qualification: only 13 of those 589 parameters carry an `enum`. The other 98% have their
legal values documented in prose on both sides, so the server's advantage is mostly over argument
names, types and requiredness rather than over the set of legal values.

Expand Down Expand Up @@ -158,7 +158,9 @@ concentrated in argument correctness.
Measured, not estimated - tool definitions serialized exactly as a client receives them in
`tools/list`, and skill files as loaded from disk. Counted with `tiktoken` (`cl100k_base`), which
is not Claude's tokenizer, so treat the absolute numbers as ±10-15% and the **ratios** as the
finding.
finding. Every figure below, ratios included, comes from `uv run scripts/measure-comparison-figures.py`
run on the code it describes; they move whenever a tool description does, so run it again before
relying on one.

### Eager and lazy clients, and why it decides everything below

Expand Down Expand Up @@ -199,19 +201,19 @@ The range between the loosest and tightest usable configuration is wide:

| Config | Tools | Eager idle | Lazy idle |
|---|---|---|---|
| Full whack: everything enabled | 154 | 47,195 | 976 |
| Read-only, all domains | 69 | 19,210 | 692 |
| **Triage config** (below) | **63** | **19,437** | **417** |
| Core only: `containers` + `system` | 37 | 11,218 | 305 |
| Floor: core, read-only | 16 | 4,866 | 235 |
| Full whack: everything enabled | 154 | 47,667 | 967 |
| Read-only, all domains | 69 | 19,253 | 683 |
| **Triage config** (below) | **63** | **19,542** | **417** |
| Core only: `containers` + `system` | 37 | 11,270 | 305 |
| Floor: core, read-only | 16 | 4,918 | 235 |

The eager column is **tools plus the router**: what every eager client pays. Prompts, resources and
resource templates are counted separately, because each is fetched by a separate call and only by a
client that supports it - see [Idle](#idle---loaded-but-not-used).

**On an eager client that spread is 4,866 to 47,195 tokens, roughly 10x**, which makes trimming
the single biggest lever available to you. **On a lazy client the same spread is 235 to 976: the
whole saving is around 740 tokens**, so there is little to gain from trimming for footprint alone.
**On an eager client that spread is 4,918 to 47,667 tokens, roughly 10x**, which makes trimming
the single biggest lever available to you. **On a lazy client the same spread is 235 to 967: the
whole saving is around 730 tokens**, so there is little to gain from trimming for footprint alone.
On a lazy client, configure the surface for safety or clarity and treat any context saving as
incidental.

Expand All @@ -226,7 +228,7 @@ kept:
DOCKER_MCP_SERVER_DISABLE=compose,stack,swarm,services,nodes,secrets,configs,buildx,scout,registry,plugins,context
```

That is a **2.4x** cut, with the router falling from 440 tokens to 212 as it stops advertising
That is a **2.4x** cut, with the router falling from 431 tokens to 212 as it stops advertising
absent domains, and the prompts from 30 to 16. The trade is real, though: a disabled tool is not
merely hidden, it is *gone*. If the triage turns out to need `compose_logs`, you have to change the
config and restart, whereas the skill always has every recipe available at no idle cost.
Expand All @@ -236,14 +238,14 @@ config and restart, whereas the skill always has every recipe available at no id
| | MCP (eager, full) | MCP (eager, triage config) | MCP (lazy, full) | Skill |
|---|---|---|---|---|
| Always in context | all 154 tool defs + router | 63 tool defs + router | router + tool names | name + description |
| | 46,755 (tools) | 19,225 (tools) | 440 (router) | 136 |
| | 440 (router) | 212 (router) | 536 (names) | |
| **Floor - every eager client** | **~47,200 tok** | **~19,400 tok** | **~1,000 tok** | **~140 tok** |
| | 47,236 (tools) | 19,330 (tools) | 431 (router) | 136 |
| | 431 (router) | 212 (router) | 536 (names) | |
| **Floor - every eager client** | **~47,700 tok** | **~19,500 tok** | **~1,000 tok** | **~140 tok** |
| *plus, for a client that loads them:* | | | | |
| prompts | +1,113 (30) | +596 (16) | - | - |
| resources | +405 (3) | +405 (3) | - | - |
| resources | +420 (3) | +420 (3) | - | - |
| resource templates | +572 (5) | +572 (5) | - | - |
| **Ceiling - all of them** | **~49,300 tok** | **~21,000 tok** | **~1,000 tok** | **~140 tok** |
| **Ceiling - all of them** | **~49,800 tok** | **~21,100 tok** | **~1,000 tok** | **~140 tok** |

"Triage config" here and below means the `DOCKER_MCP_SERVER_DISABLE` line in
[Configuring the server down](#the-triage-config): `containers`, `images`, `networks`, `volumes`
Expand All @@ -253,10 +255,10 @@ and `system` kept, the other twelve domains dropped.
calls - `tools/list`, `prompts/list`, `resources/list` and `resources/templates/list` - and a
client pays only for the ones it implements. Every eager client fetches tools, so that plus the
router is the floor; the other three are conditional. At full surface they come to ~2,100 tokens,
4% of that configuration's 47,200-token floor. They do not shrink the way the tools do when you
4% of that configuration's 47,700-token floor. They do not shrink the way the tools do when you
trim, though - resources and resource templates do not shrink at all - so in the tightest
configuration in the table above (*Floor: core, read-only*) they are ~1,440 tokens against a
4,866-token floor, or **30%**. That is why, on a trimmed server, your client's feature support
configuration in the table above (*Floor: core, read-only*) they are ~1,460 tokens against a
4,918-token floor, or **30%**. That is why, on a trimmed server, your client's feature support
matters more than some of the config switches. Quoting a single blended total would state a figure
for a client we have not identified, so both ends are given and the figures elsewhere in this
document use the floor.
Expand All @@ -267,9 +269,9 @@ its own attachment picker. So treat the conditional rows as an upper bound on wh
charged for. Settling it needs an instrumented client, not more arithmetic.

This is still the skill's strongest result. On a client that eagerly loads every tool, the server
at full surface costs roughly **47,200 tokens of every conversation** whether or not Docker comes
at full surface costs roughly **47,700 tokens of every conversation** whether or not Docker comes
up - around a third of a 128k window before you have said anything. Trimming to the triage config
cuts that to ~19,400 - a large and genuine saving, though still around 140 times what the skill
cuts that to ~19,500 - a large and genuine saving, though still around 140 times what the skill
costs to sit installed.

On a lazy client the server's idle cost drops ~50x to ~1,000 (or ~400 trimmed), and the gap
Expand All @@ -279,29 +281,29 @@ narrows to something most people would not notice either way.

| Task | MCP (lazy, full) | MCP (lazy, triage cfg) | MCP (eager, full) | MCP (eager, triage cfg) | Skill |
|---|---|---|---|---|---|
| List containers (one-off) | 1,392 | **833** | 47,195 | 19,437 | 7,937 |
| Triage a crashed container | 2,602 | **2,043** | 47,195 | 19,437 | 10,223 |
| Bring up a Compose project | 2,432 | n/a¹ | 47,195 | n/a¹ | 7,079 |
| List containers (one-off) | 1,383 | **833** | 47,667 | 19,542 | 7,937 |
| Triage a crashed container | 2,593 | **2,043** | 47,667 | 19,542 | 10,223 |
| Bring up a Compose project | 2,463 | n/a¹ | 47,667 | n/a¹ | 7,079 |

¹ Compose is disabled in the triage config (`containers`, `images`, `networks`, `volumes`,
`system` only), which is the point: a trimmed surface is trimmed for a purpose, and a task outside
it needs a different one.

**Here the result reverses, and the MCP server wins on a lazy client.** A tool definition is small
- median 262 tokens, range 119-1,147 - so fetching the five tools a triage needs costs ~1,600 on
- median 268 tokens, range 119-1,216 - so fetching the five tools a triage needs costs ~1,600 on
top of the ~1,000 baseline (or ~400 trimmed). The skill has to load its router (3,349) plus a
domain reference (~1,400-4,600) plus often a workflow (~1,600-2,600), because prose cannot be
fetched a paragraph at a time.

Note the eager+trimmed column never beats the skill on these tasks - 19,437 against 7,937-10,223 -
Note the eager+trimmed column never beats the skill on these tasks - 19,542 against 7,937-10,223 -
but it is the difference between "too expensive to leave installed" and "fine". If you are on an
eager client and want the server, disabling the domains you do not use is the single highest-value
change available.

So the honest summary is:

- **Eager-loading client** -> the skill is dramatically cheaper: ~4.6-6.7x on a real task at full
surface, ~1.9-2.4x even against a trimmed server, and ~140-350x at idle.
- **Eager-loading client** -> the skill is dramatically cheaper: ~4.7-6.7x on a real task at full
surface, ~1.9-2.5x even against a trimmed server, and ~140-350x at idle.
- **Lazy-loading client** -> the server is cheaper in use, by ~2.9-5.7x at full surface and ~5.0-9.5x
when trimmed, and both are cheap at idle.
- **Docker rarely comes up in your work** -> the skill, decisively; it costs ~140 tokens to have
Expand Down Expand Up @@ -349,10 +351,15 @@ workflow file at once; in practice a task touches one or two.
works as long as no command leaves it out.
- Cheaper per task on a lazy client.
- **The surface is configurable.** Disable the domains you do not use and the tools, prompts *and*
router shrink together - a triage-shaped config is 63 tools and ~19,400 eager tokens instead of
154 and ~47,200. The skill has no equivalent lever beyond deleting reference files by hand.
router shrink together - a triage-shaped config is 63 tools and ~19,500 eager tokens instead of
154 and ~47,700. The skill has no equivalent lever beyond deleting reference files by hand.
- Auditable at runtime - one resource reports exactly which tools are registered under the current
configuration, so you can confirm what a given config actually exposes rather than inferring it.
- **Credential redaction.** The server can replace credentials in everything it returns with
markers, and swap a marker back when a write needs the real value. The skill cannot: it runs the
docker CLI directly, so nothing sits between the daemon's output and the agent. Redaction reduces
accidental exposure only; **it is not access control**, and an agent that can run commands in a
container can still read a credential. See [REDACTION.md](REDACTION.md).

**Reasons that apply to neither as much as you'd think**

Expand All @@ -375,7 +382,7 @@ Three situations where the answer is clear, and they are mostly about the client
Docker work:

- **Occasional Docker use from an agent with a shell whose MCP client loads eagerly.** Use the
skill. Paying ~47,200 tokens of every conversation for a capability you reach for once a
skill. Paying ~47,700 tokens of every conversation for a capability you reach for once a
fortnight is a bad trade, and ~140 is not. This is the skill's strongest case by a distance, and
it is worth being clear that **it is a case created by the client, not by the skill being
better**. As the client moves to lazy loading, the idle cost drops to ~1,000 and this narrows
Expand Down
Loading
Loading