File size: 6,163 Bytes
83ab69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
title: dockroot-mcp
emoji: 🐳
colorFrom: indigo
colorTo: purple
sdk: static
pinned: false
license: apache-2.0
short_description: Virtual docker root β€” read-only MCP tools for your stack
---

# 🐳 dockroot-mcp β€” Virtual Docker Root for AI Agents

**Give your AI agent read-only power over its own Docker stack β€” without
host root.**

`dockroot-mcp` is a standalone MCP server that exposes read-only Docker
tools (`ps`, `logs`, `inspect`, `stats`, `networks`) as first-class agent
tools. Drop the container into any compose stack, mount the socket, and
your agent can SEE and DIAGNOSE every container on its network β€” then
actually fix things, instead of guessing.

## Why this exists

AI agents get asked "why is my Open WebUI broken?" constantly. Without
docker access they flail: they invent commands, read the wrong configs,
or hallucinate fixes. With `dockroot-mcp` the agent can:

1. **List** the containers on its network (`docker_ps`)
2. **Read logs** to find the real error (`docker_logs`)
3. **Inspect** env / mounts / health (`docker_inspect`)
4. **Watch** CPU/memory pressure (`docker_stats`)
5. **See** the network topology (`docker_networks`)

Then it answers from evidence, not imagination. The Fixer sees the box.

## The security model (read this)

- **Read-only by design** β€” the MCP tool list contains ONLY read commands.
  No start/stop/rm/exec. The agent can diagnose, never destroy.
- **Scoped visibility** β€” mount the socket, and the tools see the whole
  Docker daemon the socket belongs to. Keep it on an internal network.
- **Opt-in** β€” no socket mount, no docker access. The server still runs
  (it just reports the docker error honestly).
- **Env filtering** β€” Hermes strips secrets from MCP subprocess env and
  redacts credentials in tool errors.

This is *virtual* root: the power of sight without the power of control.

## Quick start

### 1. Add to your compose stack

```yaml
services:
  dockroot:
    image: jpanasuk/dockroot-mcp:latest
    container_name: dockroot
    restart: unless-stopped
    networks: [your-ai-network]            # the network it can see
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock   # read-only docker access
```

### 2. Connect from Hermes (native MCP client)

```yaml
# ~/.hermes/config.yaml
mcp_servers:
  dockroot:
    command: python3
    args: ["/opt/dockroot/tavern_mcp.py"]
```

Then ask your agent: *"what containers are running?"* or *"why is
code-server crash-looping?"* β€” it calls `mcp_dockroot_docker_ps` /
`mcp_dockroot_docker_logs` and answers from the actual stack.

### 3. Or expose through MCPO (Open WebUI ecosystem)

Add to your mcpo `config.json`:

```json
{
  "mcpServers": {
    "dockroot": {
      "command": "python3",
      "args": ["/opt/dockroot/tavern_mcp.py"]
    }
  }
}
```

Every tool becomes an HTTP endpoint (`/dockroot/docker_ps`, ...) that any
OpenAI-compatible tool caller can hit.

## Available tools

| Tool | What it does | When to use |
|------|-------------|-------------|
| `docker_ps` | List containers (names, images, status, ports) | "what's running?" |
| `docker_logs` | Tail a container's logs | "why is X failing?" |
| `docker_inspect` | Full config: env, mounts, network, health | "what env does X have?" |
| `docker_stats` | Live CPU/memory usage | "is the box overloaded?" |
| `docker_networks` | List Docker networks | "what networks exist?" |
| `status` | Discovered services with link:port | "what's connected?" |
| `self_check` | Verify every service's health (HTTP+TCP) | "is everything working?" |
| `wire` | Wiring audit with exact fixes | "connect X to Y" |
| `rediscover` | Re-scan the network | "find new services" |
| `models` | List available models | "what models can I use?" |
| `chat` | One-shot chat with the primary engine | "ask the model something" |

## Use cases

- **Self-healing stacks** β€” an agent that reads its own logs, finds the
  crash, and applies the fix from a recipe
- **Onboarding** β€” "show me everything that's running" with actual output,
  not a hallucinated list
- **Support triage** β€” a support agent inspects logs + configs before
  escalating
- **Multi-model troubleshooting** β€” an agent compares what Open WebUI
  sees vs what Ollama serves, using evidence from both
- **Dev sandboxes** β€” ephemeral stacks where the agent is expected to
  self-diagnose

## Why "virtual docker root"

Docker socket access normally equals host root β€” a container with the
socket can run anything. dockroot-mcp deliberately stays on the safe side
of that line: **all tools are read-only**, and the server is the only
thing that talks to the socket. The agent gets X-ray vision, not a
weapon. If you ever need write access, fork it and add your own tools β€”
the read-only boundary is the default, not the ceiling.

## Security notes

- The image runs as root (the socket needs it) β€” keep it internal
- Never expose dockroot-mcp's port publicly
- The `mcp` Python package is installed so Hermes can act as the client
- Tools return truncated output (4KB stdout / 2KB stderr) to protect
  context windows

## Development

- `tavern_mcp.py` β€” the MCP server (pure stdlib protocol, no framework)
- `discover.py` / `recipes.py` β€” the discovery + fix-recipe engine
- `Dockerfile` β€” python:3.12-slim + docker CLI + mcp SDK

## Devlog

### 2026-08-10 β€” v1.0.6 (initial release)

- Standalone MCP server exposing the tavern connectivity toolkit + 5
  read-only docker tools
- Proper MCP stdio handshake (fixed the stub that sent unsolicited
  initialize messages β†’ "Connection closed")
- Fallback discovery paths so the server runs both inside basecamp
  (/opt/basecamp) and standalone (/opt/dockroot)
- `os` import fix (the one that crashed `tavern_or_discover`)
- Verified: hermes native MCP client connects (6+5 tools), MCPO connects
  and calls tools, docker_ps lists the live stack from inside a container
- Built on the basecamp 1.0.6 adaptive discovery engine (subnet sweep,
  cross-host hosts, 44 fix recipes)

---

*Built with the Basecamp project β€” the portable AI agent container with
network auto-discovery. Hermes Agent by Nous Research under the hood.*