better-caprover-mcp 0.0.0 → 0.1.1
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/README.md +207 -21
- package/dist/main.js +411 -411
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="design/svg/horizontal-dark.svg" />
|
|
4
|
+
<img src="design/svg/horizontal-light.svg" alt="better-caprover-mcp" width="420" />
|
|
5
|
+
</picture>
|
|
6
|
+
</h1>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<p align="center">
|
|
9
|
+
<strong>Let your AI agent operate your CapRover: deploy, configure and read logs, with a read-only default and a confirmation step before anything is deleted.</strong>
|
|
10
|
+
<br />
|
|
11
|
+
<em>An unofficial MCP server, one command with npx or Docker. Works with Claude, Cursor, Codex and any client that speaks MCP. Not affiliated with CapRover.</em>
|
|
12
|
+
</p>
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://better-caprover-mcp.guilherr.me"><img src="https://img.shields.io/badge/Website-b6f259" alt="Website" /></a>
|
|
16
|
+
<a href="#quick-start"><img src="https://img.shields.io/badge/Quick_start-b6f259" alt="Quick start" /></a>
|
|
17
|
+
<a href="https://www.npmjs.com/package/better-caprover-mcp"><img src="https://img.shields.io/npm/v/better-caprover-mcp?color=b6f259&label=npm" alt="npm version" /></a>
|
|
18
|
+
<a href="https://github.com/guilhermebkel/better-caprover-mcp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/guilhermebkel/better-caprover-mcp/ci.yml?branch=main&label=CI" alt="CI" /></a>
|
|
19
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow" alt="License: MIT" /></a>
|
|
20
|
+
<img src="https://img.shields.io/badge/Telemetry-none-2ea44f" alt="No telemetry" />
|
|
21
|
+
</p>
|
|
6
22
|
|
|
7
|
-
|
|
23
|
+
---
|
|
8
24
|
|
|
9
|
-
|
|
25
|
+
**Giving an agent the keys to a server is the hard part.** A CapRover password is full access, and a model that can call "delete app" will sooner or later call it when it should not.
|
|
10
26
|
|
|
11
|
-
|
|
27
|
+
`better-caprover-mcp` gives the agent 14 named operations over the CapRover API and puts the safety in code, not in a prompt. The server starts in `readonly` mode and a mode only goes up when you restart it with another setting. Every change can be previewed with `dry_run`. Deleting does nothing until the person has seen what would be lost and said yes, and the password and the values of your environment variables never come back in a reply.
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
> **The mode is the barrier, not the model's good manners.** In `readonly` the write tools are not even registered, and every call is checked again when it runs.
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## What you get
|
|
34
|
+
|
|
35
|
+
<table>
|
|
36
|
+
<tr>
|
|
37
|
+
<td width="50%" valign="top">
|
|
38
|
+
|
|
39
|
+
**Safe by default**
|
|
40
|
+
|
|
41
|
+
Starts `readonly`. `operate` lets the agent change apps, `admin` also lets it delete. Only you can raise the mode.
|
|
42
|
+
|
|
43
|
+
</td>
|
|
44
|
+
<td width="50%" valign="top">
|
|
45
|
+
|
|
46
|
+
**Preview before it writes**
|
|
47
|
+
|
|
48
|
+
Every change takes `dry_run` and returns what would change, without a write call to CapRover.
|
|
49
|
+
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td valign="top">
|
|
54
|
+
|
|
55
|
+
**Confirmation before a delete**
|
|
56
|
+
|
|
57
|
+
`delete_app` returns a preview and a one-time token tied to that exact call. It runs only when the call comes back with the token and the person's yes.
|
|
58
|
+
|
|
59
|
+
</td>
|
|
60
|
+
<td valign="top">
|
|
61
|
+
|
|
62
|
+
**No secrets in the replies**
|
|
63
|
+
|
|
64
|
+
Env var values are never returned (only `isSet`). The password and the values of an app's variables are masked in logs and errors.
|
|
65
|
+
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
</table>
|
|
69
|
+
|
|
70
|
+
## Quick start
|
|
71
|
+
|
|
72
|
+
You need the address of your CapRover (`https://captain.your-domain.com`) and its password. CapRover has no user name, and servers with two-factor login turned on are not supported ([ADR 0010](docs/adr/0010-the-server-logs-in-with-the-password-only.md)).
|
|
73
|
+
|
|
74
|
+
### 1. Add it to your client
|
|
75
|
+
|
|
76
|
+
Claude Code:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
claude mcp add caprover \
|
|
80
|
+
-e CAPROVER_URL=https://captain.your-domain.com \
|
|
81
|
+
-e CAPROVER_PASSWORD=your-password \
|
|
82
|
+
-- npx -y better-caprover-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Claude Desktop, Cursor and other clients, with `npx`:
|
|
16
86
|
|
|
17
87
|
```json
|
|
18
88
|
{
|
|
@@ -30,7 +100,7 @@ With `npx`, in the client configuration (Claude Desktop and Cursor use this form
|
|
|
30
100
|
}
|
|
31
101
|
```
|
|
32
102
|
|
|
33
|
-
|
|
103
|
+
Or with Docker (`-i` is required: the server talks over stdin and stdout):
|
|
34
104
|
|
|
35
105
|
```json
|
|
36
106
|
{
|
|
@@ -48,16 +118,39 @@ With Docker (`-i` is required: the server talks over stdin and stdout):
|
|
|
48
118
|
}
|
|
49
119
|
```
|
|
50
120
|
|
|
51
|
-
|
|
121
|
+
### 2. Check the login
|
|
52
122
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
123
|
+
```bash
|
|
124
|
+
CAPROVER_URL=https://captain.your-domain.com CAPROVER_PASSWORD=... npx -y better-caprover-mcp init
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`init` tests the login and prints the client configuration above. Without the two variables it only prints the configuration.
|
|
128
|
+
|
|
129
|
+
### 3. Ask
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
Which of my apps run an image tagged latest?
|
|
133
|
+
Set LOG_LEVEL=debug on the api app, but show me what changes first.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
To let the agent change apps, set `CAPROVER_MCP_MODE=operate`; for deleting, `admin`.
|
|
137
|
+
|
|
138
|
+
## Example
|
|
139
|
+
|
|
140
|
+
<sub>Real output of the built server against a CapRover 1.15.5. The agent asks to delete an app; nothing is deleted yet.</sub>
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
> delete_app {"app_name":"e2e-app"}
|
|
144
|
+
Not run. Would delete the app e2e-app (1 instances, image caprover/caprover-placeholder-app:latest,
|
|
145
|
+
0 custom domains) and 0 volumes. This cannot be undone. Show this to the person. Only if they say yes,
|
|
146
|
+
call delete_app again with the same inputs, user_confirmed true and this confirmation_token.
|
|
147
|
+
{"requires_confirmation":true,"confirmation_token":"718ebc698036ae0622c1246c60a46e0c","appName":"e2e-app",...}
|
|
59
148
|
|
|
60
|
-
|
|
149
|
+
> delete_app {"app_name":"e2e-app","user_confirmed":true,"confirmation_token":"718ebc698036ae0622c1246c60a46e0c"}
|
|
150
|
+
Deleted the app e2e-app and 0 volumes.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
A token that was used, expired (5 minutes) or made for another call is refused, and the reply carries a new preview.
|
|
61
154
|
|
|
62
155
|
## Access modes
|
|
63
156
|
|
|
@@ -85,9 +178,87 @@ The mode decides which operations the client sees at all. Only the person can ch
|
|
|
85
178
|
| `add_custom_domain`, `enable_ssl` | write | Attach a domain; turn on HTTPS |
|
|
86
179
|
| `delete_app` | destructive | Delete an app, and its volumes only if asked |
|
|
87
180
|
|
|
88
|
-
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
| Variable | Default | Meaning |
|
|
184
|
+
| --- | --- | --- |
|
|
185
|
+
| `CAPROVER_URL` | none | The address of your CapRover, with `http://` or `https://`. Only its origin is used |
|
|
186
|
+
| `CAPROVER_PASSWORD` | none | The CapRover password |
|
|
187
|
+
| `CAPROVER_MCP_MODE` | `readonly` | `readonly`, `operate` or `admin` |
|
|
188
|
+
| `CAPROVER_MCP_ALLOW_CRITICAL` | off | Set to `1` to unlock critical operations in `admin` mode. No operation is critical yet |
|
|
189
|
+
|
|
190
|
+
Without `CAPROVER_URL` and `CAPROVER_PASSWORD` the server still starts, and every call tells the model what is missing.
|
|
191
|
+
|
|
192
|
+
## How it works
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
agent ──▶ 1. MODE ──▶ 2. VALIDATE ──▶ 3. PREVIEW / CONFIRM ──▶ 4. CALL ──▶ 5. REDACT
|
|
196
|
+
(MCP) is the tool strict schema, dry_run, or a token CapRover mask password
|
|
197
|
+
registered? errors list for a delete API (SDK) and env values
|
|
198
|
+
valid values
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The work is split on purpose:
|
|
202
|
+
|
|
203
|
+
| Part | Does | Why |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| **Operations** (`src/Operations/`) | One class per thing a person does, with its schema, risk tier and description | One manifest feeds every surface and the policy |
|
|
206
|
+
| **Policy and runner** (`src/Services/`) | Applies the mode, `dry_run`, the confirmation token and the masking | Rules that cannot fail live in code with a test, never only in a prompt |
|
|
207
|
+
| **CapRover adapter** (`src/Adapters/CapRover/`) | The only place that imports the official `caprover-api` SDK | The SDK is experimental; one folder absorbs its changes |
|
|
208
|
+
|
|
209
|
+
Decisions are in [`docs/adr/`](docs/adr/), the rules operations follow in [`docs/mcp-standards.md`](docs/mcp-standards.md).
|
|
210
|
+
|
|
211
|
+
## Privacy and safety
|
|
212
|
+
|
|
213
|
+
- **The only network exit is your `CAPROVER_URL`.** No telemetry, no analytics, nothing else is contacted.
|
|
214
|
+
- **The server never runs a command on your machine and does not read your files.** It only reads its environment variables.
|
|
215
|
+
- **Secrets stay out.** The password and env var values are masked in every reply, log and error, and tested with fake secrets.
|
|
216
|
+
- **The CapRover password is full access.** The modes are enforced by this server, not by CapRover, so give it to a client you trust.
|
|
217
|
+
|
|
218
|
+
Found a way around any of this? Open an issue without secrets in it.
|
|
89
219
|
|
|
90
|
-
##
|
|
220
|
+
## How it compares
|
|
221
|
+
|
|
222
|
+
- **The CapRover dashboard and CLI** are the reference for doing it by hand. This server lets an agent do the same steps, with a preview and a confirmation you control.
|
|
223
|
+
- **A generic MCP wrapper over the HTTP API** typically gives the agent every endpoint with no modes and no confirmation. Here there is no "send any request" tool: that SDK method is left out on purpose ([ADR 0003](docs/adr/0003-one-manifest-for-every-operation.md)).
|
|
224
|
+
- **Other CapRover MCP servers** exist. This one is a separate, unrelated project, with a one-command setup and the safety rules above.
|
|
225
|
+
|
|
226
|
+
## FAQ
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary><b>Does it work with CapRover's two-factor login?</b></summary>
|
|
230
|
+
|
|
231
|
+
No. The code lasts 30 seconds and a client starts this server again every session, so it cannot be kept in an environment variable. The server logs in with the password only ([ADR 0010](docs/adr/0010-the-server-logs-in-with-the-password-only.md)).
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
<summary><b>Can the agent raise its own mode?</b></summary>
|
|
237
|
+
|
|
238
|
+
No. The mode is read at startup from the environment, and nothing the agent can call changes it. Tell it to ask you, and restart the server with `CAPROVER_MCP_MODE=operate` or `admin`.
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
242
|
+
<details>
|
|
243
|
+
<summary><b>Why does `get_app_runtime` fail on my CapRover?</b></summary>
|
|
244
|
+
|
|
245
|
+
The endpoint it uses is missing in older CapRover versions (1.15.5 has none). The reply says so and points to `get_app_logs` and `get_build_logs`.
|
|
246
|
+
|
|
247
|
+
</details>
|
|
248
|
+
|
|
249
|
+
## Roadmap
|
|
250
|
+
|
|
251
|
+
- [x] **Core:** 14 operations on the `tools` surface, access modes, `dry_run`, confirmation token, redaction, tested against a real CapRover.
|
|
252
|
+
- [ ] **The rest of the CapRover API** (about 56 more SDK methods): [#3](https://github.com/guilhermebkel/better-caprover-mcp/issues/3)
|
|
253
|
+
- [ ] **Diagnostics** (`diagnose_app`, `find_issues`): [#4](https://github.com/guilhermebkel/better-caprover-mcp/issues/4)
|
|
254
|
+
- [ ] **Code Mode** (`search` and `execute` in a sandbox) and a benchmark: [#5](https://github.com/guilhermebkel/better-caprover-mcp/issues/5)
|
|
255
|
+
- [ ] **Remote HTTP and several CapRover servers:** [#6](https://github.com/guilhermebkel/better-caprover-mcp/issues/6)
|
|
256
|
+
|
|
257
|
+
## Contributing
|
|
258
|
+
|
|
259
|
+
Issues and pull requests are welcome. Start with [`AGENTS.md`](AGENTS.md), which says what to read for each kind of task; vocabulary is in [GLOSSARY.md](GLOSSARY.md) and design decisions in [`docs/adr/`](docs/adr/).
|
|
260
|
+
|
|
261
|
+
### Development
|
|
91
262
|
|
|
92
263
|
Needs the Node version in `.nvmrc` and pnpm.
|
|
93
264
|
|
|
@@ -101,6 +272,21 @@ pnpm check # typecheck, lint, dead code, duplication, SDK drift, tests, build
|
|
|
101
272
|
|
|
102
273
|
`pnpm smoke -- docker run -i --rm <image>` runs the same smoke test against an image. Read `AGENTS.md` first: it says what to read for each kind of task.
|
|
103
274
|
|
|
104
|
-
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
<p align="center">
|
|
278
|
+
<strong>Let the agent operate. Keep the keys in your hands.</strong>
|
|
279
|
+
</p>
|
|
280
|
+
|
|
281
|
+
<p align="center">
|
|
282
|
+
<a href="https://www.star-history.com/#guilhermebkel/better-caprover-mcp&Date">
|
|
283
|
+
<picture>
|
|
284
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=guilhermebkel/better-caprover-mcp&type=Date&theme=dark" />
|
|
285
|
+
<img alt="Star history" src="https://api.star-history.com/svg?repos=guilhermebkel/better-caprover-mcp&type=Date" width="600" />
|
|
286
|
+
</picture>
|
|
287
|
+
</a>
|
|
288
|
+
</p>
|
|
105
289
|
|
|
106
|
-
|
|
290
|
+
<p align="center">
|
|
291
|
+
MIT License © Guilherme Mota
|
|
292
|
+
</p>
|