@solomonneas/proxmox-mcp 0.5.1 → 0.13.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/README.md CHANGED
@@ -2,14 +2,17 @@
2
2
  <img src="docs/assets/proxmox-mcp-social-preview.jpg" alt="proxmox-mcp banner" width="900">
3
3
  </p>
4
4
 
5
+ <p align="center">
6
+ <a href="https://lidless.dev"><img src="docs/assets/marks/proxmox-mcp-circle.png" width="48" alt="Lidless Labs"></a>
7
+ </p>
5
8
  <h1 align="center">proxmox-mcp</h1>
6
9
 
7
10
  <p align="center">
8
- <strong>A Proxmox VE operator CLI and MCP adapter for reading and safely operating clusters, VMs, containers, and nodes over plain API-token auth.</strong>
11
+ <strong>An MCP server that lets an AI client read and operate a Proxmox VE cluster, VMs, containers, and nodes, over plain API-token auth.</strong>
9
12
  </p>
10
13
 
11
14
  <p align="center">
12
- Why: your homelab lives in Proxmox, and you want an agent to inventory it, boot a guest, or trace a task without you clicking through the web UI. How it differs: a strict three-tier write gate is built into every tool, so reads are open but anything that changes state needs an explicit confirm flag, and anything destructive needs two more gates on top. <strong>Status: WIP.</strong> The tool surface and the safety model are stable, but the package is still pre-1.0 and the latest published release is <code>0.3.0</code>.
15
+ Why: your homelab lives in Proxmox, and you want an agent to inventory it, boot a guest, or trace a task without you clicking through the web UI. How it differs: a strict three-tier write gate is built into every tool, so reads are open but anything that changes state needs an explicit confirm flag, and anything destructive needs two more gates on top. <strong>Status: WIP.</strong> The tool surface and the safety model are stable, but the package is still pre-1.0. The package version is <code>0.13.0</code>.
13
16
  </p>
14
17
 
15
18
  <p align="center">
@@ -25,13 +28,13 @@
25
28
 
26
29
  ## What it does
27
30
 
