panelica-mcp 0.2.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Panelica Server Management Panel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,560 @@
1
+ # Panelica MCP Server
2
+
3
+ > Talk to your [Panelica](https://panelica.com) hosting panel in plain English.
4
+ > Provision a domain, issue an SSL certificate, create a database, or restart a
5
+ > service through Claude Desktop, Cursor, ChatGPT, or any other
6
+ > [Model Context Protocol](https://modelcontextprotocol.io) client.
7
+
8
+ [![Tools](https://img.shields.io/badge/tools-404-blue)](tools/tools.json)
9
+ [![Scopes](https://img.shields.io/badge/permission%20scopes-50-8A2BE2)](#permission-scopes)
10
+ [![Docker](https://img.shields.io/badge/ghcr.io-panelica%2Fpanelica--mcp-2496ED?logo=docker&logoColor=white)](https://github.com/Panelica/panelica-mcp/pkgs/container/panelica-mcp)
11
+ [![Zero drift](https://img.shields.io/badge/catalogue-auto--generated%20weekly-brightgreen)](#keeping-the-tool-catalogue-current)
12
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
13
+
14
+ 404 tools cover the entire External API surface — accounts, domains, DNS,
15
+ SSL, email, MySQL, FTP, security, backups, server resources, and more.
16
+
17
+ ---
18
+
19
+ ## Table of Contents
20
+
21
+ - [How it works](#how-it-works)
22
+ - [Requirements](#requirements)
23
+ - [Install](#install)
24
+ - [Option A — npm (recommended)](#option-a--npm-recommended)
25
+ - [Option B — Docker](#option-b--docker)
26
+ - [Option C — Build from source](#option-c--build-from-source)
27
+ - [Configuration](#configuration)
28
+ - [1. Open the External API port](#1-open-the-external-api-port)
29
+ - [2. Generate an API key in the panel](#2-generate-an-api-key-in-the-panel)
30
+ - [3. Verify the credentials with curl](#3-verify-the-credentials-with-curl)
31
+ - [Wire it into your MCP client](#wire-it-into-your-mcp-client)
32
+ - [Claude Desktop](#claude-desktop)
33
+ - [Cursor](#cursor)
34
+ - [Continue.dev, Cline, Zed](#continuedev-cline-zed)
35
+ - [Generic stdio client](#generic-stdio-client)
36
+ - [Tool catalogue](#tool-catalogue)
37
+ - [Example sessions](#example-sessions)
38
+ - [Permission scopes](#permission-scopes)
39
+ - [Security model](#security-model)
40
+ - [Troubleshooting](#troubleshooting)
41
+ - [Development](#development)
42
+ - [Versioning & support](#versioning--support)
43
+ - [License](#license)
44
+
45
+ ---
46
+
47
+ ## How it works
48
+
49
+ ```
50
+ +----------------+ stdio JSON-RPC +-------------------+
51
+ | MCP client | <----------------------------> | panelica-mcp |
52
+ | (Claude, ...) | | (this package) |
53
+ +----------------+ +---------+---------+
54
+ |
55
+ HTTPS + HMAC-SHA256|
56
+ X-API-Key |
57
+ X-Timestamp |
58
+ X-Signature |
59
+ v
60
+ +------------------------------+------------------------------+
61
+ | https://<panel-host>:8443/api/external/v1/... |
62
+ | nginx reverse proxy on the panel host |
63
+ | (TLS termination + path rewrite: /api/external/X -> /X) |
64
+ +------------------------------+------------------------------+
65
+ |
66
+ 127.0.0.1:3002 plain |
67
+ v
68
+ +----------------+-----------------+
69
+ | external-server (HMAC verify) |
70
+ +----------------+-----------------+
71
+ |
72
+ v
73
+ +----------------+-----------------+
74
+ | Panelica panel + Linux services |
75
+ +----------------------------------+
76
+ ```
77
+
78
+ `panelica-mcp` is a thin, stateless adapter:
79
+
80
+ 1. The MCP client launches the binary over stdio.
81
+ 2. The client asks for the tool list — the server reads `tools/tools.json`
82
+ (404 entries, auto-generated from the panel's live API spec) and returns it.
83
+ 3. When the client calls a tool, the server builds the corresponding HTTP
84
+ request, signs it with HMAC-SHA256 using your local `PANELICA_API_SECRET`,
85
+ and forwards it to the panel.
86
+ 4. The HTTP response is returned to the client as the tool result.
87
+
88
+ No data is cached, no telemetry is emitted, and the secret never leaves the
89
+ machine running the MCP server.
90
+
91
+ ## Requirements
92
+
93
+ - A running Panelica panel (version 1.0.193 or newer recommended; the External
94
+ API surface is stable from 1.0.180+).
95
+ - HTTPS access to the panel UI on port 8443 from the machine that will run
96
+ `panelica-mcp`. This is the same port you already use in the browser — no
97
+ extra firewall change is required.
98
+ - One of the following runtimes on that machine:
99
+ - **Node.js ≥ 20** for the npm install path
100
+ - **Docker** for the container path
101
+
102
+ You do **not** need to install anything on the panel host itself, and you do
103
+ **not** need to open the internal port 3002 to the public internet.
104
+
105
+ ## Install
106
+
107
+ Pick whichever fits your MCP client setup. All three produce the same stdio
108
+ binary; pick by which sandbox model you prefer.
109
+
110
+ ### Option A — npm (recommended)
111
+
112
+ ```bash
113
+ npm install -g panelica-mcp
114
+ ```
115
+
116
+ or run without installing (the MCP client launches `npx` for you):
117
+
118
+ ```bash
119
+ npx -y panelica-mcp
120
+ ```
121
+
122
+ The `-y` flag accepts npm's "install on first run" prompt non-interactively,
123
+ which is what MCP clients need.
124
+
125
+ ### Option B — Docker
126
+
127
+ A pre-built image is published to GitHub Container Registry on every release:
128
+
129
+ ```bash
130
+ docker pull ghcr.io/panelica/panelica-mcp:latest
131
+ ```
132
+
133
+ Run it from an MCP client config:
134
+
135
+ ```json
136
+ {
137
+ "command": "docker",
138
+ "args": [
139
+ "run", "--rm", "-i",
140
+ "-e", "PANELICA_BASE_URL",
141
+ "-e", "PANELICA_API_KEY",
142
+ "-e", "PANELICA_API_SECRET",
143
+ "ghcr.io/panelica/panelica-mcp:latest"
144
+ ],
145
+ "env": {
146
+ "PANELICA_BASE_URL": "https://your-panel-host:8443/api/external",
147
+ "PANELICA_API_KEY": "pk_...",
148
+ "PANELICA_API_SECRET": "sk_..."
149
+ }
150
+ }
151
+ ```
152
+
153
+ `-i` keeps stdin attached so the MCP client can talk to the container.
154
+ `--rm` removes the container when the client disconnects.
155
+
156
+ ### Option C — Build from source
157
+
158
+ ```bash
159
+ git clone https://github.com/Panelica/panelica-mcp.git
160
+ cd panelica-mcp
161
+ npm install
162
+ npm run build
163
+ node dist/index.js # speaks MCP over stdio
164
+ ```
165
+
166
+ To regenerate `tools/tools.json` from your panel's live API spec:
167
+
168
+ ```bash
169
+ PANELICA_SPEC_URL="https://your-panel:8443/api/external/v1/api-spec" npm run rebuild-tools
170
+ ```
171
+
172
+ ## Configuration
173
+
174
+ You need three values: a reachable base URL, an API key, and an API secret.
175
+
176
+ ### 1. Pick the right base URL
177
+
178
+ Panelica's `external-server` process listens on `127.0.0.1:3002`, and the
179
+ panel's nginx on **8443** reverse-proxies `/api/external/...` to it. Nginx
180
+ strips the `/api/external` prefix before forwarding, so the path the HMAC
181
+ signature is computed over and the path the backend sees both end up as
182
+ `/v1/...` — signatures match end-to-end without any extra knobs.
183
+
184
+ The right `PANELICA_BASE_URL` depends on where you run `panelica-mcp`:
185
+
186
+ | Scenario | Recommended `PANELICA_BASE_URL` |
187
+ |---|---|
188
+ | MCP client on your laptop, panel on a remote server | `https://<panel-host>:8443/api/external` |
189
+ | MCP client and panel on the **same** machine | `http://127.0.0.1:3002` |
190
+
191
+ You should **not** open port 3002 to the public internet. The default install
192
+ binds it on all interfaces but expects it to be either firewalled or only
193
+ reached through the 8443 reverse proxy.
194
+
195
+ Sanity-check the proxy from your machine:
196
+
197
+ ```bash
198
+ curl -sk https://<panel-host>:8443/api/external/health
199
+ # {"status":"ok"} or similar
200
+ ```
201
+
202
+ If you get a TLS error, that is the panel's self-signed certificate — install
203
+ a real cert on the panel (panel UI → Settings → SSL) rather than disabling
204
+ verification client-side.
205
+
206
+ ### 2. Generate an API key in the panel
207
+
208
+ 1. Sign in to the panel as **root** or any account with permission to manage
209
+ API keys.
210
+ 2. Navigate to **Settings → API Keys → Generate API Key**.
211
+ 3. Pick the scopes you want the MCP server to have. For a read-only assistant,
212
+ `*:read` is enough. For full automation, grant `*:write` too. Every tool's
213
+ `description` in this server lists the scopes it requires.
214
+ 4. Copy both **key** (looks like `pk_...`) and **secret** (looks like `sk_...`).
215
+ The secret is shown **only once**; store it in a password manager.
216
+
217
+ ### 3. Verify the credentials with curl
218
+
219
+ Before you wire the MCP client up, prove the credentials work end-to-end:
220
+
221
+ ```bash
222
+ export PANELICA_BASE_URL=https://your-panel-host:8443/api/external
223
+ export PANELICA_API_KEY=pk_xxxxxxxx
224
+ export PANELICA_API_SECRET=sk_xxxxxxxx
225
+
226
+ TS=$(date +%s)
227
+ # Signature is over METHOD + PATH + TIMESTAMP + BODY. The path is the
228
+ # backend-visible path (/v1/...) — NOT the /api/external/ prefix that nginx
229
+ # strips before forwarding. panelica-mcp does this automatically.
230
+ SIG=$(printf "GET/v1/api-keys${TS}" \
231
+ | openssl dgst -sha256 -hmac "$PANELICA_API_SECRET" -hex | awk '{print $2}')
232
+
233
+ curl -sk "$PANELICA_BASE_URL/v1/api-keys" \
234
+ -H "X-API-Key: $PANELICA_API_KEY" \
235
+ -H "X-Timestamp: $TS" \
236
+ -H "X-Signature: $SIG"
237
+ ```
238
+
239
+ You should get back JSON listing your API keys. Common 401 responses:
240
+
241
+ | `error.code` | Likely cause |
242
+ |---|---|
243
+ | `MISSING_API_KEY` / `MISSING_TIMESTAMP` / `MISSING_SIGNATURE` | Header is empty — re-check the curl flags |
244
+ | `INVALID_KEY_FORMAT` | The `PANELICA_API_KEY` value is malformed |
245
+ | `INVALID_TIMESTAMP` | Local clock drifted more than 5 minutes — sync NTP |
246
+ | `INVALID_SIGNATURE` | Wrong secret, **or** the path you signed includes `/api/external/` (it must not — nginx strips it before the backend sees it) |
247
+
248
+ ## Wire it into your MCP client
249
+
250
+ ### Claude Desktop
251
+
252
+ Edit your Claude Desktop config:
253
+
254
+ - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
255
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
256
+ - **Linux (Claude Desktop beta):** `~/.config/Claude/claude_desktop_config.json`
257
+
258
+ ```json
259
+ {
260
+ "mcpServers": {
261
+ "panelica": {
262
+ "command": "npx",
263
+ "args": ["-y", "panelica-mcp"],
264
+ "env": {
265
+ "PANELICA_BASE_URL": "https://your-panel-host:8443/api/external",
266
+ "PANELICA_API_KEY": "pk_...",
267
+ "PANELICA_API_SECRET": "sk_..."
268
+ }
269
+ }
270
+ }
271
+ }
272
+ ```
273
+
274
+ Save, fully quit Claude Desktop (not just close the window — *Quit*), and
275
+ re-open it. A new chat will show `panelica` as a connected MCP server with
276
+ "404 tools available".
277
+
278
+ ### Cursor
279
+
280
+ In **Settings → MCP → Add new server**:
281
+
282
+ ```json
283
+ {
284
+ "panelica": {
285
+ "command": "npx",
286
+ "args": ["-y", "panelica-mcp"],
287
+ "env": {
288
+ "PANELICA_BASE_URL": "https://your-panel-host:8443/api/external",
289
+ "PANELICA_API_KEY": "pk_...",
290
+ "PANELICA_API_SECRET": "sk_..."
291
+ }
292
+ }
293
+ }
294
+ ```
295
+
296
+ ### Continue.dev, Cline, Zed
297
+
298
+ Any MCP-aware editor that accepts a stdio command works the same way — give it
299
+ `npx -y panelica-mcp` (or the absolute path to the built `dist/index.js`) and
300
+ the three environment variables.
301
+
302
+ ### Generic stdio client
303
+
304
+ ```bash
305
+ PANELICA_BASE_URL=https://your-panel-host:8443/api/external \
306
+ PANELICA_API_KEY=pk_... \
307
+ PANELICA_API_SECRET=sk_... \
308
+ panelica-mcp
309
+ ```
310
+
311
+ The process speaks MCP JSON-RPC over stdin/stdout. Send an `initialize`
312
+ request first, then `tools/list`, then `tools/call`.
313
+
314
+ ## Tool catalogue
315
+
316
+ **404 tools** are auto-generated from the panel's live `/v1/api-spec`, so they never
317
+ drift from the API. Each tool carries MCP safety annotations
318
+ (![read-only](https://img.shields.io/badge/-read--only-brightgreen) 181 ·
319
+ ![mutating](https://img.shields.io/badge/-mutating-orange) 177 ·
320
+ ![destructive](https://img.shields.io/badge/-destructive-red) 46)
321
+ that capable clients use to auto-approve reads and warn before destructive calls.
322
+
323
+ | Category | Tools |
324
+ |----------|------:|
325
+ | Git | 43 |
326
+ | Domains | 32 |
327
+ | Logs | 26 |
328
+ | File Manager | 23 |
329
+ | Laravel Apps | 21 |
330
+ | Python Apps | 19 |
331
+ | Node.js Apps | 18 |
332
+ | Accounts | 16 |
333
+ | CloudFlare | 12 |
334
+ | Docker | 12 |
335
+ | IP Addresses | 9 |
336
+ | Cron Jobs | 8 |
337
+ | Email | 8 |
338
+ | FTP | 8 |
339
+ | Security | 8 |
340
+ | Databases | 7 |
341
+ | Spam | 7 |
342
+ | SSH Users | 7 |
343
+ | WordPress | 7 |
344
+ | API Keys | 6 |
345
+ | License | 6 |
346
+ | MySQL Users | 6 |
347
+ | Server | 6 |
348
+ | Webhooks | 6 |
349
+ | Backups | 5 |
350
+ | DNS | 5 |
351
+ | Migrations | 5 |
352
+ | Plans | 5 |
353
+ | Snapshots | 5 |
354
+ | 2FA | 4 |
355
+ | Antivirus | 4 |
356
+ | Backup Schedules | 4 |
357
+ | Mailing Lists | 4 |
358
+ | SSL | 4 |
359
+ | Bandwidth | 3 |
360
+ | Config Locks | 3 |
361
+ | Core | 3 |
362
+ | Remote MySQL | 3 |
363
+ | Sessions | 3 |
364
+ | Subdomains | 3 |
365
+ | Terminal | 3 |
366
+ | Audit | 2 |
367
+ | Metrics | 2 |
368
+ | Notifications | 2 |
369
+ | Panel Settings | 2 |
370
+ | Resource Quota | 2 |
371
+ | SMTP Relay | 2 |
372
+ | System Cron | 2 |
373
+ | Mail Queue | 1 |
374
+ | PHP | 1 |
375
+ | Redirects | 1 |
376
+
377
+ Full machine-readable list: [`tools/tools.json`](tools/tools.json).
378
+
379
+ ## Example sessions
380
+
381
+ After wiring the server up, try these in your MCP client:
382
+
383
+ **Domain provisioning.**
384
+ > *"Create a new account for `alice@example.com` on the `starter` plan, then
385
+ > add the domain `alice-shop.com` to it and issue a Let's Encrypt
386
+ > certificate."*
387
+
388
+ The assistant will pick up `panelica_accounts_post_v1_accounts`,
389
+ `panelica_domains_post_v1_domains`, and `panelica_ssl_post_v1_ssl_...` from
390
+ the catalogue, fill in the parameters from the conversation, and call them in
391
+ sequence. You can watch the calls happen in the client's tool log.
392
+
393
+ **Diagnostic.**
394
+ > *"Show me the last 24 hours of bandwidth usage for `alice-shop.com` and tell
395
+ > me whether it is on track to exceed the plan quota this month."*
396
+
397
+ **Bulk cleanup.**
398
+ > *"List every domain whose SSL certificate expires in the next 14 days and
399
+ > renew them all."*
400
+
401
+ **DNS migration.**
402
+ > *"For the zone `alice-shop.com`, list the current A and CNAME records, then
403
+ > add `www` as a CNAME to `alice-shop.com` and an A record for `mail`
404
+ > pointing to `203.0.113.10`."*
405
+
406
+ The assistant will only invoke tools whose scopes are granted to your API
407
+ key, so a read-only key safely answers "list" questions but refuses
408
+ "create / delete".
409
+
410
+ ## Permission scopes
411
+
412
+ API keys are scoped — grant an AI assistant exactly the access it needs, nothing
413
+ more. **No scope is preselected** when creating a key in the panel, and the
414
+ create dialog has live search over all 50 scopes.
415
+ ![read](https://img.shields.io/badge/-read-brightgreen) view/list only · ![write](https://img.shields.io/badge/-write-orange) create/update · ![delete](https://img.shields.io/badge/-delete-red) remove · ![special](https://img.shields.io/badge/-special-blue) special access.
416
+ Every family also accepts its wildcard (`domains:*`) and `*:*` grants everything.
417
+
418
+ | Area | Scopes |
419
+ |------|--------|
420
+ | Accounts | `accounts:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `accounts:write` ![write](https://img.shields.io/badge/-write-orange) · `accounts:delete` ![delete](https://img.shields.io/badge/-delete-red) |
421
+ | Domains & subdomains | `domains:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `domains:write` ![write](https://img.shields.io/badge/-write-orange) · `domains:delete` ![delete](https://img.shields.io/badge/-delete-red) |
422
+ | Databases | `databases:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `databases:write` ![write](https://img.shields.io/badge/-write-orange) · `databases:delete` ![delete](https://img.shields.io/badge/-delete-red) |
423
+ | DNS | `dns:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `dns:write` ![write](https://img.shields.io/badge/-write-orange) · `dns:delete` ![delete](https://img.shields.io/badge/-delete-red) |
424
+ | Email | `email:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `email:write` ![write](https://img.shields.io/badge/-write-orange) · `email:delete` ![delete](https://img.shields.io/badge/-delete-red) |
425
+ | FTP | `ftp:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `ftp:write` ![write](https://img.shields.io/badge/-write-orange) · `ftp:delete` ![delete](https://img.shields.io/badge/-delete-red) |
426
+ | SSL | `ssl:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `ssl:write` ![write](https://img.shields.io/badge/-write-orange) |
427
+ | Backups & snapshots | `backups:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `backups:write` ![write](https://img.shields.io/badge/-write-orange) · `backups:restore` ![special](https://img.shields.io/badge/-special-blue) |
428
+ | File Manager | `files:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `files:write` ![write](https://img.shields.io/badge/-write-orange) · `files:delete` ![delete](https://img.shields.io/badge/-delete-red) |
429
+ | CloudFlare | `cloudflare:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `cloudflare:write` ![write](https://img.shields.io/badge/-write-orange) · `cloudflare:delete` ![delete](https://img.shields.io/badge/-delete-red) |
430
+ | Docker & app templates | `docker:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `docker:write` ![write](https://img.shields.io/badge/-write-orange) · `docker:delete` ![delete](https://img.shields.io/badge/-delete-red) |
431
+ | App hosting (Laravel / Node.js / Python) | `apps:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `apps:write` ![write](https://img.shields.io/badge/-write-orange) · `apps:delete` ![delete](https://img.shields.io/badge/-delete-red) |
432
+ | Git & Deploy | `git:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `git:write` ![write](https://img.shields.io/badge/-write-orange) · `git:delete` ![delete](https://img.shields.io/badge/-delete-red) |
433
+ | Logs & audit | `logs:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `logs:write` ![write](https://img.shields.io/badge/-write-orange) |
434
+ | Security (antivirus, firewall, IP blocks) | `security:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `security:write` ![write](https://img.shields.io/badge/-write-orange) · `security:delete` ![delete](https://img.shields.io/badge/-delete-red) |
435
+ | Server & infrastructure | `server:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `server:write` ![write](https://img.shields.io/badge/-write-orange) |
436
+ | Service control | `services:restart` ![special](https://img.shields.io/badge/-special-blue) · `services:start` ![special](https://img.shields.io/badge/-special-blue) · `services:stop` ![special](https://img.shields.io/badge/-special-blue) |
437
+ | Plans | `plans:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `plans:write` ![write](https://img.shields.io/badge/-write-orange) |
438
+ | Webhooks | `webhooks:read` ![read](https://img.shields.io/badge/-read-brightgreen) · `webhooks:write` ![write](https://img.shields.io/badge/-write-orange) · `webhooks:delete` ![delete](https://img.shields.io/badge/-delete-red) |
439
+ | Bandwidth | `bandwidth:read` ![read](https://img.shields.io/badge/-read-brightgreen) |
440
+ | License | `license:read` ![read](https://img.shields.io/badge/-read-brightgreen) |
441
+ | Migrations (panel-to-panel) | `migrations:read` ![read](https://img.shields.io/badge/-read-brightgreen) |
442
+ | Terminal | `terminal:access` ![special](https://img.shields.io/badge/-special-blue) |
443
+ | Full access | `*:*` ![special](https://img.shields.io/badge/-special-blue) |
444
+
445
+ Mutating service control deliberately requires its own action scopes (or
446
+ `server:write`) — a metrics-only `server:read` key can **not** stop MySQL.
447
+
448
+ ## Security model
449
+
450
+ - **HMAC-SHA256 request signing.** Every request is signed over
451
+ `METHOD + PATH + QUERY + TIMESTAMP + BODY` with your API secret. The panel
452
+ rejects requests whose timestamp drifts more than 5 minutes from server
453
+ clock, so replays are not possible.
454
+ - **Secrets stay local.** The API secret is read from the process environment
455
+ and used only to compute the signature. It is never logged, sent to any
456
+ third party, or written to disk.
457
+ - **Scope-restricted keys.** Generate one API key per use case. Grant only
458
+ the scopes that use case needs — e.g. `domains:read` for a read-only
459
+ assistant, `*:write` only for full automation.
460
+ - **Audit trail.** Every request hits the panel's normal audit logging and
461
+ RBAC. Actions taken via MCP are indistinguishable from any other
462
+ authenticated API call and can be traced to the API key that performed
463
+ them.
464
+ - **No data harvesting.** This server emits no telemetry, writes no cache,
465
+ and contacts no third party.
466
+ - **Container hardening.** The Docker image runs as a non-root user and
467
+ exposes no ports — it speaks only stdio.
468
+
469
+ ## Troubleshooting
470
+
471
+ | Symptom | Likely cause | Fix |
472
+ |---------|--------------|-----|
473
+ | Client reports "0 tools available" | Server crashed at startup — usually a missing env var | Run `panelica-mcp` once from a shell with the three env vars set; read stderr |
474
+ | `401 MISSING_API_KEY` | `PANELICA_API_KEY` not set or wrong header passthrough | Re-check the MCP client config; restart the client after editing |
475
+ | `401 INVALID_SIGNATURE` | Wrong `PANELICA_API_SECRET`, or clock drift > 5 min | `chronyc tracking` (or `timedatectl status`) on both the MCP host and panel host |
476
+ | `401 INVALID_TIMESTAMP` | Local clock drift > 5 min | Sync NTP on the MCP host |
477
+ | Connect timeout on `BASE_URL` | Wrong host/port — typically `:8443/api/external` was missed off the URL | Verify with `curl -sk $PANELICA_BASE_URL/health` — should return `{"status":"ok"}` |
478
+ | `403 FORBIDDEN` on a tool | API key lacks the required scope | Regenerate the key in the panel with the scope listed in the tool's description |
479
+ | Tool description says "Schema not statically extractable" | The endpoint uses dynamic request bodies | Pass a free-form `body` object; the panel will validate and tell you the missing fields with a 400 response |
480
+ | TLS verification fails | Panel is using its self-signed cert | If the MCP host trusts that CA, this works out of the box. If not, deploy a real cert on the panel (panel UI → Settings → SSL) — do not disable TLS verification client-side |
481
+
482
+ If you are still stuck, open an issue at
483
+ [github.com/Panelica/panelica-mcp/issues](https://github.com/Panelica/panelica-mcp/issues)
484
+ with the (redacted) stderr output.
485
+
486
+ ## Development
487
+
488
+ ```bash
489
+ git clone https://github.com/Panelica/panelica-mcp.git
490
+ cd panelica-mcp
491
+ npm install
492
+ npm run build
493
+ node dist/index.js
494
+ ```
495
+
496
+ Project layout:
497
+
498
+ ```
499
+ .
500
+ ├── src/index.ts # MCP server (stdio transport, HMAC client)
501
+ ├── tools/
502
+ │ ├── build-tools.mjs # Generates tools.json from the API spec
503
+ │ ├── api-spec.json # Committed snapshot of the live /v1/api-spec
504
+ │ └── tools.json # 404 tool definitions, auto-generated (committed)
505
+ ├── .github/workflows/
506
+ │ └── refresh-tools.yml # Weekly CI: regenerate from the live API, commit if changed
507
+ ├── Dockerfile
508
+ ├── smithery.yaml # Smithery deployment manifest
509
+ ├── .env.example
510
+ └── README.md
511
+ ```
512
+
513
+ ### Keeping the tool catalogue current
514
+
515
+ The catalogue never drifts from the API by hand. The backend serves an
516
+ always-current `/v1/api-spec` (built from its route registry), and the tools are
517
+ regenerated from it:
518
+
519
+ ```bash
520
+ # Rebuild from the committed snapshot (offline):
521
+ npm run rebuild-tools
522
+
523
+ # Pull the live spec, refresh the snapshot, and rebuild:
524
+ PANELICA_SPEC_URL="https://your-panel:8443/api/external/v1/api-spec" npm run rebuild-tools
525
+ ```
526
+
527
+ CI (`refresh-tools.yml`) runs this weekly against the panel named in the
528
+ `PANELICA_SPEC_URL` repository variable and commits any changes, so a new API
529
+ endpoint becomes an MCP tool automatically. Each tool is tagged with safety
530
+ annotations (`readOnlyHint` for `GET`, `destructiveHint` for `DELETE`) that
531
+ capable MCP clients use to auto-approve reads and warn before destructive calls.
532
+
533
+ A separate, internal dataset of every panel endpoint (1,263 total) exists for
534
+ training purposes — only the **404 documented External API endpoints** are
535
+ exposed through this package. Internal panel endpoints, recorded DEV data,
536
+ and training jsonl files are not part of the public repository.
537
+
538
+ ## Versioning & support
539
+
540
+ - This package follows the Panelica panel's External API. Tool signatures
541
+ change only when the panel itself ships a backward-incompatible API change,
542
+ and the package's major version is bumped to match.
543
+ - New endpoints become available the next time we regenerate
544
+ `tools/tools.json` and publish a release.
545
+ - Panel issues (the API itself, not this client): the Panelica forum at
546
+ [forum.panelica.com](https://forum.panelica.com).
547
+ - Client / packaging issues:
548
+ [github.com/Panelica/panelica-mcp/issues](https://github.com/Panelica/panelica-mcp/issues).
549
+
550
+ ## License
551
+
552
+ MIT. See [LICENSE](LICENSE).
553
+
554
+ ## Links
555
+
556
+ - Panel website: <https://panelica.com>
557
+ - Live demo: <https://demo.panelica.com>
558
+ - Documentation: <https://panelica.com/docs>
559
+ - Forum & support: <https://forum.panelica.com>
560
+ - Public installer: <https://latest.panelica.com/install.sh>