@soyrageagency/docker-mcp 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +882 -0
- package/dist/ai/credentials.d.ts +72 -0
- package/dist/ai/credentials.js +157 -0
- package/dist/ai/credentials.js.map +1 -0
- package/dist/ai/login.d.ts +22 -0
- package/dist/ai/login.js +189 -0
- package/dist/ai/login.js.map +1 -0
- package/dist/ai/provider.d.ts +29 -0
- package/dist/ai/provider.js +113 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/assets.d.ts +20 -0
- package/dist/assets.js +56 -0
- package/dist/assets.js.map +1 -0
- package/dist/branding.d.ts +31 -0
- package/dist/branding.js +61 -0
- package/dist/branding.js.map +1 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +128 -0
- package/dist/config.js.map +1 -0
- package/dist/docker/client.d.ts +66 -0
- package/dist/docker/client.js +161 -0
- package/dist/docker/client.js.map +1 -0
- package/dist/docker/compose.d.ts +74 -0
- package/dist/docker/compose.js +126 -0
- package/dist/docker/compose.js.map +1 -0
- package/dist/entry.d.ts +15 -0
- package/dist/entry.js +33 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +25 -0
- package/dist/logger.js +68 -0
- package/dist/logger.js.map +1 -0
- package/dist/panel/index.d.ts +16 -0
- package/dist/panel/index.js +53 -0
- package/dist/panel/index.js.map +1 -0
- package/dist/panel/public/app.js +1004 -0
- package/dist/panel/public/index.html +243 -0
- package/dist/panel/public/styles.css +428 -0
- package/dist/panel/server.d.ts +23 -0
- package/dist/panel/server.js +355 -0
- package/dist/panel/server.js.map +1 -0
- package/dist/panel/service.d.ts +327 -0
- package/dist/panel/service.js +1356 -0
- package/dist/panel/service.js.map +1 -0
- package/dist/plugins.d.ts +50 -0
- package/dist/plugins.js +121 -0
- package/dist/plugins.js.map +1 -0
- package/dist/ragedocker.d.ts +21 -0
- package/dist/ragedocker.js +164 -0
- package/dist/ragedocker.js.map +1 -0
- package/dist/tools/about.d.ts +15 -0
- package/dist/tools/about.js +55 -0
- package/dist/tools/about.js.map +1 -0
- package/dist/tools/compose.d.ts +19 -0
- package/dist/tools/compose.js +145 -0
- package/dist/tools/compose.js.map +1 -0
- package/dist/tools/containers.d.ts +13 -0
- package/dist/tools/containers.js +119 -0
- package/dist/tools/containers.js.map +1 -0
- package/dist/tools/context.d.ts +37 -0
- package/dist/tools/context.js +13 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/images.d.ts +11 -0
- package/dist/tools/images.js +38 -0
- package/dist/tools/images.js.map +1 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/index.js +34 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lifecycle.d.ts +16 -0
- package/dist/tools/lifecycle.js +165 -0
- package/dist/tools/lifecycle.js.map +1 -0
- package/dist/tools/logs.d.ts +15 -0
- package/dist/tools/logs.js +110 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/system.d.ts +14 -0
- package/dist/tools/system.js +108 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tui/ansi.d.ts +66 -0
- package/dist/tui/ansi.js +118 -0
- package/dist/tui/ansi.js.map +1 -0
- package/dist/tui/app.d.ts +160 -0
- package/dist/tui/app.js +1339 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/box.d.ts +18 -0
- package/dist/tui/box.js +38 -0
- package/dist/tui/box.js.map +1 -0
- package/dist/tui/index.d.ts +19 -0
- package/dist/tui/index.js +66 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/update/channel.d.ts +82 -0
- package/dist/update/channel.js +178 -0
- package/dist/update/channel.js.map +1 -0
- package/dist/updates.json +42 -0
- package/dist/utils/format.d.ts +24 -0
- package/dist/utils/format.js +69 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/result.d.ts +35 -0
- package/dist/utils/result.js +31 -0
- package/dist/utils/result.js.map +1 -0
- package/package.json +90 -0
- package/scripts/install.mjs +132 -0
package/README.md
ADDED
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://soyrage.es/">
|
|
4
|
+
<img src="./assets/soyrage-banner.svg" alt="SoyRage Agency — Full-Stack Developer × Infrastructure Engineer · soyrage.es" width="100%">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
8
|
+
|
|
9
|
+
# 🐳 Docker MCP Server
|
|
10
|
+
|
|
11
|
+
**Chat with your Docker host.** A [Model Context Protocol](https://modelcontextprotocol.io) server that turns any MCP‑capable AI — Claude Desktop, Cursor, Continue, Zed — into a natural‑language DevOps copilot for **Docker & Docker Compose**.
|
|
12
|
+
|
|
13
|
+
*“Restart the `api` container.” · “Why did `web` crash — show me the last 100 log lines.” · “Deploy the stack in `./prod` and confirm it’s healthy.”*
|
|
14
|
+
|
|
15
|
+
<br/>
|
|
16
|
+
|
|
17
|
+
[](https://github.com/soyrageagency/docker-mcp-server/actions/workflows/ci.yml)
|
|
18
|
+
[](https://nodejs.org)
|
|
19
|
+
[](https://www.typescriptlang.org/)
|
|
20
|
+
[](https://modelcontextprotocol.io)
|
|
21
|
+
[](https://docs.docker.com/engine/api/)
|
|
22
|
+
[](./LICENSE)
|
|
23
|
+
|
|
24
|
+
### Designed, built & maintained by **[SoyRage Agency](https://soyrage.es/)** · **https://soyrage.es/**
|
|
25
|
+
|
|
26
|
+
**⚡ New here? Install in one command → [Quick install](#-quick-install-one-command).**
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📑 Table of contents
|
|
33
|
+
|
|
34
|
+
- [Quick install (one command)](#-quick-install-one-command)
|
|
35
|
+
- [What is this?](#-what-is-this)
|
|
36
|
+
- [Why it exists](#-why-it-exists)
|
|
37
|
+
- [Feature overview](#-feature-overview)
|
|
38
|
+
- [The interactive panel](#-the-interactive-panel)
|
|
39
|
+
- [The terminal UI (TUI)](#-the-terminal-ui-tui)
|
|
40
|
+
- [Monitoring: Prometheus, Zabbix & more](#-monitoring-prometheus-zabbix--more)
|
|
41
|
+
- [Modular plugin architecture](#-modular-plugin-architecture)
|
|
42
|
+
- [How it works](#-how-it-works)
|
|
43
|
+
- [Requirements](#-requirements)
|
|
44
|
+
- [Installation](#-installation)
|
|
45
|
+
- [Connecting to your AI client](#-connecting-to-your-ai-client)
|
|
46
|
+
- [Claude Desktop](#claude-desktop)
|
|
47
|
+
- [Cursor / Continue / Zed](#cursor--continue--zed)
|
|
48
|
+
- [Configuration reference](#-configuration-reference)
|
|
49
|
+
- [Connecting to remote / TLS daemons](#-connecting-to-remote--tls-daemons)
|
|
50
|
+
- [Security model](#-security-model)
|
|
51
|
+
- [Complete tool reference](#-complete-tool-reference)
|
|
52
|
+
- [Example conversations](#-example-conversations)
|
|
53
|
+
- [Project structure](#-project-structure)
|
|
54
|
+
- [Design principles](#-design-principles)
|
|
55
|
+
- [Development](#-development)
|
|
56
|
+
- [Troubleshooting & FAQ](#-troubleshooting--faq)
|
|
57
|
+
- [Roadmap](#-roadmap)
|
|
58
|
+
- [Contributing](#-contributing)
|
|
59
|
+
- [About SoyRage Agency](#-about-soyrage-agency)
|
|
60
|
+
- [Support the project](#-support-the-project)
|
|
61
|
+
- [Credits & License](#-credits--license)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ⚡ Quick install (one command)
|
|
66
|
+
|
|
67
|
+
> **Already use an MCP client?** Point it at the published package — nothing to clone or build:
|
|
68
|
+
>
|
|
69
|
+
> ```jsonc
|
|
70
|
+
> "docker": {
|
|
71
|
+
> "command": "npx",
|
|
72
|
+
> "args": ["-y", "@soyrageagency/docker-mcp"],
|
|
73
|
+
> "env": { "DOCKER_MCP_READONLY": "false" }
|
|
74
|
+
> }
|
|
75
|
+
> ```
|
|
76
|
+
>
|
|
77
|
+
> Or open the live web panel straight away: `npx -y -p @soyrageagency/docker-mcp docker-mcp-panel`
|
|
78
|
+
|
|
79
|
+
### Option A — standalone binary (no Node, no npm) · *recommended for the CLI/TUI/panel*
|
|
80
|
+
|
|
81
|
+
Since **v1.1** you can install a single self-contained `ragedocker` executable — a Node runtime and the whole app fused into one file. Nothing else to install.
|
|
82
|
+
|
|
83
|
+
**Windows (PowerShell):**
|
|
84
|
+
```powershell
|
|
85
|
+
irm https://raw.githubusercontent.com/soyrageagency/docker-mcp-server/main/scripts/install.ps1 | iex
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**macOS / Linux:**
|
|
89
|
+
```sh
|
|
90
|
+
curl -fsSL https://raw.githubusercontent.com/soyrageagency/docker-mcp-server/main/scripts/install.sh | sh
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then just run `ragedocker` for an interactive menu, or `ragedocker tui` / `ragedocker panel` / `ragedocker ia login`. Re-run the installer any time to update. *(How it's built and how to reuse this across repos: [docs/DISTRIBUTION.md](./docs/DISTRIBUTION.md).)*
|
|
94
|
+
|
|
95
|
+
### Option B — via Node · *configures Claude Desktop for you*
|
|
96
|
+
|
|
97
|
+
Prefer the MCP-server-for-Claude-Desktop path? The installer clones the project, builds it, and **configures Claude Desktop for you** — no manual JSON editing. You need [Git](https://git-scm.com/) and [Node.js ≥ 18](https://nodejs.org/).
|
|
98
|
+
|
|
99
|
+
**Windows (PowerShell):**
|
|
100
|
+
```powershell
|
|
101
|
+
irm https://raw.githubusercontent.com/soyrageagency/docker-mcp-server/main/install.ps1 | iex
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**macOS / Linux:**
|
|
105
|
+
```bash
|
|
106
|
+
curl -fsSL https://raw.githubusercontent.com/soyrageagency/docker-mcp-server/main/install.sh | bash
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Already cloned the repo? Just run:
|
|
110
|
+
```bash
|
|
111
|
+
npm run setup # builds + configures Claude Desktop
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Then **restart Claude Desktop** and ask: *“What Docker containers are running?”* 🎉
|
|
115
|
+
The installer **backs up** your existing config and **merges** the entry, so any other MCP servers you have are preserved. Prefer to see the snippet without writing anything? `node scripts/install.mjs --print`.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 🧭 What is this?
|
|
120
|
+
|
|
121
|
+
The **Model Context Protocol (MCP)** is an open standard that lets AI assistants talk to external tools through a well‑defined JSON‑RPC interface. **Docker MCP Server** is an MCP *server* that speaks that protocol over **stdio** and exposes your Docker host as a set of safe, richly‑described tools.
|
|
122
|
+
|
|
123
|
+
Point any MCP‑capable assistant at it and you can operate containers and Compose stacks **in plain language** — the model reads each tool’s schema, decides which to call, and reports the results back to you. No more memorising flags or copy‑pasting container IDs.
|
|
124
|
+
|
|
125
|
+
> **In one line:** it’s the bridge between “*I wish I could just tell my server what to do*” and your actual Docker daemon.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 💡 Why it exists
|
|
130
|
+
|
|
131
|
+
Day‑to‑day container work is a stream of small, repetitive commands:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
docker ps -a
|
|
135
|
+
docker logs --tail 100 -f my-api
|
|
136
|
+
docker compose -f ./prod/compose.yaml up -d --build
|
|
137
|
+
docker stats my-api
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Every one of those is trivial *once you remember the exact syntax*. The friction is the memorisation and the context‑switching. This server removes that friction by letting the AI do the translation, while **keeping you in control** through:
|
|
141
|
+
|
|
142
|
+
- **Read‑only mode** for safe demos and production insight.
|
|
143
|
+
- A **container allowlist** so the assistant can only touch what you allow.
|
|
144
|
+
- **Opt‑in exec** so arbitrary in‑container commands are never available by accident.
|
|
145
|
+
- **Confirmation‑friendly design** — destructive tools are clearly described so the model asks before it acts.
|
|
146
|
+
|
|
147
|
+
Built by **[SoyRage Agency](https://soyrage.es/)** for the self‑hosting and home‑lab community — and equally at home on a CI runner or a production VM behind read‑only mode.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 🚀 Feature overview
|
|
152
|
+
|
|
153
|
+
| Area | Capabilities |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| 🔎 **Insight** | List containers · inspect full config · live CPU/memory/network stats · tail logs with time windows · list images / networks / volumes · host summary · disk usage. |
|
|
156
|
+
| ⚙️ **Lifecycle** | Start · stop · restart · remove containers — with graceful stop timeouts. |
|
|
157
|
+
| 📦 **Compose** | Validate config · list services & health · **deploy** (`up -d`, optional `--build`) · tear down · restart · pull — via the official `docker compose` CLI. |
|
|
158
|
+
| 🛡️ **Safety** | Global **read‑only** mode · **container allowlist** · **opt‑in exec**. |
|
|
159
|
+
| 🔌 **Transport** | Local Unix socket · Windows named pipe · secured remote **TCP + TLS**. |
|
|
160
|
+
| 🎨 **Identity** | ASCII welcome banner · `about` tool · MCP `instructions` that credit **SoyRage Agency** to the AI on connect. |
|
|
161
|
+
| 🖥️ **Interactive panel** | Tabbed web dashboard: live monitoring, **terminal with smart command suggestions**, **file explorer**, **snapshots & scheduled backups**, **networks/volumes**, **auto‑restart watchdog**, **alerts & log watch**, inspect, search and lifecycle actions — with a demo mode. |
|
|
162
|
+
| ⌨️ **Terminal UI** | A creative, lazydocker‑style TUI with a SoyRage welcome, live gauges and one‑key actions — zero curses dependencies. |
|
|
163
|
+
| 📈 **Monitoring** | Built‑in **Prometheus `/metrics`** endpoint — scrape it from Prometheus, Grafana, Zabbix, VictoriaMetrics, … |
|
|
164
|
+
| 🧩 **Modular** | Every capability is a toggleable **plugin**; enable exactly the surface you want via config. |
|
|
165
|
+
| 🧱 **Engineering** | 100% TypeScript, strict mode · one module per concern · tiny dependency surface · stderr‑only logging. |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 🖥️ The interactive panel
|
|
170
|
+
|
|
171
|
+
Beyond the conversational interface, the project ships a **minimalist web dashboard** (`docker-mcp-panel`) for when you want a fast, visual, point‑and‑click view of your host. It reuses the exact same configuration, Docker client and safety rails as the MCP server — so **read‑only mode** and the **allowlist** apply here too.
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm run build
|
|
175
|
+
ragedocker panel # → http://127.0.0.1:4600 (or: npm run panel)
|
|
176
|
+
npm run panel:demo # same, but with realistic mock data (no daemon needed)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
> **One command for everything.** Since **v1.1** a single `ragedocker` launcher fronts the whole toolkit — run `ragedocker` with no arguments for an interactive menu, or:
|
|
180
|
+
>
|
|
181
|
+
> ```bash
|
|
182
|
+
> ragedocker tui # the lazydocker-style terminal dashboard
|
|
183
|
+
> ragedocker panel # the web panel + monitoring API
|
|
184
|
+
> ragedocker mcp # the MCP server (Claude Desktop, Cursor, Continue…)
|
|
185
|
+
> ragedocker ia login # sign in to Claude or ChatGPT (see below)
|
|
186
|
+
> ragedocker doctor # check Docker, the AI and your configuration
|
|
187
|
+
> ```
|
|
188
|
+
>
|
|
189
|
+
> The original `docker-mcp-tui` / `docker-mcp-panel` / `docker-mcp-server` binaries still work as aliases.
|
|
190
|
+
|
|
191
|
+
### 🔑 AI copilot — sign in once with `ragedocker ia login`
|
|
192
|
+
|
|
193
|
+
The TUI copilot (press `a`) and the panel's AI terminal need a model. A short wizard sets one up — pick **Claude** (Anthropic, used natively) or **ChatGPT** (OpenAI), paste your key, and it's verified before saving:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
ragedocker ia login # set up your main AI account
|
|
197
|
+
ragedocker ia secundaria # add a second account to switch to
|
|
198
|
+
ragedocker ia use secondary
|
|
199
|
+
ragedocker ia list # show what's configured (keys masked)
|
|
200
|
+
ragedocker ia test # call the model once and report back
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Keys are stored at `~/.ragedocker/ai.json`, **owner‑readable only (0600)**, and are never echoed or logged. The legacy `DOCKER_MCP_AI_*` environment variables still take precedence for unattended deployments.
|
|
204
|
+
|
|
205
|
+
<div align="center">
|
|
206
|
+
|
|
207
|
+
### Dashboard — live host stats, containers & images
|
|
208
|
+
<img src="./assets/screenshots/01-dashboard.png" alt="Docker Panel dashboard by SoyRage Agency" width="90%">
|
|
209
|
+
|
|
210
|
+
### One‑click log tailing
|
|
211
|
+
<img src="./assets/screenshots/02-logs.png" alt="Docker Panel log drawer by SoyRage Agency" width="90%">
|
|
212
|
+
|
|
213
|
+
### Terminal — run docker commands with smart suggestions (Tab / ↑↓ / Enter)
|
|
214
|
+
<img src="./assets/screenshots/08-terminal.png" alt="Docker Panel terminal with command suggestions by SoyRage Agency" width="90%">
|
|
215
|
+
|
|
216
|
+
### Snapshots & scheduled backups — with email/cloud delivery
|
|
217
|
+
<img src="./assets/screenshots/09-backups.png" alt="Docker Panel snapshots and scheduled backups by SoyRage Agency" width="90%">
|
|
218
|
+
|
|
219
|
+
### File explorer + editor — view & edit files inside a container
|
|
220
|
+
<img src="./assets/screenshots/11-editor.png" alt="Docker Panel file editor by SoyRage Agency" width="90%">
|
|
221
|
+
|
|
222
|
+
### Browse a container's filesystem
|
|
223
|
+
<img src="./assets/screenshots/06-files.png" alt="Docker Panel file explorer by SoyRage Agency" width="90%">
|
|
224
|
+
|
|
225
|
+
### System — networks & volumes
|
|
226
|
+
<img src="./assets/screenshots/10-system.png" alt="Docker Panel networks and volumes by SoyRage Agency" width="90%">
|
|
227
|
+
|
|
228
|
+
### Alerts & log watch — with a live auto‑restart watchdog
|
|
229
|
+
<img src="./assets/screenshots/07-alerts.png" alt="Docker Panel alerts and auto-restart by SoyRage Agency" width="90%">
|
|
230
|
+
|
|
231
|
+
### Read‑only mode — actions safely disabled
|
|
232
|
+
<img src="./assets/screenshots/03-readonly.png" alt="Docker Panel read-only mode by SoyRage Agency" width="90%">
|
|
233
|
+
|
|
234
|
+
<sub>Screenshots rendered in <b>demo mode</b> · watermarked © SoyRage Agency · soyrage.es</sub>
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
**Panel highlights**
|
|
239
|
+
|
|
240
|
+
- **Tabbed layout** — *Overview*, *Terminal*, *Files*, *Backups*, *System* and *Alerts*, with a live alert badge in the header.
|
|
241
|
+
- **Live monitoring + Trends** — CPU‑load and memory‑used cards with meters, per‑container CPU % and memory bars, and **historical sparkline charts** (sampled every 5s) for CPU and memory over time.
|
|
242
|
+
- **⌨️ AI‑powered terminal** — type `docker …` for typo‑tolerant, context‑aware completions (**Tab**/**↑↓**/**Enter**), **or** type a request in plain English (*“why did web crash”*) and pick **Ask AI** — the copilot proposes a command you review, then run. Commands are parsed to an argv array and spawned **without a shell**; a deny‑list blocks dangerous verbs and write verbs respect read‑only mode. AI uses any OpenAI‑compatible endpoint (OpenAI, **Ollama**, LM Studio…); without one it falls back to rule‑based suggestions.
|
|
243
|
+
- **📁 File explorer + editor** — browse any container's filesystem (breadcrumbs, up‑navigation), **open and edit** text/`.sh`/config files, and **Save** back into the container. An **AI edit** button rewrites the file from a plain‑English instruction. Safe, shell‑free `exec`; edits are blocked in read‑only mode.
|
|
244
|
+
- **📸 Snapshots & scheduled backups** — snapshot a container as an image (`commit`) or a filesystem `export` (`.tar`) to a chosen directory; schedule a daily backup (time, containers, type); a **webhook** forwards each backup to **email, Google Drive or S3** via Zapier / Make / n8n.
|
|
245
|
+
- **🧩 System tab** — networks and volumes at a glance; per‑container **inspect** details (env redacted, mounts, ports, restart policy) in the drawer.
|
|
246
|
+
- **♻️ Auto‑restart watchdog** — flip the *Auto* toggle and a background watchdog restarts a container whenever it exits (respects read‑only mode).
|
|
247
|
+
- **🚨 Alerts & log watch** — down/unhealthy containers, high CPU/memory, watchdog events, and **error/warn lines scanned from recent logs**.
|
|
248
|
+
- **Container grid** — colour‑coded state dots, ports as chips, **filter/search**, **auto‑refresh** toggle, and per‑row actions (details · files · snapshot · start/stop/restart).
|
|
249
|
+
- **Prometheus `/metrics`** — footer link exposes the scrape endpoint (see [Monitoring](#-monitoring-prometheus-zabbix--more)).
|
|
250
|
+
- **Demo mode** — `DOCKER_MCP_PANEL_DEMO=true` serves fabricated‑but‑realistic data (with gentle live jitter), perfect for previews and client demos with no daemon.
|
|
251
|
+
- **Zero UI dependencies** — hand‑written HTML/CSS/JS served by a Node‑core HTTP server.
|
|
252
|
+
|
|
253
|
+
**Panel REST API** (all local): `/api/snapshot` · `/api/history` · `/api/containers` · `/api/images` · `/api/logs` · `/api/action` · `/api/run` · `/api/ai` · `/api/files` · `/api/file` (GET read / POST save) · `/api/inspect` · `/api/networks` · `/api/volumes` · `/api/backups` · `/api/backup` · `/api/schedule` · `/api/alerts` · `/api/autorestart` · `/metrics`.
|
|
254
|
+
|
|
255
|
+
**AI copilot (optional):** set `DOCKER_MCP_AI_ENDPOINT` (+ `DOCKER_MCP_AI_KEY`, `DOCKER_MCP_AI_MODEL`) to power the AI terminal and AI file‑editing. Works with **OpenAI**, **Ollama** (`http://localhost:11434/v1`, free & local), **LM Studio**, or any OpenAI‑compatible API. Demo mode simulates it so you can try the UX offline.
|
|
256
|
+
|
|
257
|
+
> 🖼️ Regenerate the screenshots yourself with `npm run shots` (requires `npx playwright install chromium`).
|
|
258
|
+
|
|
259
|
+
### 🔒 Panel security & networking (VPN, IPs, ports)
|
|
260
|
+
|
|
261
|
+
The panel and terminal can control your host, so treat access like SSH.
|
|
262
|
+
|
|
263
|
+
- **Bind locally by default** — the panel listens on `127.0.0.1:4600`. Reach a remote host by **tunnelling over a VPN** — [WireGuard](https://www.wireguard.com/) or [Tailscale](https://tailscale.com/) — and browsing to the host's VPN IP. **Do not** port‑forward the panel to the public Internet.
|
|
264
|
+
- **If you must bind to the LAN**, set `DOCKER_MCP_PANEL_HOST=0.0.0.0`. On startup the server prints **every IP address it is reachable on** and a warning, e.g.:
|
|
265
|
+
```
|
|
266
|
+
Panel ready at http://0.0.0.0:4600
|
|
267
|
+
reachable at http://127.0.0.1:4600
|
|
268
|
+
reachable at http://10.8.0.3:4600 ← your WireGuard IP
|
|
269
|
+
reachable at http://192.168.1.42:4600 ← your LAN IP
|
|
270
|
+
Panel is bound to ALL interfaces … keep it behind a VPN or an authenticated reverse proxy.
|
|
271
|
+
```
|
|
272
|
+
- **Change the port** with `DOCKER_MCP_PANEL_PORT` (e.g. `8443`) to avoid clashes or sit behind a reverse proxy.
|
|
273
|
+
- **Port‑forwarding / reverse proxy** — if you expose it, put an authenticated proxy (Caddy/nginx/Traefik with Basic‑Auth or SSO + TLS) in front; never forward the raw port. Combine with `DOCKER_MCP_READONLY=true` for view‑only deployments, and `DOCKER_MCP_PANEL_TERMINAL=false` to disable the command runner.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## ⌨️ The terminal UI (TUI)
|
|
278
|
+
|
|
279
|
+
Prefer the terminal? Launch **`docker-mcp-tui`** — a creative, [lazydocker](https://github.com/jesseduffield/lazydocker)‑style dashboard that opens with a SoyRage Agency welcome and then drops you into a live, keyboard‑driven view. It’s hand‑rolled ANSI (no curses library), so it adds **zero dependencies**.
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
ragedocker tui # → interactive terminal dashboard (or: npm run tui)
|
|
283
|
+
npm run tui:demo # same, with realistic mock data (no daemon needed)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
<div align="center">
|
|
287
|
+
|
|
288
|
+
### A warm welcome — “thank you for using our repository ⭐”
|
|
289
|
+
<img src="./assets/screenshots/05-tui-welcome.png" alt="SoyRage Agency terminal welcome" width="80%">
|
|
290
|
+
|
|
291
|
+
### Live dashboard — gauges, details & one‑key actions
|
|
292
|
+
<img src="./assets/screenshots/04-tui.png" alt="Docker MCP terminal UI by SoyRage Agency" width="88%">
|
|
293
|
+
|
|
294
|
+
### AI copilot — give an order in plain English
|
|
295
|
+
<img src="./assets/screenshots/06-tui-ai.png" alt="AI copilot inside the Docker MCP terminal UI by SoyRage Agency" width="88%">
|
|
296
|
+
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
**AI copilot.** Press **`a`** (or `:`) to open the copilot bar and type what you want — *“restart the web container”*, *“stop the backup job”*, *“show every container”*. The copilot turns it into the exact `docker` command, shows it to you, and runs it only after you confirm with **`y`**. It speaks to any OpenAI‑compatible endpoint (`DOCKER_MCP_AI_ENDPOINT` / `DOCKER_MCP_AI_KEY` / `DOCKER_MCP_AI_MODEL`) and falls back to a built‑in rule engine in demo mode, so you can try it with **zero setup**.
|
|
300
|
+
|
|
301
|
+
**Action menu.** Press **`Enter`** (or **`m`**) over any container to open a menu of everything you can do to it — logs, inspect, **shell**, start/stop/restart, snapshot, **restore**, **attach a volume**, **edit compose**, copy id — arrow‑key navigable, so you never have to memorise a key. Every action also has a one‑key shortcut for power users.
|
|
302
|
+
|
|
303
|
+
**Animated status.** Containers no longer show a plain red/green dot: healthy ones *breathe* (`●`↔`◉`), starting/restarting ones spin (`⠋⠙⠹…`), unhealthy ones blink (`▲`), paused show `⏸`, exited `○` — a glance across the list reads like a heartbeat monitor.
|
|
304
|
+
|
|
305
|
+
**Keys:** `Enter`/`m` **menu** · `↑/↓` (or `j/k`) navigate · `g/G` top/bottom · **`/` filter** · `o` sort (`O` reverse) · `space` pause live updates · `l` logs (`f` follow, `+/-` tail) · **`i` inspect** · **`e` shell** · **`c` edit compose** · `y` copy id · `n`/`v`/`A` networks/volumes/alerts · **`a` AI** · `S`/`s`/`R` lifecycle · `b` snapshot · **`B` restore** · **`V` attach volume** · `u` what's new · `?` help · `q` quit.
|
|
306
|
+
Live CPU/memory gauges refresh automatically; the details pane shows lazydocker‑level info (health, uptime, command, restart policy, networks, mounts, env), lifecycle actions play a spinner animation, and read‑only mode hides the mutating keys (the copilot still explains, but never runs a mutating command).
|
|
307
|
+
|
|
308
|
+
**Update notices.** When a new version is published, both the TUI (a banner + `u` for the changelog) and the web panel (a dismissable banner) tell you — read from a single [`updates.json`](./updates.json) in the repo. It's silent on any failure and can be turned off with `DOCKER_MCP_NO_UPDATE_CHECK=1`.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 📈 Monitoring: Prometheus, Zabbix & more
|
|
313
|
+
|
|
314
|
+
The panel doubles as a **metrics exporter**. It serves a standard Prometheus text endpoint at **`/metrics`**, so your Docker host becomes a first‑class monitoring target with **no extra agent**.
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
npm run panel # metrics on by default
|
|
318
|
+
curl http://127.0.0.1:4600/metrics
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Exposed series** (labelled by `name`, `state`, `image` where relevant):
|
|
322
|
+
|
|
323
|
+
| Metric | Type | Meaning |
|
|
324
|
+
| --- | --- | --- |
|
|
325
|
+
| `dockermcp_up` | gauge | 1 when the exporter is running. |
|
|
326
|
+
| `dockermcp_build_info` | gauge | Build/author metadata (product, **author = SoyRage Agency**, version, url). |
|
|
327
|
+
| `dockermcp_host_cpus` | gauge | Logical CPUs on the host. |
|
|
328
|
+
| `dockermcp_host_memory_bytes` | gauge | Total host memory. |
|
|
329
|
+
| `dockermcp_containers_total` / `_running` | gauge | Container counts. |
|
|
330
|
+
| `dockermcp_images_total` | gauge | Cached images. |
|
|
331
|
+
| `dockermcp_cpu_percent_total` | gauge | Aggregate container CPU %. |
|
|
332
|
+
| `dockermcp_memory_used_bytes` | gauge | Aggregate container memory. |
|
|
333
|
+
| `dockermcp_container_running{…}` | gauge | 1 if a given container is running. |
|
|
334
|
+
| `dockermcp_container_cpu_percent{…}` | gauge | Per‑container CPU %. |
|
|
335
|
+
| `dockermcp_container_memory_bytes{…}` | gauge | Per‑container memory. |
|
|
336
|
+
| `dockermcp_container_autorestart{…}` | gauge | 1 if auto‑restart is enabled for it. |
|
|
337
|
+
| `dockermcp_autorestart_enabled` | gauge | Count of containers with auto‑restart on. |
|
|
338
|
+
| `dockermcp_alerts_active` | gauge | Number of active state‑based alerts. |
|
|
339
|
+
|
|
340
|
+
### Prometheus
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
# prometheus.yml
|
|
344
|
+
scrape_configs:
|
|
345
|
+
- job_name: docker-mcp
|
|
346
|
+
static_configs:
|
|
347
|
+
- targets: ["your-host:4600"]
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Zabbix
|
|
351
|
+
|
|
352
|
+
Use an **HTTP agent** item pointed at `http://your-host:4600/metrics`, then add
|
|
353
|
+
dependent items with the **Prometheus pattern** preprocessing step, e.g.
|
|
354
|
+
`dockermcp_containers_running` or
|
|
355
|
+
`dockermcp_container_cpu_percent{name="api"}`. Grafana, Grafana Agent,
|
|
356
|
+
VictoriaMetrics and Netdata can scrape the same endpoint.
|
|
357
|
+
|
|
358
|
+
> Turn the exporter off with `DOCKER_MCP_PANEL_METRICS=false` if you only want the UI.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## 🧩 Modular plugin architecture
|
|
363
|
+
|
|
364
|
+
The server is assembled from independent **plugins**, each owning one capability group. Which plugins load is driven entirely by configuration, so you can expose exactly the surface you want — from *insight only* to the full toolbox — **without touching code**. This also makes the project easy to extend.
|
|
365
|
+
|
|
366
|
+
| Plugin | Category | Type | Tools |
|
|
367
|
+
| --- | --- | --- | --- |
|
|
368
|
+
| `about` 🔒 | identity | read | `about`, `list_plugins` |
|
|
369
|
+
| `containers` | insight | read | `list_containers`, `inspect_container`, `container_stats` |
|
|
370
|
+
| `logs` | insight | read | `container_logs` |
|
|
371
|
+
| `images` | insight | read | `list_images` |
|
|
372
|
+
| `system` | system | read | `system_info`, `disk_usage`, `list_networks`, `list_volumes` |
|
|
373
|
+
| `compose` | compose | read/write | `compose_ps`, `compose_config`, `deploy_stack`, `compose_down`, `compose_restart`, `compose_pull` |
|
|
374
|
+
| `lifecycle` | lifecycle | write | `start`/`stop`/`restart`/`remove_container`, `exec_in_container` |
|
|
375
|
+
|
|
376
|
+
<sub>🔒 The `about` plugin is **locked** — it carries the SoyRage Agency identity and cannot be disabled.</sub>
|
|
377
|
+
|
|
378
|
+
**Toggle plugins** via environment variables or the config file:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Expose ONLY read-only insight (a safe, curated surface)
|
|
382
|
+
DOCKER_MCP_PLUGINS=containers,logs,images,system
|
|
383
|
+
|
|
384
|
+
# Load everything except container lifecycle
|
|
385
|
+
DOCKER_MCP_DISABLED_PLUGINS=lifecycle
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Ask the assistant **“list the plugins”** any time to see what’s enabled.
|
|
389
|
+
|
|
390
|
+
### Config file
|
|
391
|
+
|
|
392
|
+
For a reproducible setup, drop a **`docker-mcp.config.json`** in the project root (or point `DOCKER_MCP_CONFIG` at one). Environment variables always override it. See [`examples/docker-mcp.config.json`](./examples/docker-mcp.config.json):
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"readOnly": false,
|
|
397
|
+
"allowExec": false,
|
|
398
|
+
"containerAllowlist": ["web", "api"],
|
|
399
|
+
"plugins": { "enabled": [], "disabled": ["lifecycle"] },
|
|
400
|
+
"panel": { "host": "127.0.0.1", "port": 4600, "demo": false }
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
**Configuration precedence** (lowest → highest): built‑in defaults → `docker-mcp.config.json` → `.env` → real environment variables.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## 🛠️ How it works
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
┌──────────────────────────────────────────────┐
|
|
412
|
+
You ◀──────▶ │ AI assistant (Claude / Cursor / Continue …) │
|
|
413
|
+
└───────────────────────┬──────────────────────┘
|
|
414
|
+
stdio · JSON‑RPC (MCP)
|
|
415
|
+
┌───────────────────────▼──────────────────────┐
|
|
416
|
+
│ Docker MCP Server │
|
|
417
|
+
│ │
|
|
418
|
+
│ 1. Client sends `initialize` → server │
|
|
419
|
+
│ replies with tool schemas + SoyRage │
|
|
420
|
+
│ `instructions` (identity & welcome). │
|
|
421
|
+
│ 2. Model picks a tool and sends `tools/call`.│
|
|
422
|
+
│ 3. Server executes it against Docker and │
|
|
423
|
+
│ returns human‑readable text. │
|
|
424
|
+
└───────────┬───────────────────────┬──────────┘
|
|
425
|
+
Engine API │ spawn │ docker compose
|
|
426
|
+
┌───────────▼───────────┐ ┌──────────▼──────────┐
|
|
427
|
+
│ Docker Engine │ │ Compose plugin │
|
|
428
|
+
└───────────────────────┘ └─────────────────────┘
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
- **Engine operations** (containers, images, stats, logs, system info) use the Docker Engine API through [`dockerode`](https://github.com/apocas/dockerode).
|
|
432
|
+
- **Compose operations** shell out to the official `docker compose` CLI with a **shell‑free**, fully argument‑quoted spawn (no string interpolation, no injection surface).
|
|
433
|
+
- **stdout is sacred**: it carries only the JSON‑RPC stream. Every log line goes to **stderr**.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## ✅ Requirements
|
|
438
|
+
|
|
439
|
+
| Requirement | Notes |
|
|
440
|
+
| --- | --- |
|
|
441
|
+
| **Node.js ≥ 18** | ES modules + modern APIs. Node 20+ recommended. |
|
|
442
|
+
| **A reachable Docker Engine** | Local socket by default; remote TCP/TLS supported. |
|
|
443
|
+
| **`docker` CLI on `PATH`** | Only needed for the **Compose** tools. Insight/lifecycle tools work without it. |
|
|
444
|
+
| **An MCP client** | Claude Desktop, Cursor, Continue, Zed, or the MCP Inspector. |
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## 📦 Installation
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# 1. Clone
|
|
452
|
+
git clone https://github.com/<your-user>/docker-mcp-server.git
|
|
453
|
+
cd docker-mcp-server
|
|
454
|
+
|
|
455
|
+
# 2. Install dependencies
|
|
456
|
+
npm install
|
|
457
|
+
|
|
458
|
+
# 3. Build to dist/
|
|
459
|
+
npm run build
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Kick the tyres with the official MCP Inspector (no AI client required):
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npm run inspect
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
This opens a UI where you can list tools and call them by hand — perfect for verifying your Docker connection before wiring up an assistant.
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## 🔌 Connecting to your AI client
|
|
473
|
+
|
|
474
|
+
### Claude Desktop
|
|
475
|
+
|
|
476
|
+
Edit your Claude Desktop config file:
|
|
477
|
+
|
|
478
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
479
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
480
|
+
|
|
481
|
+
```jsonc
|
|
482
|
+
{
|
|
483
|
+
"mcpServers": {
|
|
484
|
+
"docker": {
|
|
485
|
+
"command": "npx",
|
|
486
|
+
"args": ["-y", "@soyrageagency/docker-mcp"],
|
|
487
|
+
"env": {
|
|
488
|
+
"DOCKER_MCP_READONLY": "false",
|
|
489
|
+
"DOCKER_MCP_ALLOW_EXEC": "false",
|
|
490
|
+
"DOCKER_MCP_DEFAULT_LOG_TAIL": "200"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
> A ready‑to‑edit copy lives in [`examples/claude_desktop_config.json`](./examples/claude_desktop_config.json).
|
|
498
|
+
|
|
499
|
+
No install step needed: `npx` fetches the package on first run and keeps it up to date. Restart Claude Desktop and ask: **“What containers are running?”**
|
|
500
|
+
|
|
501
|
+
### Cursor / Continue / Zed
|
|
502
|
+
|
|
503
|
+
Any MCP‑capable client works the same way — register a stdio server whose command is `npx` with the arguments `-y @soyrageagency/docker-mcp`, passing the same environment variables. Consult your client’s MCP documentation for the exact config location; the server block is identical.
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## ⚙️ Configuration reference
|
|
508
|
+
|
|
509
|
+
Every setting is an environment variable. A local **`.env`** file (next to `package.json`) is loaded automatically at startup; values already present in the process environment always win, so your MCP client can override the file. See [`.env.example`](./.env.example) for a commented template.
|
|
510
|
+
|
|
511
|
+
| Variable | Default | Description |
|
|
512
|
+
| --- | --- | --- |
|
|
513
|
+
| `DOCKER_HOST` | platform socket | Engine endpoint. Accepts `unix:///var/run/docker.sock`, `npipe:////./pipe/docker_engine`, or `tcp://host:port`. Empty = platform default. |
|
|
514
|
+
| `DOCKER_CERT_PATH` | — | Directory containing `ca.pem`, `cert.pem`, `key.pem` for a TLS‑secured remote daemon. |
|
|
515
|
+
| `DOCKER_TLS_VERIFY` | `false` | `1`/`true` to verify the daemon certificate (recommended for remote hosts). |
|
|
516
|
+
| `DOCKER_MCP_READONLY` | `false` | When `true`, **all** state‑changing tools are hidden — the server exposes insight only. |
|
|
517
|
+
| `DOCKER_MCP_ALLOW_EXEC` | `false` | When `true`, registers the `exec_in_container` tool (arbitrary in‑container commands). |
|
|
518
|
+
| `DOCKER_MCP_CONTAINER_ALLOWLIST` | — | Comma‑separated container **names or prefixes** the server may operate on. Empty = all. Prefix matching means `web` covers `web-1`, `web-2`. |
|
|
519
|
+
| `DOCKER_MCP_DEFAULT_LOG_TAIL` | `200` | Default number of log lines returned by `container_logs` when `tail` is omitted. |
|
|
520
|
+
| `DOCKER_MCP_COMPOSE_CWD` | process cwd | Base directory used to resolve **relative** Compose file paths. |
|
|
521
|
+
| `DOCKER_MCP_LOG_LEVEL` | `info` | Diagnostic verbosity written to stderr: `debug` \| `info` \| `warn` \| `error`. |
|
|
522
|
+
| `DOCKER_MCP_PLUGINS` | — | Load **only** these plugins (comma‑separated). Empty = all. |
|
|
523
|
+
| `DOCKER_MCP_DISABLED_PLUGINS` | — | Disable these plugins (comma‑separated). `about` is locked. |
|
|
524
|
+
| `DOCKER_MCP_PANEL_HOST` | `127.0.0.1` | Bind address for the interactive panel. |
|
|
525
|
+
| `DOCKER_MCP_PANEL_PORT` | `4600` | Port for the interactive panel. |
|
|
526
|
+
| `DOCKER_MCP_PANEL_DEMO` | `false` | Serve fabricated demo data in the panel/TUI. |
|
|
527
|
+
| `DOCKER_MCP_PANEL_METRICS` | `true` | Expose the Prometheus `/metrics` endpoint. |
|
|
528
|
+
| `DOCKER_MCP_PANEL_TERMINAL` | `true` | Enable the in‑panel command terminal. |
|
|
529
|
+
| `DOCKER_MCP_BACKUP_DIR` | `./snapshots` | Directory for container snapshots/exports. |
|
|
530
|
+
| `DOCKER_MCP_BACKUP_WEBHOOK` | — | Webhook called after each backup (email/cloud bridge). |
|
|
531
|
+
| `DOCKER_MCP_AI_ENDPOINT` | — | OpenAI‑compatible base URL for the AI copilot (empty = off). |
|
|
532
|
+
| `DOCKER_MCP_AI_KEY` | — | Bearer key for the AI endpoint. |
|
|
533
|
+
| `DOCKER_MCP_AI_MODEL` | `gpt-4o-mini` | Model name for the AI endpoint. |
|
|
534
|
+
| `DOCKER_MCP_CONFIG` | `docker-mcp.config.json` | Path to the optional JSON config file. |
|
|
535
|
+
|
|
536
|
+
**Boolean parsing:** any of `1`, `true`, `yes`, `on` (case‑insensitive) counts as true. A JSON **config file** provides defaults for all of the above — see [Config file](#config-file).
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## 🌐 Connecting to remote / TLS daemons
|
|
541
|
+
|
|
542
|
+
Manage a Docker host over the network by pointing `DOCKER_HOST` at its TCP endpoint. For anything beyond `localhost`, **always** use TLS.
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
# Plain TCP (trusted networks only!)
|
|
546
|
+
DOCKER_HOST=tcp://192.168.1.50:2375
|
|
547
|
+
|
|
548
|
+
# Secured TCP with mutual TLS
|
|
549
|
+
DOCKER_HOST=tcp://docker.internal:2376
|
|
550
|
+
DOCKER_TLS_VERIFY=1
|
|
551
|
+
DOCKER_CERT_PATH=/home/you/.docker/certs
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
When TLS is enabled the server reads `ca.pem`, `cert.pem` and `key.pem` from `DOCKER_CERT_PATH` and connects over HTTPS (default port `2376`; plain TCP defaults to `2375`).
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## 🛡️ Security model
|
|
559
|
+
|
|
560
|
+
This server can control your infrastructure, so it ships with defence‑in‑depth defaults. **You** decide how much power to grant.
|
|
561
|
+
|
|
562
|
+
| Control | What it does | Recommended for |
|
|
563
|
+
| --- | --- | --- |
|
|
564
|
+
| **Read‑only mode** (`DOCKER_MCP_READONLY=true`) | Hides every state‑changing tool. The model literally cannot see `stop`, `remove`, `deploy_stack`, etc. | Demos, dashboards, production insight. |
|
|
565
|
+
| **Container allowlist** (`DOCKER_MCP_CONTAINER_ALLOWLIST`) | Restricts *all* container tools to matching names/prefixes. Anything else returns a clear “not allowed” error. | Multi‑tenant hosts, “manage the app, never the database”. |
|
|
566
|
+
| **Opt‑in exec** (`DOCKER_MCP_ALLOW_EXEC`) | The powerful `exec_in_container` tool is **not registered** unless you enable it. | Keep disabled unless you specifically need it. |
|
|
567
|
+
| **Shell‑free Compose** | Compose commands are spawned as argument arrays — no shell, no interpolation. | Always on. |
|
|
568
|
+
| **Graceful errors** | A failing tool returns an `isError` text result instead of crashing the transport, so a bad call never takes the session down. | Always on. |
|
|
569
|
+
|
|
570
|
+
### Safety recipes
|
|
571
|
+
|
|
572
|
+
```bash
|
|
573
|
+
# Give a live demo with zero risk of mutation
|
|
574
|
+
DOCKER_MCP_READONLY=true
|
|
575
|
+
|
|
576
|
+
# Let the AI manage only the app tier, never data stores
|
|
577
|
+
DOCKER_MCP_CONTAINER_ALLOWLIST=web,api,worker
|
|
578
|
+
|
|
579
|
+
# Never allow shelling into containers (this is the default)
|
|
580
|
+
DOCKER_MCP_ALLOW_EXEC=false
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
> ⚠️ **Principle of least privilege.** Start read‑only, add an allowlist, and only enable writes/exec once you trust the setup. Treat the assistant as a very fast junior engineer: helpful, but you sign off on the destructive stuff.
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## 🧰 Complete tool reference
|
|
588
|
+
|
|
589
|
+
Tools marked **W** change state and are **hidden** when `DOCKER_MCP_READONLY=true`.
|
|
590
|
+
`exec_in_container` is additionally hidden unless `DOCKER_MCP_ALLOW_EXEC=true`.
|
|
591
|
+
|
|
592
|
+
### Identity
|
|
593
|
+
|
|
594
|
+
| Tool | Parameters | Description |
|
|
595
|
+
| --- | --- | --- |
|
|
596
|
+
| `about` | — | Returns the welcome banner, version and credits. |
|
|
597
|
+
| `list_plugins` | — | Lists the modular capability plugins and whether each is enabled. |
|
|
598
|
+
|
|
599
|
+
### Insight (read‑only)
|
|
600
|
+
|
|
601
|
+
| Tool | Parameters | Description |
|
|
602
|
+
| --- | --- | --- |
|
|
603
|
+
| `list_containers` | `all?: boolean` | List containers with state, image, status and published ports. `all` includes stopped ones. |
|
|
604
|
+
| `inspect_container` | `container: string` | Full low‑level config for one container (env, mounts, network, restart policy, health) plus a readable summary. |
|
|
605
|
+
| `container_stats` | `container: string` | One‑shot snapshot of live CPU %, memory usage/limit and network RX/TX. |
|
|
606
|
+
| `container_logs` | `container: string`, `tail?: number`, `since?: string`, `timestamps?: boolean` | Tail stdout/stderr. `since` accepts a Unix timestamp or a relative value like `10m`, `2h`, `1d`. Docker stream headers are demultiplexed automatically. |
|
|
607
|
+
| `list_images` | — | Locally cached images with `repo:tag`, short ID, size and age; plus total disk footprint. |
|
|
608
|
+
| `system_info` | — | Engine version, host OS/arch, kernel, CPU/RAM, storage driver and object counts. |
|
|
609
|
+
| `disk_usage` | — | Reclaimable space across images/containers/volumes (`docker system df`). |
|
|
610
|
+
| `list_networks` | — | Networks with driver and scope. |
|
|
611
|
+
| `list_volumes` | — | Named volumes with driver and mountpoint. |
|
|
612
|
+
|
|
613
|
+
### Compose — read‑only
|
|
614
|
+
|
|
615
|
+
| Tool | Parameters | Description |
|
|
616
|
+
| --- | --- | --- |
|
|
617
|
+
| `compose_ps` | `file: string`, `project?: string` | List a stack’s services and their state/health. `file` is a compose file **or** a directory containing one. |
|
|
618
|
+
| `compose_config` | `file`, `project?` | Validate and render the fully‑resolved Compose configuration (a non‑zero result means the file has errors). |
|
|
619
|
+
|
|
620
|
+
### Lifecycle (**W**)
|
|
621
|
+
|
|
622
|
+
| Tool | Parameters | Description |
|
|
623
|
+
| --- | --- | --- |
|
|
624
|
+
| `start_container` | `container` | Start a stopped container (no‑op if already running). |
|
|
625
|
+
| `stop_container` | `container`, `timeout?: number` | Graceful stop (SIGTERM → SIGKILL after `timeout` seconds, default 10). |
|
|
626
|
+
| `restart_container` | `container`, `timeout?: number` | Restart a container. |
|
|
627
|
+
| `remove_container` | `container`, `force?: boolean`, `removeVolumes?: boolean` | Remove a container. Destructive; `force` required if running. |
|
|
628
|
+
| `exec_in_container` | `container`, `command: string[]`, `workdir?: string` | Run a one‑off command (argument array, no shell) inside a running container. **Opt‑in only.** |
|
|
629
|
+
|
|
630
|
+
### Compose — state‑changing (**W**)
|
|
631
|
+
|
|
632
|
+
| Tool | Parameters | Description |
|
|
633
|
+
| --- | --- | --- |
|
|
634
|
+
| `deploy_stack` | `file`, `project?`, `build?: boolean`, `services?: string[]` | `docker compose up -d --remove-orphans` — deploy/refresh a stack, optionally rebuilding and scoped to services. |
|
|
635
|
+
| `compose_down` | `file`, `project?`, `removeVolumes?: boolean` | Stop and remove a stack. `removeVolumes` also deletes named volumes (destructive). |
|
|
636
|
+
| `compose_restart` | `file`, `project?`, `services?: string[]` | Restart all or selected services. |
|
|
637
|
+
| `compose_pull` | `file`, `project?`, `services?: string[]` | Pull the latest images for a stack (pair with `deploy_stack` for a rolling update). |
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## 💬 Example conversations
|
|
642
|
+
|
|
643
|
+
Natural‑language prompts and the tools the model will typically reach for:
|
|
644
|
+
|
|
645
|
+
| You say… | The assistant calls… |
|
|
646
|
+
| --- | --- |
|
|
647
|
+
| “What’s running right now?” | `list_containers` |
|
|
648
|
+
| “Show me everything, including stopped ones.” | `list_containers { all: true }` |
|
|
649
|
+
| “Why did `api` crash? Last 100 lines.” | `container_logs { container: "api", tail: 100 }` |
|
|
650
|
+
| “Anything in the `web` logs from the last 15 minutes?” | `container_logs { container: "web", since: "15m" }` |
|
|
651
|
+
| “Is `db` using a lot of memory?” | `container_stats { container: "db" }` |
|
|
652
|
+
| “Restart `nginx`.” | `restart_container { container: "nginx" }` |
|
|
653
|
+
| “Deploy the stack in `./prod` and rebuild.” | `deploy_stack { file: "./prod", build: true }` |
|
|
654
|
+
| “Which services are up in the demo stack?” | `compose_ps { file: "examples/demo-stack" }` |
|
|
655
|
+
| “How much disk is Docker using?” | `disk_usage` |
|
|
656
|
+
| “Who built this integration?” | `about` |
|
|
657
|
+
|
|
658
|
+
Want a stack to practise on? [`examples/demo-stack/compose.yaml`](./examples/demo-stack/compose.yaml) spins up **nginx + redis**. Try: *“Deploy the demo stack, then show me its services and the web logs.”*
|
|
659
|
+
|
|
660
|
+
---
|
|
661
|
+
|
|
662
|
+
## 🗂️ Project structure
|
|
663
|
+
|
|
664
|
+
```
|
|
665
|
+
docker-mcp-server/
|
|
666
|
+
├── assets/
|
|
667
|
+
│ ├── soyrage-banner.svg # SoyRage Agency identity banner (this README)
|
|
668
|
+
│ └── screenshots/ # Watermarked panel screenshots
|
|
669
|
+
├── examples/
|
|
670
|
+
│ ├── claude_desktop_config.json
|
|
671
|
+
│ ├── docker-mcp.config.json # Reproducible config-file example
|
|
672
|
+
│ └── demo-stack/
|
|
673
|
+
│ └── compose.yaml # nginx + redis playground
|
|
674
|
+
├── install.sh / install.ps1 # One-command bootstrap for beginners
|
|
675
|
+
├── scripts/
|
|
676
|
+
│ ├── install.mjs # Cross-platform Claude Desktop configurator
|
|
677
|
+
│ ├── copy-public.mjs # Copies panel assets into dist/ after build
|
|
678
|
+
│ ├── shots.mjs # Regenerates the panel screenshots (Playwright)
|
|
679
|
+
│ └── tui-shot.mjs # Renders the TUI to PNG (ANSI→HTML→Playwright)
|
|
680
|
+
├── src/
|
|
681
|
+
│ ├── index.ts # MCP entry point: banner, wiring
|
|
682
|
+
│ ├── branding.ts # SoyRage identity, ASCII banner, MCP instructions
|
|
683
|
+
│ ├── plugins.ts # Modular plugin catalogue & selection loader
|
|
684
|
+
│ ├── config.ts # Layered config (defaults → file → .env → env)
|
|
685
|
+
│ ├── logger.ts # stderr‑only structured logger (stdout is sacred)
|
|
686
|
+
│ ├── docker/
|
|
687
|
+
│ │ ├── client.ts # Typed dockerode wrapper + allowlist enforcement
|
|
688
|
+
│ │ └── compose.ts # Safe, shell‑free `docker compose` driver
|
|
689
|
+
│ ├── tools/ # One module per plugin's tools
|
|
690
|
+
│ │ ├── context.ts # Shared dependency bundle + plugin metadata
|
|
691
|
+
│ │ ├── about.ts # about / list_plugins (identity, locked)
|
|
692
|
+
│ │ ├── containers.ts # list / inspect / stats
|
|
693
|
+
│ │ ├── logs.ts # log tailing with stream demultiplexing
|
|
694
|
+
│ │ ├── lifecycle.ts # start / stop / restart / remove / exec
|
|
695
|
+
│ │ ├── images.ts # image inventory
|
|
696
|
+
│ │ ├── system.ts # system_info / disk_usage / networks / volumes
|
|
697
|
+
│ │ └── compose.ts # deploy / down / restart / pull / ps / config
|
|
698
|
+
│ ├── panel/ # Interactive web dashboard
|
|
699
|
+
│ │ ├── index.ts # Panel entry point (docker-mcp-panel binary)
|
|
700
|
+
│ │ ├── server.ts # Node‑core HTTP server + REST API + /metrics
|
|
701
|
+
│ │ ├── service.ts # UI/monitoring data layer, stats & Prometheus
|
|
702
|
+
│ │ └── public/ # Hand‑written SPA (index.html, styles.css, app.js)
|
|
703
|
+
│ ├── tui/ # Terminal UI (docker-mcp-tui binary)
|
|
704
|
+
│ │ ├── index.ts # TUI entry point (+ --frame/--splash snapshots)
|
|
705
|
+
│ │ ├── app.ts # Interactive app: welcome, gauges, key handling
|
|
706
|
+
│ │ ├── box.ts # Rounded box renderer
|
|
707
|
+
│ │ └── ansi.ts # ANSI colours, cursor control, width-aware pads
|
|
708
|
+
│ └── utils/
|
|
709
|
+
│ ├── format.ts # tables, byte & time humanisers
|
|
710
|
+
│ └── result.ts # MCP result helpers + error guard
|
|
711
|
+
├── docker-mcp.config.json # (optional) your config file
|
|
712
|
+
├── .env.example # Commented configuration template
|
|
713
|
+
├── LICENSE # MIT License
|
|
714
|
+
└── README.md
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
## 🧠 Design principles
|
|
720
|
+
|
|
721
|
+
1. **stdout is reserved** for the JSON‑RPC protocol stream; every diagnostic goes to **stderr**. Violating this corrupts the MCP connection — the logger enforces it.
|
|
722
|
+
2. **No shell interpolation.** Compose commands are spawned with an argument array, never a shell string, eliminating command‑injection risk.
|
|
723
|
+
3. **Fail soft.** A handler that throws returns a clean `isError` text result the model can read and recover from, instead of tearing down the transport.
|
|
724
|
+
4. **One concern per module.** Tools are grouped by capability; each group is a small, focused file that receives its dependencies explicitly (no globals).
|
|
725
|
+
5. **Tiny dependency surface.** A hand‑rolled `.env` loader keeps `dotenv` out; only `@modelcontextprotocol/sdk`, `dockerode` and `zod` are runtime dependencies.
|
|
726
|
+
6. **Safety by construction.** Read‑only mode and the allowlist are checked at the boundary, so an unsafe call can’t slip through a forgotten branch.
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## 🧪 Development
|
|
731
|
+
|
|
732
|
+
```bash
|
|
733
|
+
npm run dev # hot‑reload the MCP server with tsx
|
|
734
|
+
npm run typecheck # strict type check, no emit
|
|
735
|
+
npm run build # compile to dist/ and copy panel assets
|
|
736
|
+
npm run start # run the built MCP server
|
|
737
|
+
npm run inspect # launch the MCP Inspector against the built server
|
|
738
|
+
npm run panel # run the interactive panel (with /metrics)
|
|
739
|
+
npm run panel:dev # hot‑reload the panel with tsx
|
|
740
|
+
npm run panel:demo # run the panel with demo data
|
|
741
|
+
npm run tui # run the terminal UI
|
|
742
|
+
npm run tui:demo # run the terminal UI with demo data
|
|
743
|
+
npm run shots # regenerate panel screenshots (needs Playwright chromium)
|
|
744
|
+
npm run clean # remove dist/
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
**Coding standards:** TypeScript `strict` with `noUnusedLocals`, `noUnusedParameters`, `noImplicitReturns` and `noFallthroughCasesInSwitch`.
|
|
748
|
+
|
|
749
|
+
**Continuous integration:** [`.github/workflows/ci.yml`](./.github/workflows/ci.yml) runs on every push/PR — install, type‑check, build, then the **deep end‑to‑end suite** (`node scripts/deep-test.mjs`, **70 checks**) against a headless demo panel. Run it locally anytime:
|
|
750
|
+
|
|
751
|
+
```bash
|
|
752
|
+
npm run build
|
|
753
|
+
DOCKER_MCP_PANEL_DEMO=true DOCKER_MCP_PANEL_PORT=4600 node dist/panel/index.js &
|
|
754
|
+
node scripts/deep-test.mjs
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
---
|
|
758
|
+
|
|
759
|
+
## 🩺 Troubleshooting & FAQ
|
|
760
|
+
|
|
761
|
+
<details>
|
|
762
|
+
<summary><b>“Could not reach the Docker daemon.”</b></summary>
|
|
763
|
+
|
|
764
|
+
The server started but couldn’t connect to Docker. Check that:
|
|
765
|
+
- Docker Desktop / the daemon is **running**.
|
|
766
|
+
- `DOCKER_HOST` is correct for your platform (empty = default socket).
|
|
767
|
+
- On Linux, your user can access the socket (`docker` group) or you’re running with sufficient permissions.
|
|
768
|
+
|
|
769
|
+
The server intentionally **keeps running** so tool calls return a friendly error inside your chat client instead of crashing.
|
|
770
|
+
</details>
|
|
771
|
+
|
|
772
|
+
<details>
|
|
773
|
+
<summary><b>Compose tools return “the `docker` CLI was not found on PATH”.</b></summary>
|
|
774
|
+
|
|
775
|
+
The Compose tools shell out to `docker compose`. Install Docker Desktop or the `docker-compose-plugin`, and make sure `docker` is on the `PATH` of the environment your MCP client launches the server in.
|
|
776
|
+
</details>
|
|
777
|
+
|
|
778
|
+
<details>
|
|
779
|
+
<summary><b>The assistant can’t see my write tools.</b></summary>
|
|
780
|
+
|
|
781
|
+
You’re probably in read‑only mode. Set `DOCKER_MCP_READONLY=false` (the default) and restart your MCP client so it re‑reads the tool list.
|
|
782
|
+
</details>
|
|
783
|
+
|
|
784
|
+
<details>
|
|
785
|
+
<summary><b>A container “is not covered by the allowlist”.</b></summary>
|
|
786
|
+
|
|
787
|
+
`DOCKER_MCP_CONTAINER_ALLOWLIST` is set and the target doesn’t match. Add its name/prefix to the list, or clear the variable to allow all.
|
|
788
|
+
</details>
|
|
789
|
+
|
|
790
|
+
<details>
|
|
791
|
+
<summary><b>Is my data sent anywhere?</b></summary>
|
|
792
|
+
|
|
793
|
+
No. This server talks only to your Docker daemon and your MCP client over local stdio. It makes no outbound network calls of its own.
|
|
794
|
+
</details>
|
|
795
|
+
|
|
796
|
+
---
|
|
797
|
+
|
|
798
|
+
## 🗺️ Roadmap
|
|
799
|
+
|
|
800
|
+
- [x] Interactive web panel with live monitoring + historical charts
|
|
801
|
+
- [x] Creative terminal UI (TUI)
|
|
802
|
+
- [x] Prometheus `/metrics` endpoint (Prometheus/Zabbix ready)
|
|
803
|
+
- [x] AI‑powered terminal & file editing (OpenAI‑compatible)
|
|
804
|
+
- [x] One‑command installer + CI (build/typecheck/70‑check e2e)
|
|
805
|
+
- [ ] `follow_logs` streaming with server‑sent progress
|
|
806
|
+
- [ ] Image pull/build tools with progress reporting
|
|
807
|
+
- [ ] Prune tools (`docker system prune`) gated behind explicit confirmation
|
|
808
|
+
- [ ] MCP **resources** for read‑only container/stack snapshots
|
|
809
|
+
- [ ] Native SMTP + direct S3/Drive backup destinations
|
|
810
|
+
- [x] Published npm package for one‑line `npx` usage
|
|
811
|
+
|
|
812
|
+
Ideas and PRs welcome — see below.
|
|
813
|
+
|
|
814
|
+
---
|
|
815
|
+
|
|
816
|
+
## 🤝 Contributing
|
|
817
|
+
|
|
818
|
+
Contributions are welcome! Please:
|
|
819
|
+
|
|
820
|
+
1. Open an issue describing the change before large PRs.
|
|
821
|
+
2. Keep the **stderr‑only logging** and **shell‑free Compose** invariants intact.
|
|
822
|
+
3. Run `npm run typecheck && npm run build` before submitting.
|
|
823
|
+
|
|
824
|
+
---
|
|
825
|
+
|
|
826
|
+
## 🏢 About SoyRage Agency
|
|
827
|
+
|
|
828
|
+
<div align="center">
|
|
829
|
+
|
|
830
|
+
<a href="https://soyrage.es/"><img src="./assets/soyrage-banner.svg" alt="SoyRage Agency" width="88%"></a>
|
|
831
|
+
|
|
832
|
+
</div>
|
|
833
|
+
|
|
834
|
+
**SoyRage Agency** is a full‑stack development & infrastructure studio based in **Valencia, Spain**, building tools where **DevOps meets AI**. We craft polished, production‑minded software for developers and the self‑hosting community.
|
|
835
|
+
|
|
836
|
+
- 🌐 Web: **[soyrage.es](https://soyrage.es/)**
|
|
837
|
+
- 🧑💻 Focus: full‑stack development · infrastructure engineering · AI tooling
|
|
838
|
+
- 📫 Work with us: **[soyrage.es](https://soyrage.es/)**
|
|
839
|
+
|
|
840
|
+
If this project is useful to you, a ⭐ on the repo and a link back to **[soyrage.es](https://soyrage.es/)** genuinely help us keep building in the open. Thank you! 🙌
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
## 🧰 More from the SoyRage self‑hosting suite
|
|
845
|
+
|
|
846
|
+
Docker MCP Server is part of a family of open‑source infrastructure tools built with the same care — same design language, same safety‑first defaults, same "chat with your infra" philosophy:
|
|
847
|
+
|
|
848
|
+
| Project | What it does |
|
|
849
|
+
| --- | --- |
|
|
850
|
+
| 🐳 **[Docker MCP Server](https://github.com/soyrageagency/docker-mcp-server)** | *(you are here)* Chat with your Docker host — containers, logs, Compose, a live panel & a TUI copilot. |
|
|
851
|
+
| 🖧 **[Proxmox MCP Server](https://github.com/soyrageagency/proxmox-mcp-server)** | Chat with your Proxmox VE cluster — nodes, VMs & LXC, snapshots and full guest CRUD, plus a tabbed terminal dashboard with an AI command bar. |
|
|
852
|
+
| 🚚 **[VMware → Proxmox Toolkit (V2P)](https://github.com/soyrageagency/vmware-to-proxmox)** | Leaving vSphere after the Broadcom price hikes? Inventory vCenter, score compatibility, estimate cost & time, plan disk conversion and export a professional PDF assessment. |
|
|
853
|
+
| 🗺️ **[NetAtlas](https://github.com/soyrageagency/netatlas)** | Living infrastructure documentation — agentless discovery that auto-generates a network diagram, inventory, VLAN & service-dependency maps, and tells you what changed since last time. |
|
|
854
|
+
| 🛡️ **[MailAegis](https://github.com/soyrageagency/mailaegis)** | Corporate email threat analyzer — VirusTotal, ClamAV and an in-house phishing/BEC engine, inside a mail client. |
|
|
855
|
+
|
|
856
|
+
---
|
|
857
|
+
|
|
858
|
+
## 💙 Support the project
|
|
859
|
+
|
|
860
|
+
Docker MCP Server is free and MIT licensed. If it saves you time, you can [support development on PayPal](https://www.paypal.com/paypalme/soyrageagency) — a ⭐ on the repo helps just as much.
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
## 🖋️ Credits & License
|
|
865
|
+
|
|
866
|
+
<div align="center">
|
|
867
|
+
|
|
868
|
+
**Designed, built and maintained by [SoyRage Agency](https://soyrage.es/) — https://soyrage.es/**
|
|
869
|
+
|
|
870
|
+
</div>
|
|
871
|
+
|
|
872
|
+
Released under the **[MIT License](./LICENSE)** — use it, modify it, self-host it, ship it commercially.
|
|
873
|
+
|
|
874
|
+
If you build something on top of it, a link back to [soyrage.es](https://soyrage.es/) is appreciated but never required.
|
|
875
|
+
|
|
876
|
+
<div align="center">
|
|
877
|
+
|
|
878
|
+
**© 2026 SoyRage Agency — https://soyrage.es/**
|
|
879
|
+
|
|
880
|
+
Made with ❤ in Valencia, Spain.
|
|
881
|
+
|
|
882
|
+
</div>
|