28
- proxmoxctrl is an open-source operator CLI for [Proxmox VE](https://www.proxmox.com/en/proxmox-virtual-environment/overview), the open-source virtualization platform. The same package ships `proxmox-mcp`, a [Model Context Protocol](https://modelcontextprotocol.io) adapter for AI clients (Claude Desktop, Claude Code, OpenClaw, Codex CLI, or any MCP host). Together they provide a structured, gated interface to a Proxmox cluster: inventory VMs and LXC containers, inspect node and storage status, read RRD metrics, trace tasks, manage snapshots and backups, run gated reads and shell commands inside guests, and provision, clone, or destroy resources, all over Proxmox API-token auth.
31
+ proxmox-mcp is an open-source [Model Context Protocol](https://modelcontextprotocol.io) server for [Proxmox VE](https://www.proxmox.com/en/proxmox-virtual-environment/overview), the open-source virtualization platform. It gives an AI client (Claude Desktop, Claude Code, OpenClaw, Codex CLI, or any MCP host) a structured, gated interface to a Proxmox cluster: inventory VMs and LXC containers, inspect node and storage status, read RRD metrics, trace tasks, manage snapshots and backups, run gated reads and shell commands inside guests, and provision, clone, or destroy resources, all over Proxmox API-token auth.
29
32
 
30
- It is built for homelab and virtualization operators who want to point an agent at their cluster without handing it a root shell. The differentiator is the write-safety model: 42 tools split across four tiers, where reads need nothing, safe writes need `confirm: true`, and destructive operations need `confirm: true` + `destructive: true` + a process-level `PROXMOX_ENABLE_DESTRUCTIVE=1` env flag. A hallucinated or careless tool call fails closed, before any HTTP traffic reaches Proxmox.
33
+ It is built for homelab and virtualization operators who want to point an agent at their cluster without handing it a root shell. The differentiator is the write-safety model: 102 tools split across four tiers, where reads need nothing, safe writes need `confirm: true`, and destructive operations need `confirm: true` + `destructive: true` + a process-level `PROXMOX_ENABLE_DESTRUCTIVE=1` env flag. A hallucinated or careless tool call fails closed, before any HTTP traffic reaches Proxmox.
31
34
 
32
35
  ## Proof
33
36
 
34
- A real MCP client config. Drop this into Claude Desktop (`claude_desktop_config.json`) and the 42 tools appear in the client. Reads work immediately; the destructive env gate stays off until you opt in.
37
+ A real MCP client config. Drop this into Claude Desktop (`claude_desktop_config.json`) and the 102 tools appear in the client. Reads work immediately; the destructive env gate stays off until you opt in.
35
38
 
36
39
  ```json
37
40
  {
@@ -42,7 +45,7 @@ A real MCP client config. Drop this into Claude Desktop (`claude_desktop_config.
42
45
  "env": {
43
46
  "PROXMOX_URL": "https://192.0.2.10:8006",
44
47
  "PROXMOX_TOKEN_ID": "pve-admin@pam!api-token-1",
45
- "PROXMOX_TOKEN_SECRET": "00000000-0000-0000-0000-000000000000",
48
+ "PROXMOX_TOKEN_SECRET": "REPLACE_WITH_TOKEN_SECRET",
46
49
  "PROXMOX_TLS_INSECURE": "false"
47
50
  }
48
51
  }
@@ -50,10 +53,14 @@ A real MCP client config. Drop this into Claude Desktop (`claude_desktop_config.
50
53
  }
51
54
  ```
52
55
 
53
- ### Tool list (42 tools, verified against source)
56
+ ### Tool list (102 tools: 49 Tier-1 read, 44 Tier-2 including 4 gated guest reads, and 9 Tier-3; verified against source)
54
57
 
55
58
  Tier markers below are authoritative: each tool's gate is enforced in code (`src/gates.ts` + per-tool schema), and `WriteGateError` fires before any HTTP call when a gate is unmet.
56
59
 
60
+ ![proxmox-mcp safety workflow: read tools inventory the cluster and trace tasks, guest reads require confirmation, safe writes stay gated, and destructive tools need the full three-part gate](docs/assets/proxmox-safety-workflow.svg)
61
+
62
+ Generated from [`docs/assets/workflows/proxmox-safety.json`](docs/assets/workflows/proxmox-safety.json) with `lidless workflow`.
63
+
57
64
  | Tool | Tier | Notes |
58
65
  | --- | --- | --- |
59
66
  | `proxmox_status` | 1 read | Cluster + node status. |
@@ -76,6 +83,35 @@ Tier markers below are authoritative: each tool's gate is enforced in code (`src
76
83
  | `proxmox_list_pool_resources` | 1 read | Inspect resources assigned to a Proxmox pool, defaulting to `mcp-smoke`. |
77
84
  | `proxmox_get_task_status` | 1 read | Single UPID status lookup. |
78
85
  | `proxmox_get_task_log` | 1 read | Task log tail for a UPID. |
86
+ | `proxmox_list_storage_content` | 1 read | List volumes on a storage: ISOs, templates, disk images, backups. |
87
+ | `proxmox_list_node_services` | 1 read | Host systemd service states (pveproxy, pvedaemon, corosync). |
88
+ | `proxmox_list_disks` | 1 read | Physical disks with model/size/SMART health/wearout. |
89
+ | `proxmox_list_updates` | 1 read | Pending APT updates on a node (needs a Sys.Modify token). |
90
+ | `proxmox_list_firewall_rules` | 1 read | Firewall rules at cluster/node/guest scope. |
91
+ | `proxmox_get_firewall_options` | 1 read | Firewall enable state + default policy at a scope. |
92
+ | `proxmox_firewall_log` | 1 read | Firewall log for a node (requires `Sys.Syslog` on `/nodes/{node}`) or guest (requires `VM.Console` on `/vms/{vmid}`). |
93
+ | `proxmox_list_storage_config` | 1 read | Datacenter storage definitions (id/type/content/nodes). |
94
+ | `proxmox_list_backup_jobs` | 1 read | Scheduled vzdump backup jobs. |
95
+ | `proxmox_list_unprotected_guests` | 1 read | Guests Proxmox reports not covered by any backup job; disabled jobs still count as coverage. Results include only guests the token holds `VM.Audit` on. |
96
+ | `proxmox_list_users` | 1 read | Access users (userid, realm, enabled state). |
97
+ | `proxmox_list_roles` | 1 read | Roles and their privileges. |
98
+ | `proxmox_list_acl` | 1 read | ACL entries: who holds which role on which path. |
99
+ | `proxmox_list_pools` | 1 read | All resource pools. |
100
+ | `proxmox_list_tokens` | 1 read | API tokens for a user. |
101
+ | `proxmox_list_tfa` | 1 read | TFA enrollment metadata, with secret fields omitted. |
102
+ | `proxmox_list_groups` | 1 read | Access groups and their user memberships. |
103
+ | `proxmox_list_auth_domains` | 1 read | Authentication domains and configured TFA provider. |
104
+ | `proxmox_cluster_status` | 1 read | Cluster membership + quorum per node. |
105
+ | `proxmox_ha_status` | 1 read | HA manager status: quorum, fencing, resource states. |
106
+ | `proxmox_list_ha_resources` | 1 read | HA-managed resources. |
107
+ | `proxmox_list_ha_rules` | 1 read | HA rules (PVE 9+ replacement for HA groups). |
108
+ | `proxmox_list_replication` | 1 read | Storage replication jobs. |
109
+ | `proxmox_list_sdn_zones` | 1 read | SDN zones. |
110
+ | `proxmox_list_sdn_vnets` | 1 read | SDN virtual networks. |
111
+ | `proxmox_list_metric_servers` | 1 read | External metrics servers (InfluxDB/Graphite). |
112
+ | `proxmox_get_cluster_options` | 1 read | Datacenter options (keyboard, MAC prefix, tags). |
113
+ | `proxmox_cluster_log` | 1 read | Recent cluster-wide log entries. |
114
+ | `proxmox_node_journal` | 1 read | Pre-rendered node journal text with cursor entries removed. Priority, service, and kernel filters require pve-manager 9.2.4 or later. |
79
115
  | `proxmox_read_file` | 2 gated guest read | Read a file from inside an LXC or QEMU VM (SSH + `cat`). Requires `confirm: true`. |
80
116
  | `proxmox_stat_path` | 2 gated guest read | Inspect guest path metadata. Requires `confirm: true`. |
81
117
  | `proxmox_list_directory` | 2 gated guest read | List one guest directory. Requires `confirm: true`. |
@@ -93,18 +129,51 @@ Tier markers below are authoritative: each tool's gate is enforced in code (`src
93
129
  | `proxmox_service_start` | 2 safe-write | Start a systemd service inside a guest. Requires `confirm: true`. |
94
130
  | `proxmox_service_stop` | 2 safe-write | Stop a systemd service inside a guest. Requires `confirm: true`. |
95
131
  | `proxmox_service_restart` | 2 safe-write | Restart a systemd service inside a guest. Requires `confirm: true`. |
132
+ | `proxmox_update_vm_config` | 2 safe-write | Edit an existing QEMU VM config (cores/memory/net/etc, `PUT .../qemu/{vmid}/config`). Requires `confirm: true`. |
133
+ | `proxmox_update_container_config` | 2 safe-write | Edit an existing LXC config (cores/memory/hostname/etc, `PUT .../lxc/{vmid}/config`). Requires `confirm: true`. |
134
+ | `proxmox_resize_disk` | 2 safe-write | Grow a VM or container disk (`PUT .../{type}/{vmid}/resize`). Grow-only. Requires `confirm: true`. |
135
+ | `proxmox_migrate_resource` | 2 safe-write | Migrate a VM or container to another node (`POST .../migrate`). Requires `confirm: true`. |
136
+ | `proxmox_suspend_resource` | 2 safe-write | Suspend/pause a running guest (QEMU can hibernate to disk). Requires `confirm: true`. |
137
+ | `proxmox_resume_resource` | 2 safe-write | Resume a suspended guest. Requires `confirm: true`. |
138
+ | `proxmox_reset_resource` | 2 safe-write | Hard-reset a QEMU VM (reset button; no graceful shutdown). Requires `confirm: true`. |
139
+ | `proxmox_convert_to_template` | 2 safe-write | Convert a stopped guest into a clone template (one-way). Requires `confirm: true`. |
140
+ | `proxmox_download_url` | 2 safe-write | Download an ISO or container template from a URL onto a storage. Requires `confirm: true`. |
141
+ | `proxmox_cancel_task` | 2 safe-write | Stop a running task by UPID (abort a stuck migration/backup). Requires `confirm: true`. |
142
+ | `proxmox_add_firewall_rule` | 2 safe-write | Add a firewall rule at cluster/node/guest scope. Requires `confirm: true`. |
143
+ | `proxmox_delete_firewall_rule` | 2 safe-write | Delete a firewall rule by position at a scope. Requires `confirm: true`. |
144
+ | `proxmox_set_firewall_enabled` | 2 safe-write | Enable/disable the firewall at a scope. Requires `confirm: true`. |
145
+ | `proxmox_move_disk` | 2 safe-write | Relocate a VM disk or container volume to another storage. Requires `confirm: true`. |
146
+ | `proxmox_create_storage` | 2 safe-write | Define a new datacenter storage (dir/nfs/lvm/pbs/etc). Requires `confirm: true`. |
147
+ | `proxmox_create_backup_job` | 2 safe-write | Create a scheduled vzdump backup job. Requires `confirm: true`. |
148
+ | `proxmox_delete_backup_job` | 2 safe-write | Delete a scheduled backup job (archives untouched). Requires `confirm: true`. |
149
+ | `proxmox_set_acl` | 2 safe-write | Grant or revoke a role for a user/token/group on a path. Requires `confirm: true`. |
150
+ | `proxmox_create_token` | 2 safe-write | Create an API token; returns the secret once. Requires `confirm: true`. |
151
+ | `proxmox_delete_token` | 2 safe-write | Revoke an API token. Requires `confirm: true`. |
152
+ | `proxmox_create_pool` | 2 safe-write | Create a resource pool. Requires `confirm: true`. |
153
+ | `proxmox_update_pool` | 2 safe-write | Add/remove guests or storage in a pool. Requires `confirm: true`. |
154
+ | `proxmox_delete_pool` | 2 safe-write | Delete an empty resource pool. Requires `confirm: true`. |
155
+ | `proxmox_add_ha_resource` | 2 safe-write | Place a VM/container under HA management. Requires `confirm: true`. |
156
+ | `proxmox_delete_ha_resource` | 2 safe-write | Remove a guest from HA management. Requires `confirm: true`. |
157
+ | `proxmox_create_replication` | 2 safe-write | Create a storage replication job to another node. Requires `confirm: true`. |
158
+ | `proxmox_delete_replication` | 2 safe-write | Delete a replication job. Requires `confirm: true`. |
96
159
  | `proxmox_rollback_snapshot` | 3 destructive | Roll back a resource to a named snapshot. |
97
160
  | `proxmox_destroy_resource` | 3 destructive | Permanently delete an LXC or VM (`DELETE /nodes/{node}/{type}/{vmid}`). |
98
161
  | `proxmox_cleanup_smoke_resources` | 3 destructive | Dry-run or destroy smoke-prefixed LXC/QEMU guests from a smoke pool. |
99
162
  | `proxmox_delete_snapshot` | 3 destructive | Delete a named snapshot. |
100
163
  | `proxmox_force_stop_resource` | 3 destructive | Non-graceful hard stop of a running container or VM. |
164
+ | `proxmox_delete_volume` | 3 destructive | Permanently delete a storage volume (backup, ISO, template, disk image). |
165
+ | `proxmox_node_power` | 3 destructive | Reboot or shut down an entire node, taking down every guest on it. |
166
+ | `proxmox_delete_storage` | 3 destructive | Remove a storage definition from the datacenter config. |
167
+ | `proxmox_restore_backup` | 3 destructive | Restore a vzdump/PBS archive into a VMID. Overwriting an existing VMID wipes its disks and requires the destructive gate. |
101
168
 
102
- **Reads (20):** open; no flags required.
169
+ **Reads (46):** open; no flags required.
103
170
  **Gated guest reads (4):** guest file/path/directory/service inspection tools require `confirm: true` because they expose in-guest state through host-backed SSH.
104
- **Safe writes (13):** require `confirm: true`. The schema documents the gate on every tool. `WriteGateError` fires before any HTTP call.
105
- **Destructive (5):** require `confirm: true` + `destructive: true` + env `PROXMOX_ENABLE_DESTRUCTIVE=1`. All three gates must be satisfied; if any one is missing the tool throws `WriteGateError` before resolving the resource.
171
+ **Safe writes (40):** require `confirm: true`. The schema documents the gate on every tool. `WriteGateError` fires before any HTTP call.
172
+ **Destructive (9):** require `confirm: true` + `destructive: true` + env `PROXMOX_ENABLE_DESTRUCTIVE=1`. All three gates must be satisfied; if any one is missing the tool throws `WriteGateError` before resolving the resource.
106
173
 
107
- > Five tools are destructive and can delete or hard-stop guests: `proxmox_destroy_resource`, `proxmox_cleanup_smoke_resources`, `proxmox_rollback_snapshot`, `proxmox_delete_snapshot`, and `proxmox_force_stop_resource`. They are gated behind the `PROXMOX_ENABLE_DESTRUCTIVE=1` process env flag and stay inert until you set it. See [SECURITY.md](SECURITY.md) and the [Safety](#safety) section.
174
+ **MCP annotations.** `tools/list` reports `readOnlyHint`, `destructiveHint` and `openWorldHint` on every tool (`true` only for `proxmox_download_url`, which fetches from a host outside the cluster, and `proxmox_exec`, whose shell command can contact any host), plus `idempotentHint` where it applies, so clients that ask a person before running a tool can do so. The annotations follow the tier with these refinements: the four gated guest reads report `readOnlyHint: true`, and the safe-write tools that execute commands, write files, stop or reset workloads, or change credentials, permissions, firewall or storage placement report `destructiveHint: true` even though their gate stays `confirm: true`. The gate arguments a call must carry are unchanged; the hint only changes how a client presents the call. The full list lives in `src/registry.ts`.
175
+
176
+ > Nine tools use the destructive gate and can delete, overwrite guest disks, hard-stop, or power off resources: `proxmox_destroy_resource`, `proxmox_cleanup_smoke_resources`, `proxmox_rollback_snapshot`, `proxmox_delete_snapshot`, `proxmox_force_stop_resource`, `proxmox_delete_volume`, `proxmox_node_power`, `proxmox_delete_storage`, and `proxmox_restore_backup`. Overwriting an existing VMID with `proxmox_restore_backup` wipes its disks. These tools are gated behind the `PROXMOX_ENABLE_DESTRUCTIVE=1` process env flag. See [SECURITY.md](SECURITY.md) and the [Safety](#safety) section.
108
177
 
109
178
  ## Quickstart
110
179
 
@@ -121,7 +190,7 @@ Set the three required credential env vars (scrub real hosts and IPs out of any
121
190
  ```bash
122
191
  export PROXMOX_URL=https://192.0.2.10:8006
123
192
  export PROXMOX_TOKEN_ID=pve-admin@pam!api-token-1
124
- export PROXMOX_TOKEN_SECRET=00000000-0000-0000-0000-000000000000
193
+ export PROXMOX_TOKEN_SECRET=REPLACE_WITH_TOKEN_SECRET
125
194
 
126
195
  # Optional: skip TLS cert validation for homelab self-signed certs.
127
196
  # Accepts true/1/yes (case-insensitive). Defaults to false.
@@ -137,7 +206,7 @@ claude mcp add proxmox -s user -- npx -y @solomonneas/proxmox-mcp
137
206
 
138
207
  Then ask your agent to list your cluster's containers. Reads work with nothing but the three credential vars; write and destructive tiers stay gated until you opt in.
139
208
 
140
- > Note: the latest version published to npm is `0.3.0`. This repository tracks ahead of npm; install pins the published release.
209
+ > Note: the repository version is `0.13.0`. `npx` and `npm install` select the published release. This repository may track ahead between releases.
141
210
 
142
211
  ## Configuration
143
212
 
@@ -146,15 +215,46 @@ Set the following env vars. All three credential vars are required.
146
215
  ```
147
216
  PROXMOX_URL=https://192.0.2.10:8006
148
217
  PROXMOX_TOKEN_ID=pve-admin@pam!api-token-1
149
- PROXMOX_TOKEN_SECRET=00000000-0000-0000-0000-000000000000
218
+ PROXMOX_TOKEN_SECRET=REPLACE_WITH_TOKEN_SECRET
219
+
220
+ # Optional: maximum duration for each Proxmox API request, including its response body.
221
+ # Defaults to 30000 ms; accepted range is 1000 to 300000 ms.
222
+ PROXMOX_REQUEST_TIMEOUT_MS=30000
150
223
 
151
224
  # Optional: skip TLS cert validation (homelab self-signed certs).
152
225
  # Accepts true/1/yes (case-insensitive). Defaults to false.
153
226
  PROXMOX_TLS_INSECURE=false
227
+
228
+ # Optional (experimental): load tools on demand instead of listing all 102.
229
+ # Accepts true/1/yes (case-insensitive). Defaults to false. See "Deferred tool loading".
230
+ PROXMOX_DEFERRED_TOOLS=false
154
231
  ```
155
232
 
233
+ `PROXMOX_TOKEN_SECRET` is the UUID Proxmox shows exactly once when you create the API token; it cannot be read back afterwards. Every example here uses a literal `REPLACE_WITH_TOKEN_SECRET` placeholder rather than a UUID-shaped dummy, so copying a snippet into your own repo will not trip a secret scanner.
234
+
235
+ Each Proxmox API request is bounded by `PROXMOX_REQUEST_TIMEOUT_MS`, including response-body reads. Timed-out GET requests receive the usual single retry. A timed-out write reports an unknown outcome; check `proxmox_recent_tasks` before retrying it.
236
+
156
237
  Trailing slashes on `PROXMOX_URL` are stripped. The token secret is registered with the redactor on startup and masked from all log + error output.
157
238
 
239
+ ### Deferred tool loading (experimental)
240
+
241
+ 102 tool schemas cost roughly 17k tokens of context in every request, whether or not the agent needs a single one of them. Set `PROXMOX_DEFERRED_TOOLS=1` and the server instead starts with one tool, `proxmox_search_tools`. The agent describes its task, gets back matching tool descriptors, and those tools are added to that connection's tool list; the server emits `notifications/tools/list_changed`, the client re-reads the list, and the agent calls the tool it wants with its own real schema. Measured on a live connection, the visible `tools/list` payload drops from 68,495 bytes to 1,400, a 98% reduction.
242
+
243
+ Requirements and caveats:
244
+
245
+ - **Your client must honor `notifications/tools/list_changed`, and not all of them do.** Measured against a real connection:
246
+
247
+ | Client | Deferred mode | Notes |
248
+ | --- | --- | --- |
249
+ | Claude Code 2.1.219 | **works** | re-fetches `tools/list` 2ms after the notification, then calls the new tool |
250
+ | Cursor (cursor-agent 2026.07.23) | **does not work** | receives the notification, never re-lists; the agent is then told the tool does not exist |
251
+ | Codex CLI 0.145.0 | untested | could not dispatch MCP tool calls headlessly in our harness, so `list_changed` support is unknown |
252
+
253
+ A client that ignores the notification will see the search succeed, be told which tools were loaded, and then be unable to call any of them. Leave the flag unset there. Default (flag unset) is the full static tool list exactly as before, which is why static profiles remain the supported path.
254
+ - On clients that apply their own tool deferral, a newly listed tool may be *visible but not immediately callable* until the client fetches its schema, which costs one extra turn.
255
+ - **Hiding a tool is not a safety mechanism.** Destructive tools are searchable, and the gate chain is unchanged: a tool reached through search still requires `confirm: true`, `destructive: true`, and `PROXMOX_ENABLE_DESTRUCTIVE=1` exactly as it would otherwise. Search results carry each tool's tier and the gate arguments it will demand. The gates in `src/gates.ts` are the boundary; visibility is a token optimization.
256
+ - Calling a tool by name that search has not surfaced still works. Refusing it would create a second, weaker enforcement surface without adding safety.
257
+
158
258
  ### In-container exec env vars
159
259
 
160
260
  The `proxmox_exec`, `proxmox_read_file`, and `proxmox_write_file` tools SSH to the Proxmox host (for LXC, via `pct exec`) or directly to the VM (for QEMU). All are optional; defaults derive from `PROXMOX_URL`.
@@ -168,6 +268,8 @@ The `proxmox_exec`, `proxmox_read_file`, and `proxmox_write_file` tools SSH to t
168
268
  | `PROXMOX_VM_SSH_USER` | falls through to `PROXMOX_SSH_USER` | Default user for direct VM SSH |
169
269
  | `PROXMOX_VM_SSH_KEY` | falls through to `PROXMOX_SSH_KEY` | Default key for direct VM SSH |
170
270
  | `PROXMOX_SSH_MAX_OUTPUT_BYTES` | `1048576` | Max stdout bytes and max stderr bytes captured per SSH command |
271
+ | `PROXMOX_MAX_RESULT_BYTES` | `100000` | Max size of one tool result returned to the client (minimum `2048`). Larger results are replaced by a JSON envelope with `truncated: true` and a preview. |
272
+ | `PROXMOX_EXEC_BACKEND` | `ssh` | QEMU exec backend: `ssh` (direct SSH to the VM) or `guest-agent` (qemu-guest-agent API, no in-guest SSH key needed). LXC always uses `pct exec` over host SSH. |
171
273
 
172
274
  Per-VM overrides (read at execute time, no MCP restart needed):
173
275
 
@@ -177,31 +279,175 @@ Per-VM overrides (read at execute time, no MCP restart needed):
177
279
 
178
280
  For QEMU VMs without a per-VM env override, install `qemu-guest-agent` in the VM and enable it with `qm set <vmid> --agent 1` so the IP can be discovered automatically.
179
281
 
282
+ Set `PROXMOX_EXEC_BACKEND=guest-agent` to run QEMU guest commands entirely through the qemu-guest-agent API instead of SSH. This needs no in-guest SSH key and no network path from the MCP host to the VM (traffic goes through the Proxmox API), but the API token needs the `VM.GuestAgent.*` privileges (`Unrestricted` for exec, `FileRead`/`FileWrite` for file ops). LXC guests always use `pct exec` over host SSH regardless of this setting.
283
+
284
+ ### Waiting for long-running tasks
285
+
286
+ Provisioning and disk operations (`proxmox_create_container`, `proxmox_create_vm`, `proxmox_clone_resource`, `proxmox_run_backup`, `proxmox_restore_backup`, `proxmox_migrate_resource`, `proxmox_resize_disk`, `proxmox_download_url`, `proxmox_destroy_resource`) return a task UPID immediately. Pass `wait: true` (with optional `wait_timeout` seconds, default 120) to block until the task finishes; the result then includes a `task` object with `done`, `exitstatus`, and `ok` (true only for an `OK` exit). Without `wait`, use `proxmox_wait_task` to poll the UPID yourself.
287
+
180
288
  ## CLI
181
289
 
182
- The same package ships a read-only **control CLI**, `proxmoxctrl`, for shells, cron, and CI. Compatibility aliases `proxmoxctl` and `proxops` still point at the same binary. It shares the `ProxmoxClient` core with the MCP adapter and reads the same env config (`PROXMOX_URL`, `PROXMOX_TOKEN_ID`, `PROXMOX_TOKEN_SECRET`, `PROXMOX_TLS_INSECURE`). It exposes only read/inventory/audit operations; every lifecycle, snapshot, backup, and exec action stays in the MCP/plugin surface behind the safety gates.
290
+ The same package ships a read-only **control CLI**, `proxmoxctl` (alias `proxops`), for shells, cron, and CI. It shares the `ProxmoxClient` core with the MCP server and reads the same env config (`PROXMOX_URL`, `PROXMOX_TOKEN_ID`, `PROXMOX_TOKEN_SECRET`, `PROXMOX_TLS_INSECURE`, `PROXMOX_REQUEST_TIMEOUT_MS`). It exposes only read/inventory/audit operations; every lifecycle, snapshot, backup, and exec action stays in the MCP/plugin surface behind the safety gates.
183
291
 
184
292
  ```bash
185
293
  npx @solomonneas/proxmox-mcp@latest status
186
294
  # or, installed globally:
187
- proxmoxctrl status # PVE version + per-node status (exit 1 if a node is offline)
188
- proxmoxctrl vms list
189
- proxmoxctrl containers list
190
- proxmoxctrl vm config 100
191
- proxmoxctrl storage list --node pve
192
- proxmoxctrl backups list --vmid 100
193
- proxmoxctrl snapshots list 100
194
- proxmoxctrl audit-permissions
195
- proxmoxctrl recent-tasks --limit 20
196
- proxmoxctrl task status UPID:pve:...
197
- proxmoxctrl vms list --json # raw JSON for piping
295
+ proxmoxctl status # PVE version + per-node status (exit 1 if a node is offline)
296
+ proxmoxctl vms list
297
+ proxmoxctl containers list
298
+ proxmoxctl vm config 100
299
+ proxmoxctl storage list --node pve
300
+ proxmoxctl storage content local --node pve --content backup
301
+ proxmoxctl disks list --node pve # physical disks + SMART health
302
+ proxmoxctl services list --node pve # host systemd services
303
+ proxmoxctl firewall rules --scope cluster
304
+ proxmoxctl backups list --vmid 100
305
+ proxmoxctl snapshots list 100
306
+ proxmoxctl audit-permissions
307
+ proxmoxctl recent-tasks --limit 20
308
+ proxmoxctl task status UPID:pve:...
309
+ proxmoxctl storage config
310
+ proxmoxctl backup-jobs list
311
+ proxmoxctl unprotected-guests
312
+ proxmoxctl users list
313
+ proxmoxctl roles list
314
+ proxmoxctl acl list
315
+ proxmoxctl pools list
316
+ proxmoxctl tokens list operator@pve
317
+ proxmoxctl tfa list operator@pve
318
+ proxmoxctl groups list
319
+ proxmoxctl auth domains
320
+ proxmoxctl cluster status
321
+ proxmoxctl ha status
322
+ proxmoxctl ha resources
323
+ proxmoxctl ha rules
324
+ proxmoxctl replication list
325
+ proxmoxctl sdn zones
326
+ proxmoxctl sdn vnets
327
+ proxmoxctl metrics servers
328
+ proxmoxctl cluster options
329
+ proxmoxctl cluster log --max=50
330
+ proxmoxctl node journal --node pve
331
+ proxmoxctl firewall log --scope node --node pve
332
+ proxmoxctl vms list --json # raw JSON for piping
198
333
  ```
199
334
 
200
- Run `proxmoxctrl help` for the full command list. `--json` emits raw JSON instead of the concise summary. Exit codes: `0` success, `1` runtime error (backend unreachable / call failed, and `status` when a node is offline), `2` usage error (unknown command/flag or bad value).
335
+ All 49 Tier-1 reads have a CLI decision: 47 commands, with `proxmox_wait_task` (use task status/log in scripts) and `proxmox_validate_qemu_smoke_source` (smoke-provisioning preflight) explicitly exempt. An inventory parity test enforces coverage and rejects mutating mappings.
336
+
337
+ Run `proxmoxctl help` for the full command list. `--json` emits JSON instead of the concise summary. TFA, group, and authentication-domain output retains the MCP `<untrusted-data>` wrapper and escaped closing tags in both modes; treat the contents as data, never instructions. These access commands use the same allowlists and sanitized upstream errors as MCP. CLI results and errors use the MCP redaction and output limit (100,000 bytes by default). Larger results return a JSON truncation envelope.
338
+
339
+ Use `--` before a positional value that begins with a dash, for example `proxmoxctl tfa list -- --operator@pve`. Cluster log accepts `--max N` and `--max=N`, with an integer from 1 to 1000 and a default of 50.
340
+
341
+ Exit code `0` means success, and `2` means a usage error such as an unknown flag or invalid log limit. Exit code `1` covers runtime errors or missing health evidence. It also covers an offline node for `status` or `cluster status`, lost quorum for `cluster status` or `ha status`, and resource errors for `ha status`.
201
342
 
202
343
  ### Starting the MCP server
203
344
 
204
- `proxmoxctrl mcp` (or the back-compat `proxmox-mcp` bin) starts the stdio MCP server. If a launcher referenced the file path `dist/mcp-server.js` directly, it keeps working; new launchers can point at `dist/mcp-bin.js` (or `dist/cli.js mcp`). Launchers that use the `proxmox-mcp` bin name need no change.
345
+ `proxmoxctl mcp` (or the back-compat `proxmox-mcp` bin) starts the stdio MCP server. If a launcher referenced the file path `dist/mcp-server.js` directly, it keeps working; new launchers can point at `dist/mcp-bin.js` (or `dist/cli.js mcp`). Launchers that use the `proxmox-mcp` bin name need no change.
346
+
347
+ ### Shared HTTP mode
348
+
349
+ Run one persistent process for multiple MCP clients:
350
+
351
+ ```sh
352
+ node dist/cli.js mcp --http
353
+ # Or: proxmoxctl mcp --http
354
+ ```
355
+
356
+ Set the usual `PROXMOX_URL`, `PROXMOX_TOKEN_ID`, and `PROXMOX_TOKEN_SECRET`
357
+ on the server, plus an independent `PROXMOX_MCP_HTTP_TOKEN`. Generate a random
358
+ HTTP token, for example with `openssl rand -hex 32`. Startup refuses a missing or
359
+ blank token, or one equal to the Proxmox token ID, token secret, complete API
360
+ authorization value, or URL credentials. Tokens are compared using SHA-256 and
361
+ constant-time comparison. Keep the token private: every client with it shares
362
+ the server's Proxmox privileges and process-level destructive-operation flag.
363
+
364
+ | Variable | Default | Purpose |
365
+ | --- | --- | --- |
366
+ | `PROXMOX_MCP_HTTP_TOKEN` | Required | Bearer credential, at least 32 characters, separate from upstream credentials |
367
+ | `PROXMOX_MCP_HTTP_HOST` | IPv4 loopback | Listener bind address. Wildcards (`0.0.0.0`, `::`, `[::]`) are refused |
368
+ | `PROXMOX_MCP_HTTP_PORT` | `3100` | TCP port (`0` selects a free port) |
369
+
370
+ The resolved address is printed to stderr on startup. `/mcp` supports Streamable
371
+ HTTP POST, GET, and DELETE with bearer authentication on every request.
372
+ `GET /healthz` requires no token and returns only `{"status":"ok"}`.
373
+ Requests must use the bound host or a loopback alias in `Host`. A supplied
374
+ `Origin` must be an HTTP or HTTPS loopback origin. Request bodies are limited to
375
+ 1 MiB. The listener accepts at most 128 sessions, reaps sessions idle for 30 minutes
376
+ (on a minute timer), and closes transports and the listener on SIGTERM or SIGINT.
377
+ Active tool requests are excluded from idle expiry. An idle SSE channel does not
378
+ keep a session alive. Clients must initialize again after expiry or a restart.
379
+
380
+ Each initialized MCP session gets its own server and deferred-tool visible set.
381
+ Confirmation gates have no pending approvals: `confirm`, `destructive`, and the
382
+ environment gate are checked on every tool invocation. One session's confirmation
383
+ cannot authorize another call. The secret-redaction registry is process-wide and
384
+ only adds masking, never authorization. Session IDs route connection state and
385
+ are not separate user identities. All clients using the shared bearer token are
386
+ in the same trust boundary. HTTP mode preserves the existing stdio defaults.
387
+
388
+ Keep the default loopback binding for local clients. A non-loopback listener
389
+ requires a trusted TLS proxy or tunnel and appropriate network access controls.
390
+ This transport does not provide TLS, OAuth, browser CORS access, or per-client
391
+ Proxmox accounts. Preserve the allowed Host header through a proxy. A wildcard
392
+ bind does not allow arbitrary Host headers. Use a specific bind address or host
393
+ name for remote clients.
394
+
395
+ #### Claude Code
396
+
397
+ Add this entry under `mcpServers` in `~/.claude.json`. Replace the token placeholder
398
+ with the HTTP token. Restrict access to the config file.
399
+
400
+ ```json
401
+ {
402
+ "mcpServers": {
403
+ "proxmox": {
404
+ "type": "http",
405
+ "url": "http://localhost:3100/mcp",
406
+ "headers": {
407
+ "Authorization": "Bearer <HTTP_TOKEN>"
408
+ }
409
+ }
410
+ }
411
+ }
412
+ ```
413
+
414
+ The `type` and header syntax follow the
415
+ [Claude Code MCP configuration](https://code.claude.com/docs/en/mcp).
416
+
417
+ #### Codex
418
+
419
+ Add to `~/.codex/config.toml`, and export `PROXMOX_MCP_HTTP_TOKEN` in the environment
420
+ that launches Codex. Its value must match the server's token, without the
421
+ `Bearer ` prefix. The client needs no upstream Proxmox credentials.
422
+
423
+ ```toml
424
+ [mcp_servers.proxmox]
425
+ url = "http://localhost:3100/mcp"
426
+ bearer_token_env_var = "PROXMOX_MCP_HTTP_TOKEN"
427
+ ```
428
+
429
+ These fields follow the
430
+ [Codex Streamable HTTP configuration](https://developers.openai.com/codex/mcp/).
431
+
432
+ #### systemd user service
433
+
434
+ An example unit is at
435
+ [`docs/systemd/proxmox-mcp-http.service`](docs/systemd/proxmox-mcp-http.service).
436
+ Adjust its generic installation paths, build the project there, and place the
437
+ server environment in `%h/.config/proxmox-mcp/http.env` with mode `0600`:
438
+
439
+ ```sh
440
+ PROXMOX_URL=https://proxmox.example.com:8006
441
+ PROXMOX_TOKEN_ID=operator@pve!mcp
442
+ PROXMOX_TOKEN_SECRET=REPLACE_WITH_UPSTREAM_SECRET
443
+ PROXMOX_MCP_HTTP_TOKEN=REPLACE_WITH_INDEPENDENT_RANDOM_TOKEN
444
+ PROXMOX_MCP_HTTP_PORT=3100
445
+ ```
446
+
447
+ The unit reads this file with `EnvironmentFile`. Add SSH settings there if the
448
+ chosen tools require them. Leave `PROXMOX_ENABLE_DESTRUCTIVE` unset unless the
449
+ service should permit destructive calls. Installing or starting the example is
450
+ an operator action, separate from building the server.
205
451
 
206
452
  ## Setup
207
453
 
@@ -218,7 +464,7 @@ Run `proxmoxctrl help` for the full command list. `--json` emits raw JSON instea
218
464
  "env": {
219
465
  "PROXMOX_URL": "https://192.0.2.10:8006",
220
466
  "PROXMOX_TOKEN_ID": "pve-admin@pam!api-token-1",
221
- "PROXMOX_TOKEN_SECRET": "00000000-0000-0000-0000-000000000000",
467
+ "PROXMOX_TOKEN_SECRET": "REPLACE_WITH_TOKEN_SECRET",
222
468
  "PROXMOX_TLS_INSECURE": "false"
223
469
  }
224
470
  }
@@ -265,7 +511,7 @@ args = ["-y", "@solomonneas/proxmox-mcp"]
265
511
  [mcp_servers.proxmox.env]
266
512
  PROXMOX_URL = "https://192.0.2.10:8006"
267
513
  PROXMOX_TOKEN_ID = "pve-admin@pam!api-token-1"
268
- PROXMOX_TOKEN_SECRET = "00000000-0000-0000-0000-000000000000"
514
+ PROXMOX_TOKEN_SECRET = "REPLACE_WITH_TOKEN_SECRET"
269
515
  PROXMOX_TLS_INSECURE = "false"
270
516
  ```
271
517
 
@@ -273,13 +519,13 @@ PROXMOX_TLS_INSECURE = "false"
273
519
 
274
520
  This MCP uses a three-tier write-gating model. The tier is enforced in code, not just documented.
275
521
 
276
- - **Tier 1 (reads):** open. No confirm flag needed. Status, listings, config inspection, QEMU smoke-source validation, permission audit, usage, recent tasks, backup inventory, template inventory, storage inventory, snapshot inventory, guest network lookup, task wait, next-VMID lookup, task status/log, and pool resource audit live here.
277
- - **Tier 2 (gated guest reads + safe writes):** require an explicit `confirm: true` arg. Guest file/path/directory/service inspection, start, stop, reboot, snapshot create, run backup, create container, create VM, clone, in-container `exec`, in-container `write_file`, and guest service start/stop/restart live here. A tool call without the confirm flag throws `WriteGateError` before any HTTP traffic.
278
- - **Tier 3 (destructive):** require `confirm: true` + `destructive: true` + the env flag `PROXMOX_ENABLE_DESTRUCTIVE=1` on the MCP process. Permanent resource deletion, smoke pool cleanup, snapshot rollback/deletion, and non-graceful force-stop live here.
522
+ - **Tier 1 (reads):** open. No confirm flag needed. Status, listings, config inspection, QEMU smoke-source validation, permission audit, usage, recent tasks, backup inventory, template inventory, storage inventory, snapshot inventory, guest network lookup, task wait, next-VMID lookup, task status/log, pool resource audit, storage content listing, node service/disk/update inventory, and firewall rule/option inspection, storage-config and backup-job listing, and access/role/ACL/pool/token inspection, and cluster/HA/SDN/replication observability live here.
523
+ - **Tier 2 (gated guest reads + safe writes):** require an explicit `confirm: true` arg. Guest file/path/directory/service inspection, start, stop, reboot, snapshot create, run backup, create container, create VM, clone, VM/container config edit, disk resize, backup restore (to a new VMID), node migration, suspend/resume/reset, convert-to-template, ISO/template download, task cancel, firewall rule add/delete and enable-toggle, disk move, storage creation, backup-job create/delete, ACL grant/revoke, API-token create/delete, pool create/update/delete, HA resource add/remove, replication job create/delete, in-container `exec`, in-container `write_file`, and guest service start/stop/restart live here. A tool call without the confirm flag throws `WriteGateError` before any HTTP traffic. Restoring a backup *over an existing VMID* escalates to the Tier-3 gate because it wipes the target's disks.
524
+ - **Tier 3 (destructive):** require `confirm: true` + `destructive: true` + the env flag `PROXMOX_ENABLE_DESTRUCTIVE=1` on the MCP process. Permanent resource deletion, smoke pool cleanup, snapshot rollback/deletion, non-graceful force-stop, storage-volume deletion, storage-definition removal, and node reboot/shutdown live here.
279
525
 
280
526
  ### Destructive operations env gate
281
527
 
282
- Tier 3 destructive tools (`proxmox_destroy_resource`, `proxmox_cleanup_smoke_resources`, `proxmox_rollback_snapshot`, `proxmox_delete_snapshot`, `proxmox_force_stop_resource`) require an additional safety gate beyond the per-tool `confirm: true` + `destructive: true` args: the env var `PROXMOX_ENABLE_DESTRUCTIVE=1` must be set on the MCP process. Without it, the tools throw `WriteGateError` before any HTTP call is made. `proxmox_cleanup_smoke_resources` defaults to `dry_run: true`, which previews targets without the destructive env gate.
528
+ Tier 3 destructive tools (`proxmox_destroy_resource`, `proxmox_cleanup_smoke_resources`, `proxmox_rollback_snapshot`, `proxmox_delete_snapshot`, `proxmox_force_stop_resource`, `proxmox_delete_volume`, `proxmox_node_power`, `proxmox_delete_storage`, and `proxmox_restore_backup` when it overwrites an existing VMID) require an additional safety gate beyond the per-tool `confirm: true` + `destructive: true` args: the env var `PROXMOX_ENABLE_DESTRUCTIVE=1` must be set on the MCP process. Without it, the tools throw `WriteGateError` before any HTTP call is made. `proxmox_cleanup_smoke_resources` defaults to `dry_run: true`, which previews targets without the destructive env gate.
283
529
 
284
530
  This is intentional: destructive ops are rare. The env flag is a coarse "I am actively doing smoke-test cycles" toggle. Leave it unset day to day; flip it only when actively destroying resources is part of the workflow.
285
531
 
@@ -395,7 +641,7 @@ Audit or clean leftover smoke resources:
395
641
  ## What proxmox-mcp is not
396
642
 
397
643
  - It is **not a tool for blind automation of destructive operations.** The destructive tier exists for deliberate, supervised work (smoke-test cycles, intentional teardown), not for unattended agents. The `PROXMOX_ENABLE_DESTRUCTIVE=1` flag is a coarse "I am actively doing this right now" toggle; leave it unset day to day.
398
- - It is **not a Proxmox cluster manager or orchestrator.** It does not schedule, it does not run in the background, and it holds no state of its own. It translates MCP tool calls into Proxmox API calls and SSH commands, and that is all.
644
+ - It is **not a Proxmox cluster manager or orchestrator.** It does not schedule cluster work. HTTP mode keeps MCP session state in memory. It translates MCP tool calls into Proxmox API calls and SSH commands, and that is all.
399
645
  - It is **not a substitute for least-privilege tokens.** The write gate is a guardrail against a misbehaving model, not a substitute for a properly scoped Proxmox API token. Start read-only and grade up. See [SECURITY.md](SECURITY.md).
400
646
  - It is **not stable yet.** It is WIP, pre-1.0, and the tool surface can change between minor versions.
401
647
 
@@ -410,3 +656,11 @@ See [CHANGELOG.md](CHANGELOG.md) for the release history.
410
656
  ## License
411
657
 
412
658
  MIT. See [LICENSE](LICENSE).
659
+
660
+ ---
661
+
662
+ <p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> &middot; the eye does not close</p>
663
+
664
+ <p align="center"><sub><strong>Homelab:</strong> <a href="https://github.com/lidless-labs/adguardctrl">adguardctrl</a> &middot; <a href="https://github.com/lidless-labs/immichctrl">immichctrl</a> &middot; <a href="https://github.com/lidless-labs/jellyctrl">jellyctrl</a> &middot; <a href="https://github.com/lidless-labs/proxguard">proxguard</a></sub></p>
665
+
666
+ <p align="center"><sub><a href="https://lidless.dev">All tools</a> &middot; <a href="https://github.com/lidless-labs">Lidless Labs on GitHub</a></sub></p>