@solomonneas/proxmox-mcp 0.3.0 → 0.12.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/dist/index.js CHANGED
@@ -14,6 +14,13 @@ function isTruthy(value) {
14
14
  if (!value) return false;
15
15
  return ["true", "1", "yes"].includes(value.toLowerCase());
16
16
  }
17
+ function hostnameFromUrl(url) {
18
+ try {
19
+ return new URL(url).hostname;
20
+ } catch {
21
+ return url;
22
+ }
23
+ }
17
24
  function resolveConfig(env) {
18
25
  const url = env.PROXMOX_URL;
19
26
  const tokenId = env.PROXMOX_TOKEN_ID;
@@ -21,23 +28,35 @@ function resolveConfig(env) {
21
28
  if (!url) throw new ConfigError("PROXMOX_URL is required");
22
29
  if (!tokenId) throw new ConfigError("PROXMOX_TOKEN_ID is required");
23
30
  if (!tokenSecret) throw new ConfigError("PROXMOX_TOKEN_SECRET is required");
31
+ const trimmedUrl = url.replace(/\/+$/, "");
32
+ const sshHost = env.PROXMOX_SSH_HOST ?? hostnameFromUrl(trimmedUrl);
33
+ const sshPort = env.PROXMOX_SSH_PORT ? parseInt(env.PROXMOX_SSH_PORT, 10) : 22;
34
+ const sshUser = env.PROXMOX_SSH_USER ?? "root";
35
+ const sshKey = env.PROXMOX_SSH_KEY ?? "~/.ssh/id_ed25519";
24
36
  return {
25
- url: url.replace(/\/+$/, ""),
37
+ url: trimmedUrl,
26
38
  tokenId,
27
39
  tokenSecret,
28
- tlsInsecure: isTruthy(env.PROXMOX_TLS_INSECURE)
40
+ tlsInsecure: isTruthy(env.PROXMOX_TLS_INSECURE),
41
+ ssh: {
42
+ host: sshHost,
43
+ port: sshPort,
44
+ user: sshUser,
45
+ keyPath: sshKey,
46
+ vmUser: env.PROXMOX_VM_SSH_USER ?? sshUser,
47
+ vmKeyPath: env.PROXMOX_VM_SSH_KEY ?? sshKey
48
+ }
29
49
  };
30
50
  }
31
51
 
32
52
  // src/proxmox-client.ts
33
- import { Agent as UndiciAgent } from "undici";
53
+ import { request as httpsRequest } from "https";
34
54
  var ProxmoxClientError = class extends Error {
35
55
  constructor(status, message) {
36
56
  super(`Proxmox ${status}: ${message}`);
37
57
  this.status = status;
38
58
  this.name = "ProxmoxClientError";
39
59
  }
40
- status;
41
60
  };
42
61
  var ProxmoxUnreachableError = class extends Error {
43
62
  constructor(cause) {
@@ -50,28 +69,25 @@ var ProxmoxClient = class {
50
69
  this.cfg = cfg;
51
70
  this.authHeader = `PVEAPIToken=${cfg.tokenId}=${cfg.tokenSecret}`;
52
71
  this.retryDelayMs = opts.retryDelayMs ?? 1e3;
53
- if (cfg.tlsInsecure && cfg.url.startsWith("https://")) {
54
- this.dispatcher = new UndiciAgent({ connect: { rejectUnauthorized: false } });
55
- }
72
+ this.usesInsecureTls = cfg.tlsInsecure && cfg.url.startsWith("https://");
56
73
  }
57
- cfg;
58
74
  authHeader;
59
75
  retryDelayMs;
60
- // Node's global fetch (undici) ignores node:https.Agent. To actually skip
61
- // cert verification for self-signed PVE hosts we pass an undici Agent via
62
- // the `dispatcher` init option.
63
- dispatcher;
64
- async get(path) {
65
- return this.request("GET", path);
76
+ usesInsecureTls;
77
+ async get(path2) {
78
+ return this.request("GET", path2);
66
79
  }
67
- async post(path, body) {
68
- return this.request("POST", path, body);
80
+ async post(path2, body) {
81
+ return this.request("POST", path2, body);
69
82
  }
70
- async delete(path) {
71
- return this.request("DELETE", path);
83
+ async put(path2, body) {
84
+ return this.request("PUT", path2, body);
72
85
  }
73
- async request(method, path, body) {
74
- const url = this.cfg.url + "/api2/json" + path;
86
+ async delete(path2) {
87
+ return this.request("DELETE", path2);
88
+ }
89
+ async request(method, path2, body) {
90
+ const url = this.cfg.url + "/api2/json" + path2;
75
91
  const headers = { authorization: this.authHeader };
76
92
  let bodyStr;
77
93
  if (body !== void 0) {
@@ -79,6 +95,13 @@ var ProxmoxClient = class {
79
95
  const form = new URLSearchParams();
80
96
  for (const [k, v] of Object.entries(body)) {
81
97
  if (v === void 0 || v === null) continue;
98
+ if (Array.isArray(v)) {
99
+ for (const item of v) {
100
+ if (item === void 0 || item === null) continue;
101
+ form.append(k, typeof item === "object" ? JSON.stringify(item) : String(item));
102
+ }
103
+ continue;
104
+ }
82
105
  form.append(k, typeof v === "object" ? JSON.stringify(v) : String(v));
83
106
  }
84
107
  headers["content-type"] = "application/x-www-form-urlencoded";
@@ -91,16 +114,14 @@ var ProxmoxClient = class {
91
114
  let lastErr;
92
115
  for (let attempt = 0; attempt < 2; attempt++) {
93
116
  try {
94
- const init = { method, headers, body: bodyStr };
95
- if (this.dispatcher) init.dispatcher = this.dispatcher;
96
- const res = await fetch(url, init);
117
+ const res = await this.fetchUrl(url, method, headers, bodyStr);
97
118
  if (res.status >= 200 && res.status < 300) {
98
119
  const text = await res.text();
99
120
  if (!text) return void 0;
100
121
  const parsed = JSON.parse(text);
101
122
  return parsed && typeof parsed === "object" && "data" in parsed ? parsed.data : parsed;
102
123
  }
103
- if (res.status >= 500) {
124
+ if ([502, 503, 504].includes(res.status)) {
104
125
  lastErr = new ProxmoxUnreachableError(`HTTP ${res.status}`);
105
126
  if (attempt === 0) await sleep(this.retryDelayMs);
106
127
  continue;
@@ -120,27 +141,226 @@ var ProxmoxClient = class {
120
141
  }
121
142
  throw lastErr ?? new ProxmoxUnreachableError("unknown");
122
143
  }
144
+ async fetchUrl(url, method, headers, body) {
145
+ if (!this.usesInsecureTls) {
146
+ return fetch(url, { method, headers, body });
147
+ }
148
+ return nodeRequest(url, method, headers, body, false);
149
+ }
123
150
  };
124
151
  function sleep(ms) {
125
152
  return new Promise((r) => setTimeout(r, ms));
126
153
  }
154
+ function nodeRequest(url, method, headers, body, rejectUnauthorized) {
155
+ return new Promise((resolve, reject) => {
156
+ const parsed = new URL(url);
157
+ const requestHeaders = { ...headers };
158
+ if (body !== void 0 && requestHeaders["content-length"] === void 0) {
159
+ requestHeaders["content-length"] = String(Buffer.byteLength(body, "utf8"));
160
+ }
161
+ const req = httpsRequest(
162
+ parsed,
163
+ { method, headers: requestHeaders, rejectUnauthorized },
164
+ (res) => {
165
+ const chunks = [];
166
+ res.on("data", (chunk) => chunks.push(chunk));
167
+ res.on("end", () => {
168
+ const text = Buffer.concat(chunks).toString("utf8");
169
+ resolve({
170
+ status: res.statusCode ?? 0,
171
+ text: async () => text
172
+ });
173
+ });
174
+ }
175
+ );
176
+ req.on("error", reject);
177
+ if (body !== void 0) req.write(body);
178
+ req.end();
179
+ });
180
+ }
181
+
182
+ // src/ssh-executor.ts
183
+ import { Client } from "ssh2";
184
+ import { readFile } from "fs/promises";
185
+ import { homedir } from "os";
186
+ var DEFAULT_MAX_OUTPUT_BYTES = 1024 * 1024;
187
+ var SshExecError = class extends Error {
188
+ constructor(phase, message) {
189
+ super(`ssh ${phase}: ${message}`);
190
+ this.phase = phase;
191
+ this.name = "SshExecError";
192
+ }
193
+ };
194
+ function expandHome(p) {
195
+ if (p.startsWith("~/")) return homedir() + p.slice(1);
196
+ if (p === "~") return homedir();
197
+ return p;
198
+ }
199
+ async function loadKey(keyPath) {
200
+ try {
201
+ return await readFile(expandHome(keyPath));
202
+ } catch (e) {
203
+ const err = e;
204
+ if (err.code === "ENOENT") {
205
+ throw new SshExecError("connect", `key file not found: ${keyPath}`);
206
+ }
207
+ throw new SshExecError("connect", `cannot read key file ${keyPath}: ${err.message}`);
208
+ }
209
+ }
210
+ function base64(s) {
211
+ return Buffer.from(s, "utf8").toString("base64");
212
+ }
213
+ function buildLxcCommand(vmid, command) {
214
+ const b64 = base64(command);
215
+ return `sudo pct exec ${vmid} -- sh -c "$(echo ${b64} | base64 -d)"`;
216
+ }
217
+ function buildDirectCommand(command) {
218
+ const b64 = base64(command);
219
+ return `sh -c "$(echo ${b64} | base64 -d)"`;
220
+ }
221
+ function resolveMaxOutputBytes() {
222
+ const raw = process.env.PROXMOX_SSH_MAX_OUTPUT_BYTES;
223
+ if (!raw) return DEFAULT_MAX_OUTPUT_BYTES;
224
+ const parsed = Number.parseInt(raw, 10);
225
+ if (!Number.isFinite(parsed) || parsed < 1024) return DEFAULT_MAX_OUTPUT_BYTES;
226
+ return parsed;
227
+ }
228
+ async function runOverSsh(cfg, remoteCommand, timeoutMs, stdin) {
229
+ const key = await loadKey(cfg.keyPath);
230
+ const maxOutputBytes = resolveMaxOutputBytes();
231
+ return new Promise((resolve, reject) => {
232
+ const conn = new Client();
233
+ let stdout = "";
234
+ let stderr = "";
235
+ let stdoutBytes = 0;
236
+ let stderrBytes = 0;
237
+ let settled = false;
238
+ const timer = setTimeout(() => {
239
+ if (settled) return;
240
+ settled = true;
241
+ try {
242
+ conn.end();
243
+ } catch {
244
+ }
245
+ try {
246
+ conn.destroy();
247
+ } catch {
248
+ }
249
+ reject(new SshExecError("timeout", `command exceeded ${timeoutMs}ms`));
250
+ }, timeoutMs);
251
+ const finish = (result) => {
252
+ if (settled) return;
253
+ settled = true;
254
+ clearTimeout(timer);
255
+ try {
256
+ conn.end();
257
+ } catch {
258
+ }
259
+ resolve(result);
260
+ };
261
+ const fail = (phase, message) => {
262
+ if (settled) return;
263
+ settled = true;
264
+ clearTimeout(timer);
265
+ try {
266
+ conn.end();
267
+ } catch {
268
+ }
269
+ try {
270
+ conn.destroy();
271
+ } catch {
272
+ }
273
+ reject(new SshExecError(phase, message));
274
+ };
275
+ const appendOutput = (streamName, chunk) => {
276
+ if (settled) return;
277
+ if (streamName === "stdout") {
278
+ stdoutBytes += chunk.length;
279
+ if (stdoutBytes > maxOutputBytes) {
280
+ fail("exec", `stdout exceeded ${maxOutputBytes} bytes`);
281
+ return;
282
+ }
283
+ stdout += chunk.toString("utf8");
284
+ return;
285
+ }
286
+ stderrBytes += chunk.length;
287
+ if (stderrBytes > maxOutputBytes) {
288
+ fail("exec", `stderr exceeded ${maxOutputBytes} bytes`);
289
+ return;
290
+ }
291
+ stderr += chunk.toString("utf8");
292
+ };
293
+ conn.on("error", (err) => fail("connect", err.message));
294
+ conn.on("ready", () => {
295
+ conn.exec(remoteCommand, (err, stream) => {
296
+ if (err) return fail("exec", err.message);
297
+ stream.on("data", (chunk) => {
298
+ appendOutput("stdout", chunk);
299
+ });
300
+ stream.stderr.on("data", (chunk) => {
301
+ appendOutput("stderr", chunk);
302
+ });
303
+ stream.on("close", (code) => {
304
+ finish({ stdout, stderr, exitCode: code ?? -1 });
305
+ });
306
+ if (stdin !== void 0) {
307
+ stream.write(stdin);
308
+ stream.end();
309
+ }
310
+ });
311
+ });
312
+ conn.connect({
313
+ host: cfg.host,
314
+ port: cfg.port,
315
+ username: cfg.user,
316
+ privateKey: key,
317
+ readyTimeout: timeoutMs
318
+ });
319
+ });
320
+ }
321
+ async function execInLxc(hostCfg, vmid, command, timeoutMs, stdin) {
322
+ return runOverSsh(hostCfg, buildLxcCommand(vmid, command), timeoutMs, stdin);
323
+ }
324
+ async function execViaDirectSsh(targetCfg, command, timeoutMs, stdin) {
325
+ return runOverSsh(targetCfg, buildDirectCommand(command), timeoutMs, stdin);
326
+ }
127
327
 
128
328
  // src/security.ts
129
329
  var SECRETS = /* @__PURE__ */ new Set();
130
330
  var BASE64_TOKEN_RE = /[A-Za-z0-9+/=]{12,}/g;
331
+ var MIN_SUBSTRING_LENGTH = 8;
332
+ var warnedShortSecret = false;
333
+ function escapeRegExp(s) {
334
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
335
+ }
131
336
  function registerSecret(s) {
132
- if (s && s.length > 0) SECRETS.add(s);
337
+ if (!s || s.length === 0) return;
338
+ SECRETS.add(s);
339
+ if (s.length < MIN_SUBSTRING_LENGTH && !warnedShortSecret) {
340
+ warnedShortSecret = true;
341
+ console.error(
342
+ `proxmox-mcp: a registered secret is shorter than ${MIN_SUBSTRING_LENGTH} characters. It is still redacted, but only where it appears as a standalone value. If this is PROXMOX_TOKEN_SECRET, check that it was not truncated.`
343
+ );
344
+ }
133
345
  }
134
346
  function maskString(s) {
135
347
  let out = s;
136
348
  for (const secret of SECRETS) {
137
- if (out.includes(secret)) out = out.split(secret).join("REDACTED");
349
+ if (!out.includes(secret)) continue;
350
+ if (secret.length >= MIN_SUBSTRING_LENGTH) {
351
+ out = out.split(secret).join("REDACTED");
352
+ } else {
353
+ out = out.replace(
354
+ new RegExp(`(^|[^A-Za-z0-9])${escapeRegExp(secret)}(?=[^A-Za-z0-9]|$)`, "g"),
355
+ (_match, left) => `${left}REDACTED`
356
+ );
357
+ }
138
358
  }
139
359
  out = out.replace(BASE64_TOKEN_RE, (token) => {
140
360
  try {
141
361
  const decoded = Buffer.from(token, "base64").toString("utf8");
142
362
  for (const secret of SECRETS) {
143
- if (decoded.includes(secret)) return "REDACTED";
363
+ if (secret.length >= MIN_SUBSTRING_LENGTH && decoded.includes(secret)) return "REDACTED";
144
364
  }
145
365
  } catch {
146
366
  }
@@ -163,11 +383,34 @@ function redact(value) {
163
383
  import { Type } from "@sinclair/typebox";
164
384
 
165
385
  // src/tools/_util.ts
386
+ import { Value } from "@sinclair/typebox/value";
166
387
  function jsonToolResult(payload) {
167
388
  return {
168
389
  content: [{ type: "text", text: JSON.stringify(payload, null, 2) }]
169
390
  };
170
391
  }
392
+ var ToolInputError = class extends Error {
393
+ constructor(message) {
394
+ super(message);
395
+ this.name = "ToolInputError";
396
+ }
397
+ };
398
+ function validateToolArgs(schema, raw, toolName) {
399
+ if (Value.Check(schema, raw)) return raw;
400
+ const first = [...Value.Errors(schema, raw)][0];
401
+ const where = first?.path ? ` at ${first.path}` : "";
402
+ const message = first?.message ?? "input does not match schema";
403
+ throw new ToolInputError(`${toolName} invalid input${where}: ${message}`);
404
+ }
405
+ var SAFE_SEGMENT_RE = /^[\w.-]+$/;
406
+ function assertSafePathSegment(value, label) {
407
+ if (!SAFE_SEGMENT_RE.test(value)) {
408
+ throw new ToolInputError(
409
+ `invalid ${label} "${value}": expected only letters, digits, '_', '.', or '-'`
410
+ );
411
+ }
412
+ return value;
413
+ }
171
414
  async function resolveResource(client, vmid) {
172
415
  const resources = await client.get(
173
416
  "/cluster/resources"
@@ -180,6 +423,7 @@ async function resolveResource(client, vmid) {
180
423
  const where = matches.map((m) => `${m.node}/${m.type}`).join(", ");
181
424
  throw new Error(`vmid ${vmid} ambiguous - found on multiple nodes: ${where}. Refusing to proceed.`);
182
425
  }
426
+ assertSafePathSegment(matches[0].node, "node");
183
427
  return { node: matches[0].node, type: matches[0].type };
184
428
  }
185
429
  function parseTaskUpid(upid) {
@@ -190,6 +434,7 @@ function parseTaskUpid(upid) {
190
434
  if (parts.length < 8) throw new Error(`invalid UPID format: ${upid}`);
191
435
  const node = parts[1];
192
436
  if (!node) throw new Error(`UPID missing node segment: ${upid}`);
437
+ if (!SAFE_SEGMENT_RE.test(node)) throw new Error(`invalid UPID format: bad node segment "${node}"`);
193
438
  return { node };
194
439
  }
195
440
 
@@ -250,6 +495,7 @@ function createProxmoxListVmsTool(getClient) {
250
495
 
251
496
  // src/tools/proxmox_get_resource.ts
252
497
  import { Type as Type4 } from "@sinclair/typebox";
498
+ var NAME = "proxmox_get_resource";
253
499
  var Schema4 = Type4.Object(
254
500
  {
255
501
  vmid: Type4.Integer({ minimum: 1, description: "Container or VM ID." })
@@ -258,12 +504,12 @@ var Schema4 = Type4.Object(
258
504
  );
259
505
  function createProxmoxGetResourceTool(getClient) {
260
506
  return {
261
- name: "proxmox_get_resource",
507
+ name: NAME,
262
508
  label: "proxmox: get resource",
263
509
  description: "Get full current status for one LXC or VM by vmid (resolves node+type from cluster resources, then GET /nodes/{node}/{type}/{vmid}/status/current).",
264
510
  parameters: Schema4,
265
511
  execute: async (_id, raw) => {
266
- const args = raw;
512
+ const args = validateToolArgs(Schema4, raw, NAME);
267
513
  const client = getClient();
268
514
  const { node, type } = await resolveResource(client, args.vmid);
269
515
  const status = await client.get(
@@ -274,27 +520,284 @@ function createProxmoxGetResourceTool(getClient) {
274
520
  };
275
521
  }
276
522
 
277
- // src/tools/proxmox_recent_tasks.ts
523
+ // src/tools/proxmox_get_vm_config.ts
278
524
  import { Type as Type5 } from "@sinclair/typebox";
279
525
  var Schema5 = Type5.Object(
280
526
  {
281
- limit: Type5.Optional(
282
- Type5.Integer({ minimum: 1, maximum: 500, description: "Max tasks to return (default 25)." })
527
+ vmid: Type5.Integer({ minimum: 1, description: "QEMU VM ID." })
528
+ },
529
+ { additionalProperties: false }
530
+ );
531
+ var NAME2 = "proxmox_get_vm_config";
532
+ function createProxmoxGetVmConfigTool(getClient) {
533
+ return {
534
+ name: NAME2,
535
+ label: "proxmox: get VM config",
536
+ description: "Get QEMU VM config by vmid (GET /nodes/{node}/qemu/{vmid}/config). Fails if the vmid is not a QEMU VM.",
537
+ parameters: Schema5,
538
+ execute: async (_id, raw) => {
539
+ const args = validateToolArgs(Schema5, raw, NAME2);
540
+ const client = getClient();
541
+ const { node, type } = await resolveResource(client, args.vmid);
542
+ if (type !== "qemu") throw new Error(`vmid ${args.vmid} is ${type}, not qemu`);
543
+ const config = await client.get(`/nodes/${node}/qemu/${args.vmid}/config`);
544
+ return jsonToolResult({ vmid: args.vmid, node, type, config });
545
+ }
546
+ };
547
+ }
548
+
549
+ // src/tools/proxmox_get_container_config.ts
550
+ import { Type as Type6 } from "@sinclair/typebox";
551
+ var Schema6 = Type6.Object(
552
+ {
553
+ vmid: Type6.Integer({ minimum: 1, description: "LXC container ID." })
554
+ },
555
+ { additionalProperties: false }
556
+ );
557
+ var NAME3 = "proxmox_get_container_config";
558
+ function createProxmoxGetContainerConfigTool(getClient) {
559
+ return {
560
+ name: NAME3,
561
+ label: "proxmox: get container config",
562
+ description: "Get LXC container config by vmid (GET /nodes/{node}/lxc/{vmid}/config). Fails if the vmid is not an LXC container.",
563
+ parameters: Schema6,
564
+ execute: async (_id, raw) => {
565
+ const args = validateToolArgs(Schema6, raw, NAME3);
566
+ const client = getClient();
567
+ const { node, type } = await resolveResource(client, args.vmid);
568
+ if (type !== "lxc") throw new Error(`vmid ${args.vmid} is ${type}, not lxc`);
569
+ const config = await client.get(`/nodes/${node}/lxc/${args.vmid}/config`);
570
+ return jsonToolResult({ vmid: args.vmid, node, type, config });
571
+ }
572
+ };
573
+ }
574
+
575
+ // src/tools/proxmox_validate_qemu_smoke_source.ts
576
+ import { Type as Type7 } from "@sinclair/typebox";
577
+ var Schema7 = Type7.Object(
578
+ {
579
+ vmid: Type7.Integer({ minimum: 1, description: "QEMU VM ID to validate as a smoke clone source." }),
580
+ max_disk_gb: Type7.Optional(
581
+ Type7.Integer({ minimum: 1, description: "Maximum acceptable source disk size in GiB (default 64)." })
582
+ ),
583
+ allow_running: Type7.Optional(
584
+ Type7.Boolean({ description: "Allow running sources instead of requiring stopped/template state (default false)." })
585
+ )
586
+ },
587
+ { additionalProperties: false }
588
+ );
589
+ var NAME4 = "proxmox_validate_qemu_smoke_source";
590
+ var GIB = 1024 ** 3;
591
+ var UNSAFE_PREFIXES = ["hostpci", "usb"];
592
+ function truthyProxmoxValue(value) {
593
+ if (value === 1 || value === true) return true;
594
+ if (typeof value !== "string") return false;
595
+ return value === "1" || value.startsWith("enabled=1") || value.split(",").includes("enabled=1");
596
+ }
597
+ function configKeysWithPrefixes(config, prefixes) {
598
+ return Object.keys(config).filter((key) => prefixes.some((prefix) => key.startsWith(prefix)));
599
+ }
600
+ function diskSizeGiB(resource) {
601
+ return typeof resource.maxdisk === "number" ? resource.maxdisk / GIB : void 0;
602
+ }
603
+ function createProxmoxValidateQemuSmokeSourceTool(getClient) {
604
+ return {
605
+ name: NAME4,
606
+ label: "proxmox: validate QEMU smoke source",
607
+ description: "Validate that a QEMU VM is a safe live-smoke clone source. Checks passthrough devices, guest agent, running state, and disk size before cloning.",
608
+ parameters: Schema7,
609
+ execute: async (_id, raw) => {
610
+ const args = validateToolArgs(
611
+ Schema7,
612
+ raw,
613
+ NAME4
614
+ );
615
+ const client = getClient();
616
+ const { node, type } = await resolveResource(client, args.vmid);
617
+ if (type !== "qemu") throw new Error(`vmid ${args.vmid} is ${type}, not qemu`);
618
+ const resources = await client.get("/cluster/resources");
619
+ const resource = resources.find((entry) => entry.vmid === args.vmid && entry.type === "qemu");
620
+ if (!resource) throw new Error(`vmid ${args.vmid} not found in cluster resources as qemu`);
621
+ const config = await client.get(`/nodes/${node}/qemu/${args.vmid}/config`);
622
+ const blockers = [];
623
+ const warnings = [];
624
+ const unsafeKeys = configKeysWithPrefixes(config, UNSAFE_PREFIXES);
625
+ if (unsafeKeys.length > 0) {
626
+ blockers.push(`unsafe passthrough/device config present: ${unsafeKeys.join(", ")}`);
627
+ }
628
+ if (typeof config.args === "string" && config.args.length > 0) {
629
+ blockers.push("raw qemu args present");
630
+ }
631
+ if (!truthyProxmoxValue(config.agent)) {
632
+ blockers.push("QEMU guest agent is not enabled in VM config");
633
+ }
634
+ const maxDiskGb = args.max_disk_gb ?? 64;
635
+ const sizeGiB = diskSizeGiB(resource);
636
+ if (typeof sizeGiB === "number" && sizeGiB > maxDiskGb) {
637
+ blockers.push(`source disk is ${sizeGiB.toFixed(1)} GiB, over ${maxDiskGb} GiB limit`);
638
+ }
639
+ const isTemplate = resource.template === 1 || truthyProxmoxValue(config.template);
640
+ if (!isTemplate && resource.status === "running" && args.allow_running !== true) {
641
+ blockers.push("source VM is running; stop it first or pass allow_running:true");
642
+ }
643
+ if (!isTemplate && resource.status !== "stopped" && resource.status !== "running") {
644
+ warnings.push(`source VM status is ${resource.status ?? "unknown"}`);
645
+ }
646
+ return jsonToolResult({
647
+ vmid: args.vmid,
648
+ node,
649
+ ok: blockers.length === 0,
650
+ blockers,
651
+ warnings,
652
+ resource: {
653
+ name: resource.name,
654
+ status: resource.status,
655
+ template: resource.template === 1,
656
+ pool: resource.pool,
657
+ tags: resource.tags,
658
+ disk_gb: typeof sizeGiB === "number" ? Number(sizeGiB.toFixed(1)) : void 0
659
+ },
660
+ config_summary: {
661
+ agent: config.agent,
662
+ unsafe_keys: unsafeKeys,
663
+ has_raw_args: typeof config.args === "string" && config.args.length > 0
664
+ }
665
+ });
666
+ }
667
+ };
668
+ }
669
+
670
+ // src/tools/proxmox_audit_permissions.ts
671
+ import { Type as Type8 } from "@sinclair/typebox";
672
+ var Schema8 = Type8.Object(
673
+ {
674
+ userid: Type8.Optional(
675
+ Type8.String({
676
+ minLength: 1,
677
+ description: "Optional user or full API token ID to audit. Defaults to current API identity."
678
+ })
679
+ ),
680
+ paths: Type8.Optional(
681
+ Type8.Array(Type8.String({ minLength: 1 }), {
682
+ minItems: 1,
683
+ description: "Permission paths to inspect. Defaults to common smoke-test paths."
684
+ })
685
+ ),
686
+ pool: Type8.Optional(Type8.String({ minLength: 1, description: "Pool path shortcut (default mcp-smoke)." })),
687
+ template_storage: Type8.Optional(Type8.String({ minLength: 1, description: "Template storage shortcut (default local)." })),
688
+ root_storage: Type8.Optional(Type8.String({ minLength: 1, description: "Root disk storage shortcut (default local-lvm)." })),
689
+ source_vmid: Type8.Optional(Type8.Integer({ minimum: 1, description: "Optional source VMID path to inspect." })),
690
+ target_vmid: Type8.Optional(Type8.Integer({ minimum: 1, description: "Optional target VMID path to inspect." })),
691
+ required_privileges: Type8.Optional(
692
+ Type8.Array(Type8.String({ minLength: 1 }), {
693
+ minItems: 1,
694
+ description: "Privileges to summarize on every returned path."
695
+ })
696
+ )
697
+ },
698
+ { additionalProperties: false }
699
+ );
700
+ var NAME5 = "proxmox_audit_permissions";
701
+ var DEFAULT_REQUIRED = [
702
+ "Datastore.AllocateSpace",
703
+ "Datastore.Audit",
704
+ "Pool.Allocate",
705
+ "Pool.Audit",
706
+ "SDN.Use",
707
+ "Sys.Audit",
708
+ "VM.Allocate",
709
+ "VM.Audit",
710
+ "VM.Backup",
711
+ "VM.Clone",
712
+ "VM.Config.Disk",
713
+ "VM.Config.Memory",
714
+ "VM.Config.Network",
715
+ "VM.Config.Options",
716
+ "VM.GuestAgent.Audit",
717
+ "VM.PowerMgmt",
718
+ "VM.Snapshot",
719
+ "VM.Snapshot.Rollback"
720
+ ];
721
+ function defaultPaths(args) {
722
+ const pool = assertSafePathSegment(args.pool ?? "mcp-smoke", "pool");
723
+ const templateStorage = assertSafePathSegment(args.template_storage ?? "local", "template_storage");
724
+ const rootStorage = assertSafePathSegment(args.root_storage ?? "local-lvm", "root_storage");
725
+ const paths = [
726
+ "/",
727
+ `/pool/${pool}`,
728
+ `/storage/${templateStorage}`,
729
+ `/storage/${rootStorage}`,
730
+ "/sdn"
731
+ ];
732
+ if (args.source_vmid !== void 0) paths.push(`/vms/${args.source_vmid}`);
733
+ if (args.target_vmid !== void 0) paths.push(`/vms/${args.target_vmid}`);
734
+ return [...new Set(paths)];
735
+ }
736
+ function withQuery(path2, params) {
737
+ const search = new URLSearchParams();
738
+ for (const [key, value] of Object.entries(params)) {
739
+ if (value !== void 0) search.append(key, value);
740
+ }
741
+ const qs = search.toString();
742
+ return qs ? `${path2}?${qs}` : path2;
743
+ }
744
+ function createProxmoxAuditPermissionsTool(getClient) {
745
+ return {
746
+ name: NAME5,
747
+ label: "proxmox: audit permissions",
748
+ description: "Read effective Proxmox permissions for the current token or a specified user/token across smoke-relevant paths (GET /access/permissions).",
749
+ parameters: Schema8,
750
+ execute: async (_id, raw) => {
751
+ const args = validateToolArgs(Schema8, raw, NAME5);
752
+ const paths = args.paths ?? defaultPaths(args);
753
+ const required = args.required_privileges ?? DEFAULT_REQUIRED;
754
+ const client = getClient();
755
+ const results = [];
756
+ for (const path2 of paths) {
757
+ const permissions = await client.get(
758
+ withQuery("/access/permissions", { path: path2, userid: args.userid })
759
+ );
760
+ const privileges = permissions[path2] ?? permissions[Object.keys(permissions)[0] ?? ""] ?? {};
761
+ const missing = required.filter((priv) => privileges[priv] !== 1);
762
+ results.push({
763
+ path: path2,
764
+ privilege_count: Object.keys(privileges).length,
765
+ missing_required: missing,
766
+ has_all_required: missing.length === 0,
767
+ privileges
768
+ });
769
+ }
770
+ return jsonToolResult({
771
+ userid: args.userid ?? "current",
772
+ required_privileges: required,
773
+ paths: results
774
+ });
775
+ }
776
+ };
777
+ }
778
+
779
+ // src/tools/proxmox_recent_tasks.ts
780
+ import { Type as Type9 } from "@sinclair/typebox";
781
+ var NAME6 = "proxmox_recent_tasks";
782
+ var Schema9 = Type9.Object(
783
+ {
784
+ limit: Type9.Optional(
785
+ Type9.Integer({ minimum: 1, maximum: 500, description: "Max tasks to return (default 25)." })
283
786
  ),
284
- vmid: Type5.Optional(
285
- Type5.Integer({ minimum: 1, description: "Filter tasks by vmid (post-filter)." })
787
+ vmid: Type9.Optional(
788
+ Type9.Integer({ minimum: 1, description: "Filter tasks by vmid (post-filter)." })
286
789
  )
287
790
  },
288
791
  { additionalProperties: false }
289
792
  );
290
793
  function createProxmoxRecentTasksTool(getClient) {
291
794
  return {
292
- name: "proxmox_recent_tasks",
795
+ name: NAME6,
293
796
  label: "proxmox: recent tasks",
294
797
  description: "List recent cluster tasks (UPID, type, status, node, user, timing) via GET /cluster/tasks. Optionally filter by vmid (post-filter client-side).",
295
- parameters: Schema5,
798
+ parameters: Schema9,
296
799
  execute: async (_id, raw) => {
297
- const args = raw;
800
+ const args = validateToolArgs(Schema9, raw, NAME6);
298
801
  const limit = args.limit ?? 25;
299
802
  const client = getClient();
300
803
  const tasks = await client.get("/cluster/tasks");
@@ -314,26 +817,27 @@ function createProxmoxRecentTasksTool(getClient) {
314
817
  }
315
818
 
316
819
  // src/tools/proxmox_list_backups.ts
317
- import { Type as Type6 } from "@sinclair/typebox";
318
- var Schema6 = Type6.Object(
820
+ import { Type as Type10 } from "@sinclair/typebox";
821
+ var NAME7 = "proxmox_list_backups";
822
+ var Schema10 = Type10.Object(
319
823
  {
320
- node: Type6.Optional(
321
- Type6.String({ minLength: 1, description: "Node to query (defaults to first node)." })
824
+ node: Type10.Optional(
825
+ Type10.String({ minLength: 1, description: "Node to query (defaults to first node)." })
322
826
  ),
323
- vmid: Type6.Optional(
324
- Type6.Integer({ minimum: 1, description: "Filter backups to a single vmid (post-filter)." })
827
+ vmid: Type10.Optional(
828
+ Type10.Integer({ minimum: 1, description: "Filter backups to a single vmid (post-filter)." })
325
829
  )
326
830
  },
327
831
  { additionalProperties: false }
328
832
  );
329
833
  function createProxmoxListBackupsTool(getClient) {
330
834
  return {
331
- name: "proxmox_list_backups",
835
+ name: NAME7,
332
836
  label: "proxmox: list backups",
333
837
  description: "List backup volumes on a node. Walks each backup-capable storage via GET /nodes/{node}/storage/{storage}/content?content=backup. Optionally filter by vmid.",
334
- parameters: Schema6,
838
+ parameters: Schema10,
335
839
  execute: async (_id, raw) => {
336
- const args = raw;
840
+ const args = validateToolArgs(Schema10, raw, NAME7);
337
841
  const client = getClient();
338
842
  let node = args.node;
339
843
  if (!node) {
@@ -356,12 +860,13 @@ function createProxmoxListBackupsTool(getClient) {
356
860
  }
357
861
 
358
862
  // src/tools/proxmox_resource_usage.ts
359
- import { Type as Type7 } from "@sinclair/typebox";
360
- var Schema7 = Type7.Object(
863
+ import { Type as Type11 } from "@sinclair/typebox";
864
+ var NAME8 = "proxmox_resource_usage";
865
+ var Schema11 = Type11.Object(
361
866
  {
362
- vmid: Type7.Integer({ minimum: 1, description: "Container or VM ID." }),
363
- timeframe: Type7.Optional(
364
- Type7.Union([Type7.Literal("hour"), Type7.Literal("day"), Type7.Literal("week")], {
867
+ vmid: Type11.Integer({ minimum: 1, description: "Container or VM ID." }),
868
+ timeframe: Type11.Optional(
869
+ Type11.Union([Type11.Literal("hour"), Type11.Literal("day"), Type11.Literal("week")], {
365
870
  description: "RRD timeframe window (default hour)."
366
871
  })
367
872
  )
@@ -370,12 +875,12 @@ var Schema7 = Type7.Object(
370
875
  );
371
876
  function createProxmoxResourceUsageTool(getClient) {
372
877
  return {
373
- name: "proxmox_resource_usage",
878
+ name: NAME8,
374
879
  label: "proxmox: resource usage",
375
880
  description: "Get historical CPU/memory/disk/network samples for one LXC or VM via GET /nodes/{node}/{type}/{vmid}/rrddata?timeframe=<hour|day|week>.",
376
- parameters: Schema7,
881
+ parameters: Schema11,
377
882
  execute: async (_id, raw) => {
378
- const args = raw;
883
+ const args = validateToolArgs(Schema11, raw, NAME8);
379
884
  const timeframe = args.timeframe ?? "hour";
380
885
  const client = getClient();
381
886
  const { node, type } = await resolveResource(client, args.vmid);
@@ -388,7 +893,7 @@ function createProxmoxResourceUsageTool(getClient) {
388
893
  }
389
894
 
390
895
  // src/tools/proxmox_start_resource.ts
391
- import { Type as Type8 } from "@sinclair/typebox";
896
+ import { Type as Type12 } from "@sinclair/typebox";
392
897
 
393
898
  // src/gates.ts
394
899
  var WriteGateError = class extends Error {
@@ -419,25 +924,25 @@ function assertEnvFlag(envKey, toolName, env = process.env) {
419
924
  }
420
925
 
421
926
  // src/tools/proxmox_start_resource.ts
422
- var Schema8 = Type8.Object(
927
+ var Schema12 = Type12.Object(
423
928
  {
424
- vmid: Type8.Integer({ minimum: 1, description: "Container or VM ID." }),
425
- confirm: Type8.Boolean({
929
+ vmid: Type12.Integer({ minimum: 1, description: "Container or VM ID." }),
930
+ confirm: Type12.Boolean({
426
931
  description: "Must be true to write. Tier-2 safe-write gate."
427
932
  })
428
933
  },
429
934
  { additionalProperties: false }
430
935
  );
431
- var NAME = "proxmox_start_resource";
936
+ var NAME9 = "proxmox_start_resource";
432
937
  function createProxmoxStartResourceTool(getClient) {
433
938
  return {
434
- name: NAME,
939
+ name: NAME9,
435
940
  label: "proxmox: start resource",
436
941
  description: "Start a stopped LXC container or QEMU VM by vmid. Tier-2 write; requires confirm:true.",
437
- parameters: Schema8,
942
+ parameters: Schema12,
438
943
  execute: async (_id, raw) => {
439
- assertConfirmedWrite(raw, NAME);
440
- const args = raw;
944
+ assertConfirmedWrite(raw, NAME9);
945
+ const args = validateToolArgs(Schema12, raw, NAME9);
441
946
  const client = getClient();
442
947
  const { node, type } = await resolveResource(client, args.vmid);
443
948
  const upid = await client.post(
@@ -450,15 +955,15 @@ function createProxmoxStartResourceTool(getClient) {
450
955
  }
451
956
 
452
957
  // src/tools/proxmox_stop_resource.ts
453
- import { Type as Type9 } from "@sinclair/typebox";
454
- var Schema9 = Type9.Object(
958
+ import { Type as Type13 } from "@sinclair/typebox";
959
+ var Schema13 = Type13.Object(
455
960
  {
456
- vmid: Type9.Integer({ minimum: 1, description: "Container or VM ID." }),
457
- confirm: Type9.Boolean({
961
+ vmid: Type13.Integer({ minimum: 1, description: "Container or VM ID." }),
962
+ confirm: Type13.Boolean({
458
963
  description: "Must be true to write. Tier-2 safe-write gate."
459
964
  }),
460
- timeoutSeconds: Type9.Optional(
461
- Type9.Integer({
965
+ timeoutSeconds: Type13.Optional(
966
+ Type13.Integer({
462
967
  minimum: 1,
463
968
  description: "Optional shutdown timeout in seconds (passed through to PVE as `timeout`)."
464
969
  })
@@ -466,16 +971,16 @@ var Schema9 = Type9.Object(
466
971
  },
467
972
  { additionalProperties: false }
468
973
  );
469
- var NAME2 = "proxmox_stop_resource";
974
+ var NAME10 = "proxmox_stop_resource";
470
975
  function createProxmoxStopResourceTool(getClient) {
471
976
  return {
472
- name: NAME2,
977
+ name: NAME10,
473
978
  label: "proxmox: stop resource",
474
979
  description: "Gracefully shutdown an LXC container or QEMU VM by vmid (POST status/shutdown). Tier-2 write; requires confirm:true.",
475
- parameters: Schema9,
980
+ parameters: Schema13,
476
981
  execute: async (_id, raw) => {
477
- assertConfirmedWrite(raw, NAME2);
478
- const args = raw;
982
+ assertConfirmedWrite(raw, NAME10);
983
+ const args = validateToolArgs(Schema13, raw, NAME10);
479
984
  const client = getClient();
480
985
  const { node, type } = await resolveResource(client, args.vmid);
481
986
  const body = {};
@@ -492,26 +997,26 @@ function createProxmoxStopResourceTool(getClient) {
492
997
  }
493
998
 
494
999
  // src/tools/proxmox_reboot_resource.ts
495
- import { Type as Type10 } from "@sinclair/typebox";
496
- var Schema10 = Type10.Object(
1000
+ import { Type as Type14 } from "@sinclair/typebox";
1001
+ var Schema14 = Type14.Object(
497
1002
  {
498
- vmid: Type10.Integer({ minimum: 1, description: "Container or VM ID." }),
499
- confirm: Type10.Boolean({
1003
+ vmid: Type14.Integer({ minimum: 1, description: "Container or VM ID." }),
1004
+ confirm: Type14.Boolean({
500
1005
  description: "Must be true to write. Tier-2 safe-write gate."
501
1006
  })
502
1007
  },
503
1008
  { additionalProperties: false }
504
1009
  );
505
- var NAME3 = "proxmox_reboot_resource";
1010
+ var NAME11 = "proxmox_reboot_resource";
506
1011
  function createProxmoxRebootResourceTool(getClient) {
507
1012
  return {
508
- name: NAME3,
1013
+ name: NAME11,
509
1014
  label: "proxmox: reboot resource",
510
1015
  description: "Reboot an LXC container or QEMU VM by vmid (POST status/reboot). Tier-2 write; requires confirm:true.",
511
- parameters: Schema10,
1016
+ parameters: Schema14,
512
1017
  execute: async (_id, raw) => {
513
- assertConfirmedWrite(raw, NAME3);
514
- const args = raw;
1018
+ assertConfirmedWrite(raw, NAME11);
1019
+ const args = validateToolArgs(Schema14, raw, NAME11);
515
1020
  const client = getClient();
516
1021
  const { node, type } = await resolveResource(client, args.vmid);
517
1022
  const upid = await client.post(
@@ -524,33 +1029,37 @@ function createProxmoxRebootResourceTool(getClient) {
524
1029
  }
525
1030
 
526
1031
  // src/tools/proxmox_snapshot_resource.ts
527
- import { Type as Type11 } from "@sinclair/typebox";
528
- var Schema11 = Type11.Object(
1032
+ import { Type as Type15 } from "@sinclair/typebox";
1033
+ var Schema15 = Type15.Object(
529
1034
  {
530
- vmid: Type11.Integer({ minimum: 1, description: "Container or VM ID." }),
531
- snapname: Type11.String({
1035
+ vmid: Type15.Integer({ minimum: 1, description: "Container or VM ID." }),
1036
+ snapname: Type15.String({
532
1037
  minLength: 1,
533
1038
  description: "Snapshot name (PVE convention: lowercase, no spaces)."
534
1039
  }),
535
- description: Type11.Optional(
536
- Type11.String({ description: "Optional human description for the snapshot." })
1040
+ description: Type15.Optional(
1041
+ Type15.String({ description: "Optional human description for the snapshot." })
537
1042
  ),
538
- confirm: Type11.Boolean({
1043
+ confirm: Type15.Boolean({
539
1044
  description: "Must be true to write. Tier-2 safe-write gate."
540
1045
  })
541
1046
  },
542
1047
  { additionalProperties: false }
543
1048
  );
544
- var NAME4 = "proxmox_snapshot_resource";
1049
+ var NAME12 = "proxmox_snapshot_resource";
545
1050
  function createProxmoxSnapshotResourceTool(getClient) {
546
1051
  return {
547
- name: NAME4,
1052
+ name: NAME12,
548
1053
  label: "proxmox: snapshot resource",
549
1054
  description: "Create a snapshot of an LXC container or QEMU VM by vmid (POST /snapshot with {snapname, description?}). Tier-2 write; requires confirm:true.",
550
- parameters: Schema11,
1055
+ parameters: Schema15,
551
1056
  execute: async (_id, raw) => {
552
- assertConfirmedWrite(raw, NAME4);
553
- const args = raw;
1057
+ assertConfirmedWrite(raw, NAME12);
1058
+ const args = validateToolArgs(
1059
+ Schema15,
1060
+ raw,
1061
+ NAME12
1062
+ );
554
1063
  const client = getClient();
555
1064
  const { node, type } = await resolveResource(client, args.vmid);
556
1065
  const body = { snapname: args.snapname };
@@ -572,37 +1081,106 @@ function createProxmoxSnapshotResourceTool(getClient) {
572
1081
  };
573
1082
  }
574
1083
 
1084
+ // src/tools/proxmox_rollback_snapshot.ts
1085
+ import { Type as Type16 } from "@sinclair/typebox";
1086
+ var Schema16 = Type16.Object(
1087
+ {
1088
+ vmid: Type16.Integer({ minimum: 1, description: "Container or VM ID." }),
1089
+ snapname: Type16.String({ minLength: 1, description: "Snapshot name to roll back to." }),
1090
+ start: Type16.Optional(
1091
+ Type16.Boolean({ description: "Start the resource after rollback completes (default false)." })
1092
+ ),
1093
+ confirm: Type16.Boolean({ description: "Must be true. Tier-3 destructive gate." }),
1094
+ destructive: Type16.Boolean({ description: "Must be true. Tier-3 destructive gate." })
1095
+ },
1096
+ { additionalProperties: false }
1097
+ );
1098
+ var NAME13 = "proxmox_rollback_snapshot";
1099
+ function createProxmoxRollbackSnapshotTool(getClient) {
1100
+ return {
1101
+ name: NAME13,
1102
+ label: "proxmox: rollback snapshot",
1103
+ description: "Roll back an LXC container or QEMU VM to a named snapshot. Tier-3 destructive because it reverts guest state; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
1104
+ parameters: Schema16,
1105
+ execute: async (_id, raw) => {
1106
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME13);
1107
+ assertDestructive(raw, NAME13);
1108
+ const args = validateToolArgs(Schema16, raw, NAME13);
1109
+ const client = getClient();
1110
+ const { node, type } = await resolveResource(client, args.vmid);
1111
+ const upid = await client.post(
1112
+ `/nodes/${node}/${type}/${args.vmid}/snapshot/${encodeURIComponent(args.snapname)}/rollback`,
1113
+ { start: args.start ? 1 : 0 }
1114
+ );
1115
+ return jsonToolResult({ vmid: args.vmid, node, type, snapname: args.snapname, start: args.start === true, upid });
1116
+ }
1117
+ };
1118
+ }
1119
+
575
1120
  // src/tools/proxmox_run_backup.ts
576
- import { Type as Type12 } from "@sinclair/typebox";
577
- var Schema12 = Type12.Object(
1121
+ import { Type as Type18 } from "@sinclair/typebox";
1122
+
1123
+ // src/tools/task-wait.ts
1124
+ import { Type as Type17 } from "@sinclair/typebox";
1125
+ var taskWaitFields = {
1126
+ wait: Type17.Optional(
1127
+ Type17.Boolean({ description: "Block until the task finishes and include its exit status in the result." })
1128
+ ),
1129
+ wait_timeout: Type17.Optional(
1130
+ Type17.Integer({ minimum: 1, maximum: 3600, description: "Max seconds to wait when wait:true (default 120)." })
1131
+ )
1132
+ };
1133
+ function sleep2(ms) {
1134
+ return new Promise((resolve) => setTimeout(resolve, ms));
1135
+ }
1136
+ async function resolveTaskWait(client, upid, args, intervalMs = 1e3) {
1137
+ if (!args.wait || typeof upid !== "string" || !upid.startsWith("UPID:")) return void 0;
1138
+ const { node } = parseTaskUpid(upid);
1139
+ const deadline = Date.now() + (args.wait_timeout ?? 120) * 1e3;
1140
+ let polls = 0;
1141
+ let last = null;
1142
+ while (Date.now() <= deadline) {
1143
+ polls += 1;
1144
+ last = await client.get(`/nodes/${node}/tasks/${encodeURIComponent(upid)}/status`);
1145
+ if (last.status === "stopped" || last.exitstatus) {
1146
+ return { done: true, polls, status: last.status, exitstatus: last.exitstatus, ok: last.exitstatus === "OK" };
1147
+ }
1148
+ await sleep2(Math.min(intervalMs, Math.max(0, deadline - Date.now())));
1149
+ }
1150
+ return { done: false, polls, status: last?.status };
1151
+ }
1152
+
1153
+ // src/tools/proxmox_run_backup.ts
1154
+ var Schema17 = Type18.Object(
578
1155
  {
579
- vmid: Type12.Integer({ minimum: 1, description: "Container or VM ID to back up." }),
580
- storage: Type12.String({
1156
+ vmid: Type18.Integer({ minimum: 1, description: "Container or VM ID to back up." }),
1157
+ storage: Type18.String({
581
1158
  minLength: 1,
582
1159
  description: "PVE storage ID where the vzdump archive should be written."
583
1160
  }),
584
- mode: Type12.Optional(
585
- Type12.Union(
586
- [Type12.Literal("snapshot"), Type12.Literal("suspend"), Type12.Literal("stop")],
1161
+ mode: Type18.Optional(
1162
+ Type18.Union(
1163
+ [Type18.Literal("snapshot"), Type18.Literal("suspend"), Type18.Literal("stop")],
587
1164
  { description: "Backup mode. Defaults to 'snapshot'." }
588
1165
  )
589
1166
  ),
590
- confirm: Type12.Boolean({
1167
+ confirm: Type18.Boolean({
591
1168
  description: "Must be true to write. Tier-2 safe-write gate."
592
- })
1169
+ }),
1170
+ ...taskWaitFields
593
1171
  },
594
1172
  { additionalProperties: false }
595
1173
  );
596
- var NAME5 = "proxmox_run_backup";
1174
+ var NAME14 = "proxmox_run_backup";
597
1175
  function createProxmoxRunBackupTool(getClient) {
598
1176
  return {
599
- name: NAME5,
1177
+ name: NAME14,
600
1178
  label: "proxmox: run backup",
601
1179
  description: "Trigger a vzdump backup of a single vmid to a target storage (POST /nodes/{node}/vzdump with {vmid, storage, mode, compress:'zstd'}). Tier-2 write; requires confirm:true.",
602
- parameters: Schema12,
1180
+ parameters: Schema17,
603
1181
  execute: async (_id, raw) => {
604
- assertConfirmedWrite(raw, NAME5);
605
- const args = raw;
1182
+ assertConfirmedWrite(raw, NAME14);
1183
+ const args = validateToolArgs(Schema17, raw, NAME14);
606
1184
  const mode = args.mode ?? "snapshot";
607
1185
  const client = getClient();
608
1186
  const { node } = await resolveResource(client, args.vmid);
@@ -612,22 +1190,25 @@ function createProxmoxRunBackupTool(getClient) {
612
1190
  mode,
613
1191
  compress: "zstd"
614
1192
  });
1193
+ const task = await resolveTaskWait(client, upid, args);
615
1194
  return jsonToolResult({
616
1195
  vmid: args.vmid,
617
1196
  node,
618
1197
  storage: args.storage,
619
1198
  mode,
620
- upid
1199
+ upid,
1200
+ ...task ? { task } : {}
621
1201
  });
622
1202
  }
623
1203
  };
624
1204
  }
625
1205
 
626
1206
  // src/tools/proxmox_get_task_status.ts
627
- import { Type as Type13 } from "@sinclair/typebox";
628
- var Schema13 = Type13.Object(
1207
+ import { Type as Type19 } from "@sinclair/typebox";
1208
+ var NAME15 = "proxmox_get_task_status";
1209
+ var Schema18 = Type19.Object(
629
1210
  {
630
- upid: Type13.String({
1211
+ upid: Type19.String({
631
1212
  minLength: 1,
632
1213
  description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
633
1214
  })
@@ -636,12 +1217,12 @@ var Schema13 = Type13.Object(
636
1217
  );
637
1218
  function createProxmoxGetTaskStatusTool(getClient) {
638
1219
  return {
639
- name: "proxmox_get_task_status",
1220
+ name: NAME15,
640
1221
  label: "proxmox: get task status",
641
1222
  description: "Get the current status of a Proxmox task by UPID (running/stopped, exit status) via GET /nodes/{node}/tasks/{upid}/status. Node is parsed from the UPID.",
642
- parameters: Schema13,
1223
+ parameters: Schema18,
643
1224
  execute: async (_id, raw) => {
644
- const args = raw;
1225
+ const args = validateToolArgs(Schema18, raw, NAME15);
645
1226
  const { node } = parseTaskUpid(args.upid);
646
1227
  const client = getClient();
647
1228
  const status = await client.get(
@@ -653,18 +1234,19 @@ function createProxmoxGetTaskStatusTool(getClient) {
653
1234
  }
654
1235
 
655
1236
  // src/tools/proxmox_get_task_log.ts
656
- import { Type as Type14 } from "@sinclair/typebox";
657
- var Schema14 = Type14.Object(
1237
+ import { Type as Type20 } from "@sinclair/typebox";
1238
+ var NAME16 = "proxmox_get_task_log";
1239
+ var Schema19 = Type20.Object(
658
1240
  {
659
- upid: Type14.String({
1241
+ upid: Type20.String({
660
1242
  minLength: 1,
661
1243
  description: "Task UPID returned by a prior write tool."
662
1244
  }),
663
- start: Type14.Optional(
664
- Type14.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
1245
+ start: Type20.Optional(
1246
+ Type20.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
665
1247
  ),
666
- limit: Type14.Optional(
667
- Type14.Integer({
1248
+ limit: Type20.Optional(
1249
+ Type20.Integer({
668
1250
  minimum: 1,
669
1251
  maximum: 500,
670
1252
  description: "Max lines to return (default 50, max 500)."
@@ -675,12 +1257,12 @@ var Schema14 = Type14.Object(
675
1257
  );
676
1258
  function createProxmoxGetTaskLogTool(getClient) {
677
1259
  return {
678
- name: "proxmox_get_task_log",
1260
+ name: NAME16,
679
1261
  label: "proxmox: get task log",
680
1262
  description: "Tail a Proxmox task log by UPID via GET /nodes/{node}/tasks/{upid}/log?start=N&limit=M. Node is parsed from the UPID. Returns { lines, total }.",
681
- parameters: Schema14,
1263
+ parameters: Schema19,
682
1264
  execute: async (_id, raw) => {
683
- const args = raw;
1265
+ const args = validateToolArgs(Schema19, raw, NAME16);
684
1266
  const { node } = parseTaskUpid(args.upid);
685
1267
  const start = args.start ?? 0;
686
1268
  const limit = args.limit ?? 50;
@@ -694,18 +1276,19 @@ function createProxmoxGetTaskLogTool(getClient) {
694
1276
  }
695
1277
 
696
1278
  // src/tools/proxmox_list_templates.ts
697
- import { Type as Type15 } from "@sinclair/typebox";
698
- var Schema15 = Type15.Object(
1279
+ import { Type as Type21 } from "@sinclair/typebox";
1280
+ var NAME17 = "proxmox_list_templates";
1281
+ var Schema20 = Type21.Object(
699
1282
  {
700
- node: Type15.Optional(
701
- Type15.String({ minLength: 1, description: "Node to query (defaults to first node)." })
1283
+ node: Type21.Optional(
1284
+ Type21.String({ minLength: 1, description: "Node to query (defaults to first node)." })
702
1285
  ),
703
- storage: Type15.Optional(
704
- Type15.String({ minLength: 1, description: "Storage to query (defaults to 'local')." })
1286
+ storage: Type21.Optional(
1287
+ Type21.String({ minLength: 1, description: "Storage to query (defaults to 'local')." })
705
1288
  ),
706
- kind: Type15.Optional(
707
- Type15.Union(
708
- [Type15.Literal("vztmpl"), Type15.Literal("iso"), Type15.Literal("both")],
1289
+ kind: Type21.Optional(
1290
+ Type21.Union(
1291
+ [Type21.Literal("vztmpl"), Type21.Literal("iso"), Type21.Literal("both")],
709
1292
  { description: "Template kind: 'vztmpl' (CT templates), 'iso' (VM ISOs), or 'both'. Defaults to 'both'." }
710
1293
  )
711
1294
  )
@@ -714,12 +1297,12 @@ var Schema15 = Type15.Object(
714
1297
  );
715
1298
  function createProxmoxListTemplatesTool(getClient) {
716
1299
  return {
717
- name: "proxmox_list_templates",
1300
+ name: NAME17,
718
1301
  label: "proxmox: list templates",
719
1302
  description: "List available LXC container templates (vztmpl) and/or VM ISOs on a node/storage (GET /nodes/{node}/storage/{storage}/content?content=vztmpl|iso). Defaults to both kinds on storage 'local'.",
720
- parameters: Schema15,
1303
+ parameters: Schema20,
721
1304
  execute: async (_id, raw) => {
722
- const args = raw;
1305
+ const args = validateToolArgs(Schema20, raw, NAME17);
723
1306
  const client = getClient();
724
1307
  let node = args.node;
725
1308
  if (!node) {
@@ -729,18 +1312,22 @@ function createProxmoxListTemplatesTool(getClient) {
729
1312
  }
730
1313
  const storage = args.storage ?? "local";
731
1314
  const kind = args.kind ?? "both";
1315
+ assertSafePathSegment(node, "node");
1316
+ assertSafePathSegment(storage, "storage");
1317
+ const nodeSeg = encodeURIComponent(node);
1318
+ const storageSeg = encodeURIComponent(storage);
732
1319
  const out = {
733
1320
  node,
734
1321
  storage
735
1322
  };
736
1323
  if (kind === "vztmpl" || kind === "both") {
737
1324
  out.container_templates = await client.get(
738
- `/nodes/${node}/storage/${storage}/content?content=vztmpl`
1325
+ `/nodes/${nodeSeg}/storage/${storageSeg}/content?content=vztmpl`
739
1326
  );
740
1327
  }
741
1328
  if (kind === "iso" || kind === "both") {
742
1329
  out.vm_isos = await client.get(
743
- `/nodes/${node}/storage/${storage}/content?content=iso`
1330
+ `/nodes/${nodeSeg}/storage/${storageSeg}/content?content=iso`
744
1331
  );
745
1332
  }
746
1333
  return jsonToolResult(out);
@@ -748,65 +1335,295 @@ function createProxmoxListTemplatesTool(getClient) {
748
1335
  };
749
1336
  }
750
1337
 
1338
+ // src/tools/proxmox_list_storage.ts
1339
+ import { Type as Type22 } from "@sinclair/typebox";
1340
+ var Schema21 = Type22.Object(
1341
+ {
1342
+ node: Type22.Optional(
1343
+ Type22.String({ minLength: 1, description: "Node to query. Defaults to all nodes." })
1344
+ )
1345
+ },
1346
+ { additionalProperties: false }
1347
+ );
1348
+ var NAME18 = "proxmox_list_storage";
1349
+ function createProxmoxListStorageTool(getClient) {
1350
+ return {
1351
+ name: NAME18,
1352
+ label: "proxmox: list storage",
1353
+ description: "List Proxmox storage status on one node or all nodes via GET /nodes/{node}/storage.",
1354
+ parameters: Schema21,
1355
+ execute: async (_id, raw = {}) => {
1356
+ const args = validateToolArgs(Schema21, raw, NAME18);
1357
+ const client = getClient();
1358
+ let nodes;
1359
+ if (args.node) {
1360
+ nodes = [args.node];
1361
+ } else {
1362
+ const resources = await client.get("/cluster/resources?type=node");
1363
+ nodes = resources.map((n) => n.node);
1364
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
1365
+ }
1366
+ const results = [];
1367
+ for (const node of nodes) {
1368
+ const storage = await client.get(`/nodes/${node}/storage`);
1369
+ results.push({ node, storage });
1370
+ }
1371
+ return jsonToolResult({ count: results.reduce((sum, n) => sum + n.storage.length, 0), nodes: results });
1372
+ }
1373
+ };
1374
+ }
1375
+
1376
+ // src/tools/proxmox_list_snapshots.ts
1377
+ import { Type as Type23 } from "@sinclair/typebox";
1378
+ var Schema22 = Type23.Object(
1379
+ {
1380
+ vmid: Type23.Integer({ minimum: 1, description: "Container or VM ID." })
1381
+ },
1382
+ { additionalProperties: false }
1383
+ );
1384
+ var NAME19 = "proxmox_list_snapshots";
1385
+ function createProxmoxListSnapshotsTool(getClient) {
1386
+ return {
1387
+ name: NAME19,
1388
+ label: "proxmox: list snapshots",
1389
+ description: "List snapshots for one LXC container or QEMU VM via GET /nodes/{node}/{type}/{vmid}/snapshot.",
1390
+ parameters: Schema22,
1391
+ execute: async (_id, raw) => {
1392
+ const args = validateToolArgs(Schema22, raw, NAME19);
1393
+ const client = getClient();
1394
+ const { node, type } = await resolveResource(client, args.vmid);
1395
+ const snapshots = await client.get(`/nodes/${node}/${type}/${args.vmid}/snapshot`);
1396
+ return jsonToolResult({ vmid: args.vmid, node, type, count: snapshots.length, snapshots });
1397
+ }
1398
+ };
1399
+ }
1400
+
1401
+ // src/tools/proxmox_guest_network.ts
1402
+ import { Type as Type24 } from "@sinclair/typebox";
1403
+ var Schema23 = Type24.Object(
1404
+ {
1405
+ vmid: Type24.Integer({ minimum: 1, description: "Container or VM ID." })
1406
+ },
1407
+ { additionalProperties: false }
1408
+ );
1409
+ var NAME20 = "proxmox_guest_network";
1410
+ function usableIpv4(ip) {
1411
+ return !ip.startsWith("127.") && !ip.startsWith("169.254.") && ip !== "0.0.0.0";
1412
+ }
1413
+ function createProxmoxGuestNetworkTool(getClient) {
1414
+ return {
1415
+ name: NAME20,
1416
+ label: "proxmox: guest network",
1417
+ description: "Return guest network interfaces and usable IPv4 addresses for a QEMU VM via guest agent or an LXC container via its interfaces endpoint.",
1418
+ parameters: Schema23,
1419
+ execute: async (_id, raw) => {
1420
+ const args = validateToolArgs(Schema23, raw, NAME20);
1421
+ const client = getClient();
1422
+ const { node, type } = await resolveResource(client, args.vmid);
1423
+ if (type === "qemu") {
1424
+ const data = await client.get(
1425
+ `/nodes/${node}/qemu/${args.vmid}/agent/network-get-interfaces`
1426
+ );
1427
+ const interfaces2 = data.result ?? [];
1428
+ const ipv42 = interfaces2.flatMap(
1429
+ (iface) => (iface["ip-addresses"] ?? []).filter((ip) => ip["ip-address-type"] === "ipv4" && ip["ip-address"] && usableIpv4(ip["ip-address"])).map((ip) => ({ interface: iface.name, address: ip["ip-address"], prefix: ip.prefix }))
1430
+ );
1431
+ return jsonToolResult({ vmid: args.vmid, node, type, ipv4: ipv42, interfaces: interfaces2 });
1432
+ }
1433
+ const interfaces = await client.get(`/nodes/${node}/lxc/${args.vmid}/interfaces`);
1434
+ const ipv4 = interfaces.filter((iface) => iface.inet && usableIpv4(iface.inet.split("/")[0])).map((iface) => {
1435
+ const [address, prefix] = iface.inet.split("/");
1436
+ return { interface: iface.name, address, prefix: prefix ? Number(prefix) : void 0 };
1437
+ });
1438
+ return jsonToolResult({ vmid: args.vmid, node, type, ipv4, interfaces });
1439
+ }
1440
+ };
1441
+ }
1442
+
1443
+ // src/tools/proxmox_wait_task.ts
1444
+ import { Type as Type25 } from "@sinclair/typebox";
1445
+ var Schema24 = Type25.Object(
1446
+ {
1447
+ upid: Type25.String({ minLength: 1, description: "Task UPID to wait for." }),
1448
+ timeoutSeconds: Type25.Optional(
1449
+ Type25.Integer({ minimum: 1, maximum: 3600, description: "Max wait time in seconds. Default 60." })
1450
+ ),
1451
+ intervalMs: Type25.Optional(
1452
+ Type25.Integer({ minimum: 100, maximum: 1e4, description: "Polling interval in milliseconds. Default 1000." })
1453
+ )
1454
+ },
1455
+ { additionalProperties: false }
1456
+ );
1457
+ var NAME21 = "proxmox_wait_task";
1458
+ function createProxmoxWaitTaskTool(getClient) {
1459
+ return {
1460
+ name: NAME21,
1461
+ label: "proxmox: wait task",
1462
+ description: "Poll a Proxmox task by UPID until it stops or the timeout expires. Returns done:false on timeout with the last status.",
1463
+ parameters: Schema24,
1464
+ execute: async (_id, raw) => {
1465
+ const args = validateToolArgs(Schema24, raw, NAME21);
1466
+ const { node } = parseTaskUpid(args.upid);
1467
+ const timeoutMs = (args.timeoutSeconds ?? 60) * 1e3;
1468
+ const intervalMs = args.intervalMs ?? 1e3;
1469
+ const deadline = Date.now() + timeoutMs;
1470
+ const client = getClient();
1471
+ let polls = 0;
1472
+ let lastStatus = null;
1473
+ while (Date.now() <= deadline) {
1474
+ polls += 1;
1475
+ lastStatus = await client.get(
1476
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/status`
1477
+ );
1478
+ if (lastStatus.status === "stopped" || lastStatus.exitstatus) {
1479
+ return jsonToolResult({ upid: args.upid, node, done: true, polls, status: lastStatus });
1480
+ }
1481
+ await sleep3(Math.min(intervalMs, Math.max(0, deadline - Date.now())));
1482
+ }
1483
+ return jsonToolResult({ upid: args.upid, node, done: false, polls, status: lastStatus });
1484
+ }
1485
+ };
1486
+ }
1487
+ function sleep3(ms) {
1488
+ return new Promise((resolve) => setTimeout(resolve, ms));
1489
+ }
1490
+
1491
+ // src/tools/proxmox_next_vmid.ts
1492
+ import { Type as Type26 } from "@sinclair/typebox";
1493
+ var Schema25 = Type26.Object({}, { additionalProperties: false });
1494
+ var NAME22 = "proxmox_next_vmid";
1495
+ function createProxmoxNextVmidTool(getClient) {
1496
+ return {
1497
+ name: NAME22,
1498
+ label: "proxmox: next vmid",
1499
+ description: "Return the next available Proxmox VMID via GET /cluster/nextid.",
1500
+ parameters: Schema25,
1501
+ execute: async (_id, raw = {}) => {
1502
+ validateToolArgs(Schema25, raw, NAME22);
1503
+ const nextid = await getClient().get("/cluster/nextid");
1504
+ return jsonToolResult({ vmid: Number(nextid) });
1505
+ }
1506
+ };
1507
+ }
1508
+
1509
+ // src/tools/proxmox_list_pool_resources.ts
1510
+ import { Type as Type27 } from "@sinclair/typebox";
1511
+ var Schema26 = Type27.Object(
1512
+ {
1513
+ pool: Type27.Optional(
1514
+ Type27.String({ minLength: 1, description: "Pool ID to inspect (default mcp-smoke)." })
1515
+ )
1516
+ },
1517
+ { additionalProperties: false }
1518
+ );
1519
+ var NAME23 = "proxmox_list_pool_resources";
1520
+ function createProxmoxListPoolResourcesTool(getClient) {
1521
+ return {
1522
+ name: NAME23,
1523
+ label: "proxmox: list pool resources",
1524
+ description: "List resources assigned to a Proxmox pool (GET /pools/{pool}). Defaults to the mcp-smoke pool for smoke-test audits.",
1525
+ parameters: Schema26,
1526
+ execute: async (_id = "id", raw = {}) => {
1527
+ const args = validateToolArgs(Schema26, raw, NAME23);
1528
+ const pool = args.pool ?? "mcp-smoke";
1529
+ const detail = await getClient().get(`/pools/${encodeURIComponent(pool)}`);
1530
+ const members = Array.isArray(detail.members) ? detail.members : [];
1531
+ return jsonToolResult({
1532
+ pool,
1533
+ comment: detail.comment,
1534
+ count: members.length,
1535
+ resources: members
1536
+ });
1537
+ }
1538
+ };
1539
+ }
1540
+
751
1541
  // src/tools/proxmox_create_container.ts
752
- import { Type as Type16 } from "@sinclair/typebox";
753
- var Schema16 = Type16.Object(
1542
+ import { Type as Type28 } from "@sinclair/typebox";
1543
+ var Schema27 = Type28.Object(
754
1544
  {
755
- vmid: Type16.Integer({ minimum: 1, description: "VMID for the new container." }),
756
- hostname: Type16.String({ minLength: 1, description: "Container hostname." }),
757
- ostemplate: Type16.String({
1545
+ vmid: Type28.Integer({ minimum: 1, description: "VMID for the new container." }),
1546
+ hostname: Type28.String({ minLength: 1, description: "Container hostname." }),
1547
+ ostemplate: Type28.String({
758
1548
  minLength: 1,
759
1549
  description: "OS template volid (e.g. 'local:vztmpl/ubuntu-24.04-standard_*.tar.zst')."
760
1550
  }),
761
- node: Type16.Optional(
762
- Type16.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
1551
+ node: Type28.Optional(
1552
+ Type28.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
763
1553
  ),
764
- storage: Type16.Optional(
765
- Type16.String({ minLength: 1, description: "Root storage (default 'local-lvm')." })
1554
+ storage: Type28.Optional(
1555
+ Type28.String({ minLength: 1, description: "Root storage (default 'local-lvm')." })
766
1556
  ),
767
- memory: Type16.Optional(
768
- Type16.Integer({ minimum: 16, description: "Memory in MiB (default 512)." })
1557
+ memory: Type28.Optional(
1558
+ Type28.Integer({ minimum: 16, description: "Memory in MiB (default 512)." })
769
1559
  ),
770
- cores: Type16.Optional(
771
- Type16.Integer({ minimum: 1, description: "CPU cores (default 1)." })
1560
+ cores: Type28.Optional(
1561
+ Type28.Integer({ minimum: 1, description: "CPU cores (default 1)." })
772
1562
  ),
773
- rootfs_size: Type16.Optional(
774
- Type16.String({ minLength: 1, description: "Root filesystem size in GB (default '8')." })
1563
+ rootfs_size: Type28.Optional(
1564
+ Type28.String({ minLength: 1, description: "Root filesystem size in GB (default '8')." })
775
1565
  ),
776
- net: Type16.Optional(
777
- Type16.String({
1566
+ net: Type28.Optional(
1567
+ Type28.String({
778
1568
  minLength: 1,
779
1569
  description: "Network config for net0 (default 'name=eth0,bridge=vmbr0,ip=dhcp')."
780
1570
  })
781
1571
  ),
782
- start: Type16.Optional(
783
- Type16.Boolean({ description: "Start after create (default false)." })
1572
+ start: Type28.Optional(
1573
+ Type28.Boolean({ description: "Start after create (default false)." })
1574
+ ),
1575
+ pool: Type28.Optional(
1576
+ Type28.String({ minLength: 1, description: "Optional resource pool ID to place the container into." })
1577
+ ),
1578
+ onboot: Type28.Optional(
1579
+ Type28.Boolean({ description: "Start container on host boot (default false)." })
1580
+ ),
1581
+ unprivileged: Type28.Optional(
1582
+ Type28.Boolean({ description: "Create an unprivileged container (default true)." })
1583
+ ),
1584
+ protection: Type28.Optional(
1585
+ Type28.Boolean({ description: "Enable Proxmox protection flag (default false)." })
1586
+ ),
1587
+ features: Type28.Optional(
1588
+ Type28.String({ minLength: 1, description: "Optional LXC features string, e.g. 'nesting=1'." })
784
1589
  ),
785
- password: Type16.Optional(
786
- Type16.String({ description: "Root password (optional)." })
1590
+ description: Type28.Optional(
1591
+ Type28.String({ description: "Optional container description." })
787
1592
  ),
788
- ssh_public_keys: Type16.Optional(
789
- Type16.String({ description: "SSH public keys (optional)." })
1593
+ tags: Type28.Optional(
1594
+ Type28.String({ minLength: 1, description: "Optional semicolon-delimited Proxmox tags." })
790
1595
  ),
791
- confirm: Type16.Boolean({
1596
+ password: Type28.Optional(
1597
+ Type28.String({ description: "Root password (optional)." })
1598
+ ),
1599
+ ssh_public_keys: Type28.Optional(
1600
+ Type28.String({ description: "SSH public keys (optional)." })
1601
+ ),
1602
+ confirm: Type28.Boolean({
792
1603
  description: "Must be true to write. Tier-2 safe-write gate."
793
- })
1604
+ }),
1605
+ ...taskWaitFields
794
1606
  },
795
1607
  { additionalProperties: false }
796
1608
  );
797
- var NAME6 = "proxmox_create_container";
1609
+ var NAME24 = "proxmox_create_container";
798
1610
  function createProxmoxCreateContainerTool(getClient) {
799
1611
  return {
800
- name: NAME6,
1612
+ name: NAME24,
801
1613
  label: "proxmox: create container",
802
1614
  description: "Create a new LXC container on a node (POST /nodes/{node}/lxc) with sensible defaults (storage local-lvm, 512MiB, 1 core, 8GB rootfs, DHCP net). Tier-2 write; requires confirm:true.",
803
- parameters: Schema16,
1615
+ parameters: Schema27,
804
1616
  execute: async (_id, raw) => {
805
- assertConfirmedWrite(raw, NAME6);
806
- const args = raw;
1617
+ assertConfirmedWrite(raw, NAME24);
1618
+ const args = validateToolArgs(Schema27, raw, NAME24);
1619
+ if (typeof args.password === "string" && args.password.length > 0) {
1620
+ registerSecret(args.password);
1621
+ }
807
1622
  const client = getClient();
808
1623
  let node = args.node;
809
- if (!node) {
1624
+ if (node) {
1625
+ assertSafePathSegment(node, "node");
1626
+ } else {
810
1627
  const nodes = await client.get("/cluster/resources?type=node");
811
1628
  if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
812
1629
  node = nodes[0].node;
@@ -822,80 +1639,155 @@ function createProxmoxCreateContainerTool(getClient) {
822
1639
  cores: args.cores ?? 1,
823
1640
  rootfs: `${storage}:${rootfsSize}`,
824
1641
  net0: args.net ?? "name=eth0,bridge=vmbr0,ip=dhcp",
825
- start: args.start ? 1 : 0
1642
+ start: args.start ? 1 : 0,
1643
+ onboot: args.onboot ? 1 : 0,
1644
+ unprivileged: args.unprivileged === false ? 0 : 1,
1645
+ protection: args.protection ? 1 : 0
826
1646
  };
1647
+ for (const key of ["pool", "features"]) {
1648
+ const value = args[key];
1649
+ if (typeof value === "string" && value.length > 0) body[key] = value;
1650
+ }
827
1651
  if (typeof args.password === "string" && args.password.length > 0) {
828
1652
  body.password = args.password;
829
1653
  }
830
1654
  if (typeof args.ssh_public_keys === "string" && args.ssh_public_keys.length > 0) {
831
1655
  body["ssh-public-keys"] = args.ssh_public_keys;
832
1656
  }
1657
+ if (typeof args.description === "string" && args.description.length > 0) {
1658
+ body.description = args.description;
1659
+ }
1660
+ if (typeof args.tags === "string" && args.tags.length > 0) {
1661
+ body.tags = args.tags;
1662
+ }
833
1663
  const upid = await client.post(`/nodes/${node}/lxc`, body);
1664
+ const task = await resolveTaskWait(client, upid, args);
834
1665
  return jsonToolResult({
835
1666
  vmid: args.vmid,
836
1667
  node,
837
1668
  hostname: args.hostname,
838
- upid
1669
+ upid,
1670
+ ...task ? { task } : {}
839
1671
  });
840
1672
  }
841
1673
  };
842
1674
  }
843
1675
 
844
1676
  // src/tools/proxmox_create_vm.ts
845
- import { Type as Type17 } from "@sinclair/typebox";
846
- var Schema17 = Type17.Object(
1677
+ import { Type as Type29 } from "@sinclair/typebox";
1678
+ var Schema28 = Type29.Object(
847
1679
  {
848
- vmid: Type17.Integer({ minimum: 1, description: "VMID for the new VM." }),
849
- name: Type17.String({ minLength: 1, description: "VM display name." }),
850
- node: Type17.Optional(
851
- Type17.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
1680
+ vmid: Type29.Integer({ minimum: 1, description: "VMID for the new VM." }),
1681
+ name: Type29.String({ minLength: 1, description: "VM display name." }),
1682
+ node: Type29.Optional(
1683
+ Type29.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
852
1684
  ),
853
- memory: Type17.Optional(
854
- Type17.Integer({ minimum: 16, description: "Memory in MiB (default 2048)." })
1685
+ memory: Type29.Optional(
1686
+ Type29.Integer({ minimum: 16, description: "Memory in MiB (default 2048)." })
855
1687
  ),
856
- cores: Type17.Optional(
857
- Type17.Integer({ minimum: 1, description: "CPU cores (default 2)." })
1688
+ cores: Type29.Optional(
1689
+ Type29.Integer({ minimum: 1, description: "CPU cores (default 2)." })
858
1690
  ),
859
- iso: Type17.Optional(
860
- Type17.String({
1691
+ iso: Type29.Optional(
1692
+ Type29.String({
861
1693
  minLength: 1,
862
1694
  description: "ISO volid for install media (e.g. 'local:iso/ubuntu-24.04.iso'). If set, attaches as ide2 cdrom."
863
1695
  })
864
1696
  ),
865
- disk_size: Type17.Optional(
866
- Type17.String({ minLength: 1, description: "Primary disk size in GB on scsi0 (default '32')." })
1697
+ disk_size: Type29.Optional(
1698
+ Type29.String({ minLength: 1, description: "Primary disk size in GB on scsi0 (default '32')." })
867
1699
  ),
868
- storage: Type17.Optional(
869
- Type17.String({ minLength: 1, description: "Disk storage (default 'local-lvm')." })
1700
+ storage: Type29.Optional(
1701
+ Type29.String({ minLength: 1, description: "Disk storage (default 'local-lvm')." })
870
1702
  ),
871
- net: Type17.Optional(
872
- Type17.String({
1703
+ net: Type29.Optional(
1704
+ Type29.String({
873
1705
  minLength: 1,
874
1706
  description: "Network config for net0 (default 'model=virtio,bridge=vmbr0')."
875
1707
  })
876
1708
  ),
877
- start: Type17.Optional(
878
- Type17.Boolean({ description: "Start after create (default false)." })
1709
+ start: Type29.Optional(
1710
+ Type29.Boolean({ description: "Start after create (default false)." })
1711
+ ),
1712
+ pool: Type29.Optional(
1713
+ Type29.String({ minLength: 1, description: "Optional resource pool ID to place the VM into." })
1714
+ ),
1715
+ onboot: Type29.Optional(
1716
+ Type29.Boolean({ description: "Start VM on host boot (default false)." })
1717
+ ),
1718
+ protection: Type29.Optional(
1719
+ Type29.Boolean({ description: "Enable Proxmox protection flag (default false)." })
1720
+ ),
1721
+ agent: Type29.Optional(
1722
+ Type29.Boolean({ description: "Enable QEMU guest agent in VM config (default false)." })
1723
+ ),
1724
+ scsihw: Type29.Optional(
1725
+ Type29.String({ minLength: 1, description: "Optional SCSI controller, e.g. 'virtio-scsi-pci'." })
1726
+ ),
1727
+ boot: Type29.Optional(
1728
+ Type29.String({ minLength: 1, description: "Optional boot order string." })
1729
+ ),
1730
+ bios: Type29.Optional(
1731
+ Type29.Union([Type29.Literal("seabios"), Type29.Literal("ovmf")], { description: "Optional VM BIOS type." })
1732
+ ),
1733
+ machine: Type29.Optional(
1734
+ Type29.String({ minLength: 1, description: "Optional machine type." })
1735
+ ),
1736
+ cpu: Type29.Optional(
1737
+ Type29.String({ minLength: 1, description: "Optional CPU type." })
1738
+ ),
1739
+ sockets: Type29.Optional(
1740
+ Type29.Integer({ minimum: 1, description: "Optional socket count." })
1741
+ ),
1742
+ description: Type29.Optional(
1743
+ Type29.String({ description: "Optional VM description." })
1744
+ ),
1745
+ tags: Type29.Optional(
1746
+ Type29.String({ minLength: 1, description: "Optional semicolon-delimited Proxmox tags." })
1747
+ ),
1748
+ ciuser: Type29.Optional(
1749
+ Type29.String({ minLength: 1, description: "Optional cloud-init username." })
1750
+ ),
1751
+ cipassword: Type29.Optional(
1752
+ Type29.String({ description: "Optional cloud-init password." })
1753
+ ),
1754
+ sshkeys: Type29.Optional(
1755
+ Type29.String({ description: "Optional cloud-init SSH public keys." })
879
1756
  ),
880
- confirm: Type17.Boolean({
1757
+ ipconfig0: Type29.Optional(
1758
+ Type29.String({ minLength: 1, description: "Optional cloud-init ipconfig0, e.g. 'ip=dhcp'." })
1759
+ ),
1760
+ nameserver: Type29.Optional(
1761
+ Type29.String({ minLength: 1, description: "Optional cloud-init DNS server list." })
1762
+ ),
1763
+ searchdomain: Type29.Optional(
1764
+ Type29.String({ minLength: 1, description: "Optional cloud-init DNS search domain." })
1765
+ ),
1766
+ confirm: Type29.Boolean({
881
1767
  description: "Must be true to write. Tier-2 safe-write gate."
882
- })
1768
+ }),
1769
+ ...taskWaitFields
883
1770
  },
884
1771
  { additionalProperties: false }
885
1772
  );
886
- var NAME7 = "proxmox_create_vm";
1773
+ var NAME25 = "proxmox_create_vm";
887
1774
  function createProxmoxCreateVmTool(getClient) {
888
1775
  return {
889
- name: NAME7,
1776
+ name: NAME25,
890
1777
  label: "proxmox: create vm",
891
1778
  description: "Create a new QEMU VM on a node (POST /nodes/{node}/qemu) with sensible defaults (2GiB, 2 cores, 32GB disk on local-lvm, virtio net). Optionally attaches an ISO as ide2 cdrom. Tier-2 write; requires confirm:true.",
892
- parameters: Schema17,
1779
+ parameters: Schema28,
893
1780
  execute: async (_id, raw) => {
894
- assertConfirmedWrite(raw, NAME7);
895
- const args = raw;
1781
+ assertConfirmedWrite(raw, NAME25);
1782
+ const args = validateToolArgs(Schema28, raw, NAME25);
1783
+ if (typeof args.cipassword === "string" && args.cipassword.length > 0) {
1784
+ registerSecret(args.cipassword);
1785
+ }
896
1786
  const client = getClient();
897
1787
  let node = args.node;
898
- if (!node) {
1788
+ if (node) {
1789
+ assertSafePathSegment(node, "node");
1790
+ } else {
899
1791
  const nodes = await client.get("/cluster/resources?type=node");
900
1792
  if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
901
1793
  node = nodes[0].node;
@@ -909,54 +1801,74 @@ function createProxmoxCreateVmTool(getClient) {
909
1801
  cores: args.cores ?? 2,
910
1802
  scsi0: `${storage}:${diskSize}`,
911
1803
  net0: args.net ?? "model=virtio,bridge=vmbr0",
912
- start: args.start ? 1 : 0
1804
+ start: args.start ? 1 : 0,
1805
+ onboot: args.onboot ? 1 : 0,
1806
+ protection: args.protection ? 1 : 0,
1807
+ agent: args.agent ? 1 : 0
913
1808
  };
914
1809
  if (typeof args.iso === "string" && args.iso.length > 0) {
915
1810
  body.ide2 = `${args.iso},media=cdrom`;
916
1811
  }
1812
+ for (const key of ["pool", "scsihw", "boot", "bios", "machine", "cpu", "description", "tags", "ciuser", "cipassword", "sshkeys", "ipconfig0", "nameserver", "searchdomain"]) {
1813
+ const value = args[key];
1814
+ if (typeof value === "string" && value.length > 0) body[key] = value;
1815
+ }
1816
+ if (typeof args.sockets === "number") body.sockets = args.sockets;
917
1817
  const upid = await client.post(`/nodes/${node}/qemu`, body);
1818
+ const task = await resolveTaskWait(client, upid, args);
918
1819
  return jsonToolResult({
919
1820
  vmid: args.vmid,
920
1821
  node,
921
1822
  name: args.name,
922
- upid
1823
+ upid,
1824
+ ...task ? { task } : {}
923
1825
  });
924
1826
  }
925
1827
  };
926
1828
  }
927
1829
 
928
1830
  // src/tools/proxmox_clone_resource.ts
929
- import { Type as Type18 } from "@sinclair/typebox";
930
- var Schema18 = Type18.Object(
1831
+ import { Type as Type30 } from "@sinclair/typebox";
1832
+ var Schema29 = Type30.Object(
931
1833
  {
932
- source_vmid: Type18.Integer({ minimum: 1, description: "Source CT/VM ID to clone from." }),
933
- new_vmid: Type18.Integer({ minimum: 1, description: "VMID for the cloned resource." }),
934
- name: Type18.String({ minLength: 1, description: "Name/hostname for the new clone." }),
935
- full: Type18.Optional(
936
- Type18.Boolean({ description: "Full clone (default true). Set false for a linked clone." })
1834
+ source_vmid: Type30.Integer({ minimum: 1, description: "Source CT/VM ID to clone from." }),
1835
+ new_vmid: Type30.Integer({ minimum: 1, description: "VMID for the cloned resource." }),
1836
+ name: Type30.String({ minLength: 1, description: "Name/hostname for the new clone." }),
1837
+ full: Type30.Optional(
1838
+ Type30.Boolean({ description: "Full clone (default true). Set false for a linked clone." })
937
1839
  ),
938
- storage: Type18.Optional(
939
- Type18.String({ minLength: 1, description: "Target storage (default: same as source)." })
1840
+ storage: Type30.Optional(
1841
+ Type30.String({ minLength: 1, description: "Target storage (default: same as source)." })
940
1842
  ),
941
- snapname: Type18.Optional(
942
- Type18.String({ minLength: 1, description: "Clone from a named snapshot (optional)." })
1843
+ target_node: Type30.Optional(
1844
+ Type30.String({ minLength: 1, description: "Optional target node for the clone." })
943
1845
  ),
944
- confirm: Type18.Boolean({
1846
+ pool: Type30.Optional(
1847
+ Type30.String({ minLength: 1, description: "Optional resource pool ID for the clone." })
1848
+ ),
1849
+ snapname: Type30.Optional(
1850
+ Type30.String({ minLength: 1, description: "Clone from a named snapshot (optional)." })
1851
+ ),
1852
+ description: Type30.Optional(
1853
+ Type30.String({ description: "Optional description for the clone." })
1854
+ ),
1855
+ confirm: Type30.Boolean({
945
1856
  description: "Must be true to write. Tier-2 safe-write gate."
946
- })
1857
+ }),
1858
+ ...taskWaitFields
947
1859
  },
948
1860
  { additionalProperties: false }
949
1861
  );
950
- var NAME8 = "proxmox_clone_resource";
1862
+ var NAME26 = "proxmox_clone_resource";
951
1863
  function createProxmoxCloneResourceTool(getClient) {
952
1864
  return {
953
- name: NAME8,
1865
+ name: NAME26,
954
1866
  label: "proxmox: clone resource",
955
1867
  description: "Clone an existing LXC or QEMU resource by source_vmid to a new_vmid (POST /nodes/{node}/{type}/{source_vmid}/clone). Resolves source node/type from cluster resources. Tier-2 write; requires confirm:true.",
956
- parameters: Schema18,
1868
+ parameters: Schema29,
957
1869
  execute: async (_id, raw) => {
958
- assertConfirmedWrite(raw, NAME8);
959
- const args = raw;
1870
+ assertConfirmedWrite(raw, NAME26);
1871
+ const args = validateToolArgs(Schema29, raw, NAME26);
960
1872
  const client = getClient();
961
1873
  const { node, type } = await resolveResource(client, args.source_vmid);
962
1874
  const body = {
@@ -967,60 +1879,72 @@ function createProxmoxCloneResourceTool(getClient) {
967
1879
  if (typeof args.storage === "string" && args.storage.length > 0) {
968
1880
  body.storage = args.storage;
969
1881
  }
1882
+ if (typeof args.target_node === "string" && args.target_node.length > 0) {
1883
+ body.target = args.target_node;
1884
+ }
1885
+ if (typeof args.pool === "string" && args.pool.length > 0) {
1886
+ body.pool = args.pool;
1887
+ }
970
1888
  if (typeof args.snapname === "string" && args.snapname.length > 0) {
971
1889
  body.snapname = args.snapname;
972
1890
  }
1891
+ if (typeof args.description === "string" && args.description.length > 0) {
1892
+ body.description = args.description;
1893
+ }
973
1894
  const upid = await client.post(
974
1895
  `/nodes/${node}/${type}/${args.source_vmid}/clone`,
975
1896
  body
976
1897
  );
1898
+ const task = await resolveTaskWait(client, upid, args);
977
1899
  return jsonToolResult({
978
1900
  source_vmid: args.source_vmid,
979
1901
  new_vmid: args.new_vmid,
980
1902
  node,
981
1903
  type,
982
1904
  name: args.name,
983
- upid
1905
+ upid,
1906
+ ...task ? { task } : {}
984
1907
  });
985
1908
  }
986
1909
  };
987
1910
  }
988
1911
 
989
1912
  // src/tools/proxmox_destroy_resource.ts
990
- import { Type as Type19 } from "@sinclair/typebox";
991
- var Schema19 = Type19.Object(
1913
+ import { Type as Type31 } from "@sinclair/typebox";
1914
+ var Schema30 = Type31.Object(
992
1915
  {
993
- vmid: Type19.Integer({ minimum: 1, description: "Container or VM ID to destroy." }),
994
- purge: Type19.Optional(
995
- Type19.Boolean({
1916
+ vmid: Type31.Integer({ minimum: 1, description: "Container or VM ID to destroy." }),
1917
+ purge: Type31.Optional(
1918
+ Type31.Boolean({
996
1919
  description: "Remove from PVE backup/replication config too (default true)."
997
1920
  })
998
1921
  ),
999
- force: Type19.Optional(
1000
- Type19.Boolean({
1922
+ force: Type31.Optional(
1923
+ Type31.Boolean({
1001
1924
  description: "Allow destroying a running VM (default false)."
1002
1925
  })
1003
1926
  ),
1004
- confirm: Type19.Boolean({
1927
+ confirm: Type31.Boolean({
1005
1928
  description: "Must be true. Tier-3 destructive gate."
1006
1929
  }),
1007
- destructive: Type19.Boolean({
1930
+ destructive: Type31.Boolean({
1008
1931
  description: "Must be true. Tier-3 destructive gate."
1009
- })
1932
+ }),
1933
+ ...taskWaitFields
1010
1934
  },
1011
1935
  { additionalProperties: false }
1012
1936
  );
1013
- var NAME9 = "proxmox_destroy_resource";
1937
+ var NAME27 = "proxmox_destroy_resource";
1014
1938
  function createProxmoxDestroyResourceTool(getClient) {
1015
1939
  return {
1016
- name: NAME9,
1940
+ name: NAME27,
1017
1941
  label: "proxmox: destroy resource",
1018
1942
  description: "Permanently delete an LXC container or QEMU VM by vmid (DELETE /nodes/{node}/{type}/{vmid}). Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
1019
- parameters: Schema19,
1943
+ parameters: Schema30,
1020
1944
  execute: async (_id, raw) => {
1021
- assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME9);
1022
- assertDestructive(raw, NAME9);
1023
- const args = raw;
1945
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME27);
1946
+ assertDestructive(raw, NAME27);
1947
+ const args = validateToolArgs(Schema30, raw, NAME27);
1024
1948
  const purge = args.purge !== false;
1025
1949
  const force = args.force === true;
1026
1950
  const client = getClient();
@@ -1032,42 +1956,180 @@ function createProxmoxDestroyResourceTool(getClient) {
1032
1956
  }
1033
1957
  if (force && type === "lxc") params.append("force", "1");
1034
1958
  const qs = params.toString();
1035
- const path = qs.length > 0 ? `/nodes/${node}/${type}/${args.vmid}?${qs}` : `/nodes/${node}/${type}/${args.vmid}`;
1036
- const upid = await client.delete(path);
1037
- return jsonToolResult({ vmid: args.vmid, node, type, upid });
1959
+ const path2 = qs.length > 0 ? `/nodes/${node}/${type}/${args.vmid}?${qs}` : `/nodes/${node}/${type}/${args.vmid}`;
1960
+ const upid = await client.delete(path2);
1961
+ const task = await resolveTaskWait(client, upid, args);
1962
+ return jsonToolResult({ vmid: args.vmid, node, type, upid, ...task ? { task } : {} });
1963
+ }
1964
+ };
1965
+ }
1966
+
1967
+ // src/tools/proxmox_cleanup_smoke_resources.ts
1968
+ import { Type as Type32 } from "@sinclair/typebox";
1969
+ var Schema31 = Type32.Object(
1970
+ {
1971
+ pool: Type32.Optional(
1972
+ Type32.String({ minLength: 1, description: "Pool ID to clean up (default mcp-smoke)." })
1973
+ ),
1974
+ name_prefix: Type32.Optional(
1975
+ Type32.String({
1976
+ minLength: 1,
1977
+ description: "Only delete guest names starting with this prefix (default mcp-smoke-)."
1978
+ })
1979
+ ),
1980
+ force: Type32.Optional(
1981
+ Type32.Boolean({
1982
+ description: "Allow deleting running smoke guests. Also passes force=1 for LXC cleanup (default false)."
1983
+ })
1984
+ ),
1985
+ dry_run: Type32.Optional(
1986
+ Type32.Boolean({ description: "Preview matching targets without deleting them (default true)." })
1987
+ ),
1988
+ wait: Type32.Optional(
1989
+ Type32.Boolean({ description: "Wait for delete tasks to finish when dry_run:false (default true)." })
1990
+ ),
1991
+ confirm: Type32.Optional(
1992
+ Type32.Boolean({ description: "Must be true when dry_run:false. Tier-3 destructive gate." })
1993
+ ),
1994
+ destructive: Type32.Optional(
1995
+ Type32.Boolean({ description: "Must be true when dry_run:false. Tier-3 destructive gate." })
1996
+ ),
1997
+ timeoutSeconds: Type32.Optional(
1998
+ Type32.Integer({ minimum: 1, maximum: 3600, description: "Max seconds to wait per delete task (default 180)." })
1999
+ ),
2000
+ intervalMs: Type32.Optional(
2001
+ Type32.Integer({ minimum: 100, maximum: 1e4, description: "Task polling interval in milliseconds (default 1000)." })
2002
+ )
2003
+ },
2004
+ { additionalProperties: false }
2005
+ );
2006
+ var NAME28 = "proxmox_cleanup_smoke_resources";
2007
+ function normalizeType(type) {
2008
+ if (type === "qemu") return "qemu";
2009
+ if (type === "lxc" || type === "openvz") return "lxc";
2010
+ return null;
2011
+ }
2012
+ function targetFromMember(member, namePrefix) {
2013
+ const type = normalizeType(member.type);
2014
+ const name = member.name ?? "";
2015
+ if (!type || typeof member.vmid !== "number" || !member.node || !name.startsWith(namePrefix)) return null;
2016
+ return {
2017
+ vmid: member.vmid,
2018
+ node: member.node,
2019
+ type,
2020
+ name,
2021
+ status: member.status
2022
+ };
2023
+ }
2024
+ async function waitForTask(client, upid, timeoutSeconds, intervalMs) {
2025
+ const { node } = parseTaskUpid(upid);
2026
+ const deadline = Date.now() + timeoutSeconds * 1e3;
2027
+ let polls = 0;
2028
+ let status = null;
2029
+ while (Date.now() <= deadline) {
2030
+ polls += 1;
2031
+ status = await client.get(`/nodes/${node}/tasks/${encodeURIComponent(upid)}/status`);
2032
+ if (status.status === "stopped" || status.exitstatus) {
2033
+ return { upid, node, done: true, polls, status };
2034
+ }
2035
+ await new Promise((resolve) => setTimeout(resolve, Math.min(intervalMs, Math.max(0, deadline - Date.now()))));
2036
+ }
2037
+ return { upid, node, done: false, polls, status };
2038
+ }
2039
+ function createProxmoxCleanupSmokeResourcesTool(getClient) {
2040
+ return {
2041
+ name: NAME28,
2042
+ label: "proxmox: cleanup smoke resources",
2043
+ description: "Preview or destroy smoke-test LXC/QEMU resources from a pool when their names match the smoke prefix. Defaults to dry_run:true. Actual deletion requires dry_run:false, confirm:true, destructive:true, and PROXMOX_ENABLE_DESTRUCTIVE=1.",
2044
+ parameters: Schema31,
2045
+ execute: async (_id, raw) => {
2046
+ const args = validateToolArgs(Schema31, raw, NAME28);
2047
+ const pool = args.pool ?? "mcp-smoke";
2048
+ const namePrefix = args.name_prefix ?? "mcp-smoke-";
2049
+ const force = args.force === true;
2050
+ const dryRun = args.dry_run !== false;
2051
+ const wait = args.wait !== false;
2052
+ const client = getClient();
2053
+ const detail = await client.get(`/pools/${encodeURIComponent(pool)}`);
2054
+ const members = Array.isArray(detail.members) ? detail.members : [];
2055
+ const targets = members.map((member) => targetFromMember(member, namePrefix)).filter((target) => target !== null);
2056
+ const running = targets.filter((target) => target.status === "running");
2057
+ const deleteTargets = force ? targets : targets.filter((target) => target.status !== "running");
2058
+ const skippedRunning = force ? [] : running;
2059
+ if (dryRun) {
2060
+ return jsonToolResult({
2061
+ pool,
2062
+ name_prefix: namePrefix,
2063
+ dry_run: true,
2064
+ matched: targets.length,
2065
+ targets,
2066
+ skipped_running: skippedRunning,
2067
+ skipped: members.length - targets.length + skippedRunning.length
2068
+ });
2069
+ }
2070
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME28);
2071
+ assertDestructive(raw, NAME28);
2072
+ const destroyed = [];
2073
+ for (const target of deleteTargets) {
2074
+ const params = new URLSearchParams();
2075
+ params.append("purge", "1");
2076
+ params.append("destroy-unreferenced-disks", "1");
2077
+ if (force && target.type === "lxc") params.append("force", "1");
2078
+ const upid = await client.delete(
2079
+ `/nodes/${target.node}/${target.type}/${target.vmid}?${params.toString()}`
2080
+ );
2081
+ const entry = { ...target, upid };
2082
+ if (wait) {
2083
+ entry.wait = await waitForTask(client, upid, args.timeoutSeconds ?? 180, args.intervalMs ?? 1e3);
2084
+ }
2085
+ destroyed.push(entry);
2086
+ }
2087
+ return jsonToolResult({
2088
+ pool,
2089
+ name_prefix: namePrefix,
2090
+ dry_run: false,
2091
+ matched: targets.length,
2092
+ destroyed,
2093
+ skipped_running: skippedRunning,
2094
+ skipped: members.length - targets.length + skippedRunning.length
2095
+ });
1038
2096
  }
1039
2097
  };
1040
2098
  }
1041
2099
 
1042
2100
  // src/tools/proxmox_delete_snapshot.ts
1043
- import { Type as Type20 } from "@sinclair/typebox";
1044
- var Schema20 = Type20.Object(
2101
+ import { Type as Type33 } from "@sinclair/typebox";
2102
+ var Schema32 = Type33.Object(
1045
2103
  {
1046
- vmid: Type20.Integer({ minimum: 1, description: "Container or VM ID." }),
1047
- snapname: Type20.String({
2104
+ vmid: Type33.Integer({ minimum: 1, description: "Container or VM ID." }),
2105
+ snapname: Type33.String({
1048
2106
  minLength: 1,
1049
2107
  description: "Snapshot name to delete."
1050
2108
  }),
1051
- confirm: Type20.Boolean({
2109
+ confirm: Type33.Boolean({
1052
2110
  description: "Must be true. Tier-3 destructive gate."
1053
2111
  }),
1054
- destructive: Type20.Boolean({
2112
+ destructive: Type33.Boolean({
1055
2113
  description: "Must be true. Tier-3 destructive gate."
1056
2114
  })
1057
2115
  },
1058
2116
  { additionalProperties: false }
1059
2117
  );
1060
- var NAME10 = "proxmox_delete_snapshot";
2118
+ var NAME29 = "proxmox_delete_snapshot";
1061
2119
  function createProxmoxDeleteSnapshotTool(getClient) {
1062
2120
  return {
1063
- name: NAME10,
2121
+ name: NAME29,
1064
2122
  label: "proxmox: delete snapshot",
1065
2123
  description: "Delete a named snapshot from an LXC container or QEMU VM (DELETE /nodes/{node}/{type}/{vmid}/snapshot/{snapname}). Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
1066
- parameters: Schema20,
2124
+ parameters: Schema32,
1067
2125
  execute: async (_id, raw) => {
1068
- assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME10);
1069
- assertDestructive(raw, NAME10);
1070
- const args = raw;
2126
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME29);
2127
+ assertDestructive(raw, NAME29);
2128
+ const args = validateToolArgs(
2129
+ Schema32,
2130
+ raw,
2131
+ NAME29
2132
+ );
1071
2133
  const client = getClient();
1072
2134
  const { node, type } = await resolveResource(client, args.vmid);
1073
2135
  const upid = await client.delete(
@@ -1079,30 +2141,30 @@ function createProxmoxDeleteSnapshotTool(getClient) {
1079
2141
  }
1080
2142
 
1081
2143
  // src/tools/proxmox_force_stop_resource.ts
1082
- import { Type as Type21 } from "@sinclair/typebox";
1083
- var Schema21 = Type21.Object(
2144
+ import { Type as Type34 } from "@sinclair/typebox";
2145
+ var Schema33 = Type34.Object(
1084
2146
  {
1085
- vmid: Type21.Integer({ minimum: 1, description: "Container or VM ID to hard-stop." }),
1086
- confirm: Type21.Boolean({
2147
+ vmid: Type34.Integer({ minimum: 1, description: "Container or VM ID to hard-stop." }),
2148
+ confirm: Type34.Boolean({
1087
2149
  description: "Must be true. Tier-3 destructive gate."
1088
2150
  }),
1089
- destructive: Type21.Boolean({
2151
+ destructive: Type34.Boolean({
1090
2152
  description: "Must be true. Tier-3 destructive gate."
1091
2153
  })
1092
2154
  },
1093
2155
  { additionalProperties: false }
1094
2156
  );
1095
- var NAME11 = "proxmox_force_stop_resource";
2157
+ var NAME30 = "proxmox_force_stop_resource";
1096
2158
  function createProxmoxForceStopResourceTool(getClient) {
1097
2159
  return {
1098
- name: NAME11,
2160
+ name: NAME30,
1099
2161
  label: "proxmox: force stop resource",
1100
2162
  description: "Hard-kill an LXC container or QEMU VM (POST /nodes/{node}/{type}/{vmid}/status/stop). Unlike reboot/shutdown this is a non-graceful stop. Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
1101
- parameters: Schema21,
2163
+ parameters: Schema33,
1102
2164
  execute: async (_id, raw) => {
1103
- assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME11);
1104
- assertDestructive(raw, NAME11);
1105
- const args = raw;
2165
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME30);
2166
+ assertDestructive(raw, NAME30);
2167
+ const args = validateToolArgs(Schema33, raw, NAME30);
1106
2168
  const client = getClient();
1107
2169
  const { node, type } = await resolveResource(client, args.vmid);
1108
2170
  const upid = await client.post(
@@ -1114,57 +2176,2542 @@ function createProxmoxForceStopResourceTool(getClient) {
1114
2176
  };
1115
2177
  }
1116
2178
 
1117
- // index.ts
1118
- function withRedactedErrors(tool) {
1119
- const orig = tool.execute.bind(tool);
1120
- return {
1121
- ...tool,
1122
- execute: async (id, args) => {
1123
- try {
1124
- return await orig(id, args);
1125
- } catch (e) {
1126
- const msg = redact(e.message);
1127
- return { content: [{ type: "text", text: JSON.stringify({ error: msg }) }], isError: true };
2179
+ // src/tools/proxmox_exec.ts
2180
+ import { Type as Type35 } from "@sinclair/typebox";
2181
+
2182
+ // src/guest-agent.ts
2183
+ var GuestAgentError = class extends Error {
2184
+ constructor(message) {
2185
+ super(`guest-agent: ${message}`);
2186
+ this.name = "GuestAgentError";
2187
+ }
2188
+ };
2189
+ function sleep4(ms) {
2190
+ return new Promise((resolve) => setTimeout(resolve, ms));
2191
+ }
2192
+ async function execViaGuestAgent(client, node, vmid, command, timeoutMs, stdin, pollIntervalMs = 500) {
2193
+ const base = `/nodes/${node}/qemu/${vmid}/agent`;
2194
+ const body = { command: ["/bin/sh", "-c", command] };
2195
+ if (stdin !== void 0) body["input-data"] = stdin;
2196
+ const started = await client.post(`${base}/exec`, body);
2197
+ const pid = started?.pid;
2198
+ if (typeof pid !== "number") {
2199
+ throw new GuestAgentError(`agent/exec did not return a pid for vmid ${vmid}`);
2200
+ }
2201
+ const deadline = Date.now() + timeoutMs;
2202
+ while (Date.now() <= deadline) {
2203
+ const status = await client.get(`${base}/exec-status?pid=${pid}`);
2204
+ if (status.exited === 1 || status.exited === true) {
2205
+ return {
2206
+ stdout: status["out-data"] ?? "",
2207
+ stderr: status["err-data"] ?? "",
2208
+ exitCode: typeof status.exitcode === "number" ? status.exitcode : -1
2209
+ };
2210
+ }
2211
+ await sleep4(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
2212
+ }
2213
+ throw new GuestAgentError(`command in vmid ${vmid} did not finish within ${timeoutMs}ms`);
2214
+ }
2215
+
2216
+ // src/tools/ssh-target.ts
2217
+ function nonEmptyEnv(key) {
2218
+ const value = process.env[key];
2219
+ return value && value.length > 0 ? value : null;
2220
+ }
2221
+ function usableIpv42(ip) {
2222
+ if (ip.startsWith("127.")) return false;
2223
+ if (ip.startsWith("169.254.")) return false;
2224
+ if (ip === "0.0.0.0") return false;
2225
+ return true;
2226
+ }
2227
+ async function resolveQemuSshHost(client, node, vmid) {
2228
+ const envHost = nonEmptyEnv(`PROXMOX_VM_${vmid}_SSH_HOST`);
2229
+ if (envHost) return envHost;
2230
+ try {
2231
+ const data = await client.get(
2232
+ `/nodes/${node}/qemu/${vmid}/agent/network-get-interfaces`
2233
+ );
2234
+ const ifaces = data?.result ?? [];
2235
+ for (const iface of ifaces) {
2236
+ if (iface.name === "lo") continue;
2237
+ const ips = iface["ip-addresses"] ?? [];
2238
+ for (const entry of ips) {
2239
+ const ip = entry["ip-address"];
2240
+ if (!ip) continue;
2241
+ if (entry["ip-address-type"] !== "ipv4") continue;
2242
+ if (!usableIpv42(ip)) continue;
2243
+ return ip;
1128
2244
  }
1129
2245
  }
2246
+ } catch {
2247
+ }
2248
+ return null;
2249
+ }
2250
+ function qemuSshTarget(vmid, host, defaults) {
2251
+ return {
2252
+ host,
2253
+ port: 22,
2254
+ user: nonEmptyEnv(`PROXMOX_VM_${vmid}_SSH_USER`) ?? defaults.vmUser,
2255
+ keyPath: nonEmptyEnv(`PROXMOX_VM_${vmid}_SSH_KEY`) ?? defaults.vmKeyPath
1130
2256
  };
1131
2257
  }
1132
- function makeFactory(cfg) {
1133
- registerSecret(cfg.tokenId);
1134
- registerSecret(cfg.tokenSecret);
1135
- registerSecret(`PVEAPIToken=${cfg.tokenId}=${cfg.tokenSecret}`);
1136
- return () => new ProxmoxClient(cfg);
2258
+ function missingQemuSshHostMessage(vmid) {
2259
+ return `vmid ${vmid} is QEMU and has no PROXMOX_VM_${vmid}_SSH_HOST set and guest agent did not return a usable IP. Install qemu-guest-agent in the VM and enable it with 'qm set ${vmid} --agent 1', or pin the IP via env.`;
1137
2260
  }
1138
- var index_default = definePluginEntry({
1139
- id: "proxmox",
1140
- name: "Proxmox",
1141
- description: "Proxmox VE control: status, container + VM lifecycle, snapshots, backups, recent tasks. Single-cluster, token auth, optional TLS-insecure. Tier-2 writes gated by confirm:true.",
1142
- register(api) {
1143
- if (api.registrationMode !== "full") return;
1144
- const cfg = resolveConfig(process.env);
1145
- const getClient = makeFactory(cfg);
1146
- const register = (t) => api.registerTool(withRedactedErrors(t));
1147
- register(createProxmoxStatusTool(getClient));
1148
- register(createProxmoxListContainersTool(getClient));
1149
- register(createProxmoxListVmsTool(getClient));
1150
- register(createProxmoxGetResourceTool(getClient));
1151
- register(createProxmoxRecentTasksTool(getClient));
1152
- register(createProxmoxListBackupsTool(getClient));
2261
+
2262
+ // src/tools/guest-command.ts
2263
+ function resolveExecBackend() {
2264
+ const v = (process.env.PROXMOX_EXEC_BACKEND ?? "ssh").toLowerCase();
2265
+ return v === "guest-agent" || v === "agent" ? "guest-agent" : "ssh";
2266
+ }
2267
+ async function execInQemuGuest(client, ssh, node, vmid, command, timeoutMs, vmDefaults, stdin) {
2268
+ if (resolveExecBackend() === "guest-agent") {
2269
+ return execViaGuestAgent(client, node, vmid, command, timeoutMs, stdin);
2270
+ }
2271
+ const host = await resolveQemuSshHost(client, node, vmid);
2272
+ if (!host) throw new Error(missingQemuSshHostMessage(vmid));
2273
+ return ssh.execViaDirectSsh(qemuSshTarget(vmid, host, vmDefaults), command, timeoutMs, stdin);
2274
+ }
2275
+ function shellSingleQuote(s) {
2276
+ return `'${s.replace(/'/g, `'\\''`)}'`;
2277
+ }
2278
+ function assertAbsoluteGuestPath(path2, toolName) {
2279
+ if (!path2.startsWith("/")) throw new Error(`${toolName} path must be absolute`);
2280
+ if (path2.includes("\0")) throw new Error(`${toolName} path cannot contain NUL bytes`);
2281
+ }
2282
+ async function runGuestCommand(client, ssh, vmDefaults, vmid, command, timeoutMs, stdin) {
2283
+ const { node, type } = await resolveResource(client, vmid);
2284
+ if (type === "lxc") {
2285
+ return { node, type, result: await ssh.execInLxc(vmid, command, timeoutMs, stdin) };
2286
+ }
2287
+ const result = await execInQemuGuest(client, ssh, node, vmid, command, timeoutMs, vmDefaults, stdin);
2288
+ return { node, type, result };
2289
+ }
2290
+
2291
+ // src/tools/proxmox_exec.ts
2292
+ var Schema34 = Type35.Object(
2293
+ {
2294
+ vmid: Type35.Integer({ minimum: 1, description: "Container or VM id." }),
2295
+ command: Type35.String({ minLength: 1, description: "Shell command to run inside the resource." }),
2296
+ timeout: Type35.Optional(
2297
+ Type35.Integer({ minimum: 1, maximum: 3600, description: "Timeout in seconds (default 30)." })
2298
+ ),
2299
+ confirm: Type35.Boolean({ description: "Must be true to execute. Tier-2 safe-write gate." })
2300
+ },
2301
+ { additionalProperties: false }
2302
+ );
2303
+ var NAME31 = "proxmox_exec";
2304
+ function createProxmoxExecTool(getClient, getSsh, vmDefaults) {
2305
+ return {
2306
+ name: NAME31,
2307
+ label: "proxmox: exec in container or VM",
2308
+ description: "Run a shell command inside an LXC container (via SSH+pct exec) or QEMU VM (via direct SSH by default, or the qemu-guest-agent API when PROXMOX_EXEC_BACKEND=guest-agent - no in-guest SSH key needed). Returns stdout/stderr/exit_code. Tier-2 write; requires confirm:true.",
2309
+ parameters: Schema34,
2310
+ execute: async (_id, raw) => {
2311
+ assertConfirmedWrite(raw, NAME31);
2312
+ const args = validateToolArgs(Schema34, raw, NAME31);
2313
+ const timeoutMs = (args.timeout ?? 30) * 1e3;
2314
+ const client = getClient();
2315
+ const { node, type } = await resolveResource(client, args.vmid);
2316
+ const ssh = getSsh();
2317
+ if (type === "lxc") {
2318
+ const result2 = await ssh.execInLxc(args.vmid, args.command, timeoutMs);
2319
+ return jsonToolResult({
2320
+ vmid: args.vmid,
2321
+ type,
2322
+ stdout: result2.stdout,
2323
+ stderr: result2.stderr,
2324
+ exit_code: result2.exitCode
2325
+ });
2326
+ }
2327
+ const result = await execInQemuGuest(client, ssh, node, args.vmid, args.command, timeoutMs, vmDefaults);
2328
+ return jsonToolResult({
2329
+ vmid: args.vmid,
2330
+ type,
2331
+ stdout: result.stdout,
2332
+ stderr: result.stderr,
2333
+ exit_code: result.exitCode
2334
+ });
2335
+ }
2336
+ };
2337
+ }
2338
+
2339
+ // src/tools/proxmox_read_file.ts
2340
+ import { Type as Type36 } from "@sinclair/typebox";
2341
+ var Schema35 = Type36.Object(
2342
+ {
2343
+ vmid: Type36.Integer({ minimum: 1, description: "Container or VM id." }),
2344
+ path: Type36.String({ minLength: 1, description: "Absolute file path inside the resource." }),
2345
+ confirm: Type36.Boolean({ description: "Must be true to read files from inside a guest." })
2346
+ },
2347
+ { additionalProperties: false }
2348
+ );
2349
+ var NAME32 = "proxmox_read_file";
2350
+ function shellSingleQuote2(s) {
2351
+ return `'${s.replace(/'/g, `'\\''`)}'`;
2352
+ }
2353
+ function assertAbsoluteGuestPath2(path2, toolName) {
2354
+ if (!path2.startsWith("/")) throw new Error(`${toolName} path must be absolute`);
2355
+ if (path2.includes("\0")) throw new Error(`${toolName} path cannot contain NUL bytes`);
2356
+ }
2357
+ function createProxmoxReadFileTool(getClient, getSsh, vmDefaults) {
2358
+ return {
2359
+ name: NAME32,
2360
+ label: "proxmox: read file from container or VM",
2361
+ description: "Read a file from inside an LXC container or QEMU VM. Gated guest read; requires confirm:true.",
2362
+ parameters: Schema35,
2363
+ execute: async (_id, raw) => {
2364
+ assertConfirmedWrite(raw, NAME32);
2365
+ const args = validateToolArgs(Schema35, raw, NAME32);
2366
+ assertAbsoluteGuestPath2(args.path, NAME32);
2367
+ const client = getClient();
2368
+ const { node, type } = await resolveResource(client, args.vmid);
2369
+ const command = `cat -- ${shellSingleQuote2(args.path)}`;
2370
+ const ssh = getSsh();
2371
+ const timeoutMs = 3e4;
2372
+ let result;
2373
+ if (type === "lxc") {
2374
+ result = await ssh.execInLxc(args.vmid, command, timeoutMs);
2375
+ } else {
2376
+ result = await execInQemuGuest(client, ssh, node, args.vmid, command, timeoutMs, vmDefaults);
2377
+ }
2378
+ if (result.exitCode !== 0) {
2379
+ throw new Error(result.stderr.trim() || `read_file failed with exit code ${result.exitCode}`);
2380
+ }
2381
+ return jsonToolResult({ vmid: args.vmid, path: args.path, content: result.stdout });
2382
+ }
2383
+ };
2384
+ }
2385
+
2386
+ // src/tools/proxmox_write_file.ts
2387
+ import { Type as Type37 } from "@sinclair/typebox";
2388
+ import path from "path";
2389
+ var Schema36 = Type37.Object(
2390
+ {
2391
+ vmid: Type37.Integer({ minimum: 1, description: "Container or VM id." }),
2392
+ path: Type37.String({ minLength: 1, description: "Absolute destination path inside the resource." }),
2393
+ content: Type37.String({ description: "Text content to write." }),
2394
+ confirm: Type37.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
2395
+ },
2396
+ { additionalProperties: false }
2397
+ );
2398
+ var NAME33 = "proxmox_write_file";
2399
+ function shellSingleQuote3(s) {
2400
+ return `'${s.replace(/'/g, `'\\''`)}'`;
2401
+ }
2402
+ function assertAbsoluteGuestPath3(path2, toolName) {
2403
+ if (!path2.startsWith("/")) throw new Error(`${toolName} path must be absolute`);
2404
+ if (path2.includes("\0")) throw new Error(`${toolName} path cannot contain NUL bytes`);
2405
+ }
2406
+ function createProxmoxWriteFileTool(getClient, getSsh, vmDefaults) {
2407
+ return {
2408
+ name: NAME33,
2409
+ label: "proxmox: write file to container or VM",
2410
+ description: "Write a text file to a path inside an LXC container or QEMU VM. Creates parent directories. Tier-2 write; requires confirm:true.",
2411
+ parameters: Schema36,
2412
+ execute: async (_id, raw) => {
2413
+ assertConfirmedWrite(raw, NAME33);
2414
+ const args = validateToolArgs(Schema36, raw, NAME33);
2415
+ assertAbsoluteGuestPath3(args.path, NAME33);
2416
+ const client = getClient();
2417
+ const { node, type } = await resolveResource(client, args.vmid);
2418
+ const ssh = getSsh();
2419
+ const timeoutMs = 3e4;
2420
+ const parent = path.posix.dirname(args.path);
2421
+ const mkdirCmd = `mkdir -p -- ${shellSingleQuote3(parent)}`;
2422
+ const writeCmd = `cat > ${shellSingleQuote3(args.path)}`;
2423
+ const runOne = async (command, stdin) => {
2424
+ if (type === "lxc") {
2425
+ return ssh.execInLxc(args.vmid, command, timeoutMs, stdin);
2426
+ }
2427
+ return execInQemuGuest(client, ssh, node, args.vmid, command, timeoutMs, vmDefaults, stdin);
2428
+ };
2429
+ const mkdirResult = await runOne(mkdirCmd);
2430
+ if (mkdirResult.exitCode !== 0) {
2431
+ throw new Error(mkdirResult.stderr.trim() || `mkdir failed with exit code ${mkdirResult.exitCode}`);
2432
+ }
2433
+ const writeResult = await runOne(writeCmd, args.content);
2434
+ if (writeResult.exitCode !== 0) {
2435
+ throw new Error(writeResult.stderr.trim() || `write failed with exit code ${writeResult.exitCode}`);
2436
+ }
2437
+ return jsonToolResult({
2438
+ vmid: args.vmid,
2439
+ path: args.path,
2440
+ bytes_written: Buffer.byteLength(args.content, "utf8")
2441
+ });
2442
+ }
2443
+ };
2444
+ }
2445
+
2446
+ // src/tools/proxmox_stat_path.ts
2447
+ import { Type as Type38 } from "@sinclair/typebox";
2448
+ var Schema37 = Type38.Object(
2449
+ {
2450
+ vmid: Type38.Integer({ minimum: 1, description: "Container or VM id." }),
2451
+ path: Type38.String({ minLength: 1, description: "Absolute path inside the guest." }),
2452
+ confirm: Type38.Boolean({ description: "Must be true to inspect guest filesystem metadata." })
2453
+ },
2454
+ { additionalProperties: false }
2455
+ );
2456
+ var NAME34 = "proxmox_stat_path";
2457
+ function parseStatOutput(stdout) {
2458
+ const fields = stdout.split("\0");
2459
+ if (fields.at(-1) === "") fields.pop();
2460
+ if (fields.length !== 7) {
2461
+ throw new Error(`${NAME34} unexpected stat output: expected 7 NUL-delimited fields, got ${fields.length}`);
2462
+ }
2463
+ const [file_type, size, owner, group, mode, mtime, name] = fields;
2464
+ return {
2465
+ file_type,
2466
+ size: Number(size),
2467
+ owner,
2468
+ group,
2469
+ mode,
2470
+ mtime: Number(mtime),
2471
+ name
2472
+ };
2473
+ }
2474
+ function createProxmoxStatPathTool(getClient, getSsh, vmDefaults) {
2475
+ return {
2476
+ name: NAME34,
2477
+ label: "proxmox: stat guest path",
2478
+ description: "Return structured metadata for a path inside an LXC container or QEMU VM. Gated guest read; requires confirm:true.",
2479
+ parameters: Schema37,
2480
+ execute: async (_id, raw) => {
2481
+ assertConfirmedWrite(raw, NAME34);
2482
+ const args = validateToolArgs(Schema37, raw, NAME34);
2483
+ assertAbsoluteGuestPath(args.path, NAME34);
2484
+ const command = `stat -Lc '%F\\0%s\\0%U\\0%G\\0%a\\0%Y\\0%n\\0' -- ${shellSingleQuote(args.path)}`;
2485
+ const { node, type, result } = await runGuestCommand(
2486
+ getClient(),
2487
+ getSsh(),
2488
+ vmDefaults,
2489
+ args.vmid,
2490
+ command,
2491
+ 3e4
2492
+ );
2493
+ if (result.exitCode !== 0) throw new Error(result.stderr.trim() || `stat failed with exit code ${result.exitCode}`);
2494
+ const stat = parseStatOutput(result.stdout);
2495
+ return jsonToolResult({
2496
+ vmid: args.vmid,
2497
+ node,
2498
+ type,
2499
+ path: args.path,
2500
+ ...stat
2501
+ });
2502
+ }
2503
+ };
2504
+ }
2505
+
2506
+ // src/tools/proxmox_list_directory.ts
2507
+ import { Type as Type39 } from "@sinclair/typebox";
2508
+ var Schema38 = Type39.Object(
2509
+ {
2510
+ vmid: Type39.Integer({ minimum: 1, description: "Container or VM id." }),
2511
+ path: Type39.String({ minLength: 1, description: "Absolute directory path inside the guest." }),
2512
+ confirm: Type39.Boolean({ description: "Must be true to inspect guest directory contents." })
2513
+ },
2514
+ { additionalProperties: false }
2515
+ );
2516
+ var NAME35 = "proxmox_list_directory";
2517
+ function parseFindEntries(stdout) {
2518
+ if (stdout === "") return [];
2519
+ const fields = stdout.split("\0");
2520
+ if (fields.at(-1) === "") fields.pop();
2521
+ if (fields.length % 4 !== 0) {
2522
+ throw new Error(`${NAME35} unexpected find output: incomplete NUL-delimited record`);
2523
+ }
2524
+ const entries = [];
2525
+ for (let i = 0; i < fields.length; i += 4) {
2526
+ entries.push({
2527
+ name: fields[i],
2528
+ kind: fields[i + 1],
2529
+ size: Number(fields[i + 2]),
2530
+ mtime: Number(fields[i + 3])
2531
+ });
2532
+ }
2533
+ entries.sort((a, b) => a.name.localeCompare(b.name));
2534
+ return entries;
2535
+ }
2536
+ function createProxmoxListDirectoryTool(getClient, getSsh, vmDefaults) {
2537
+ return {
2538
+ name: NAME35,
2539
+ label: "proxmox: list guest directory",
2540
+ description: "List one directory inside an LXC container or QEMU VM. Gated guest read; requires confirm:true.",
2541
+ parameters: Schema38,
2542
+ execute: async (_id, raw) => {
2543
+ assertConfirmedWrite(raw, NAME35);
2544
+ const args = validateToolArgs(Schema38, raw, NAME35);
2545
+ assertAbsoluteGuestPath(args.path, NAME35);
2546
+ const command = `find ${shellSingleQuote(args.path)} -mindepth 1 -maxdepth 1 -printf '%f\\0%y\\0%s\\0%T@\\0'`;
2547
+ const { node, type, result } = await runGuestCommand(
2548
+ getClient(),
2549
+ getSsh(),
2550
+ vmDefaults,
2551
+ args.vmid,
2552
+ command,
2553
+ 3e4
2554
+ );
2555
+ if (result.exitCode !== 0) {
2556
+ throw new Error(result.stderr.trim() || `list_directory failed with exit code ${result.exitCode}`);
2557
+ }
2558
+ const entries = parseFindEntries(result.stdout);
2559
+ return jsonToolResult({ vmid: args.vmid, node, type, path: args.path, count: entries.length, entries });
2560
+ }
2561
+ };
2562
+ }
2563
+
2564
+ // src/tools/proxmox_service_status.ts
2565
+ import { Type as Type40 } from "@sinclair/typebox";
2566
+ var Schema39 = Type40.Object(
2567
+ {
2568
+ vmid: Type40.Integer({ minimum: 1, description: "Container or VM id." }),
2569
+ service: Type40.String({ minLength: 1, description: "systemd service name inside the guest." }),
2570
+ confirm: Type40.Boolean({ description: "Must be true to inspect guest service state." })
2571
+ },
2572
+ { additionalProperties: false }
2573
+ );
2574
+ var NAME36 = "proxmox_service_status";
2575
+ function parseSystemctlShow(stdout) {
2576
+ const out = {};
2577
+ for (const line of stdout.trimEnd().split("\n")) {
2578
+ const idx = line.indexOf("=");
2579
+ if (idx <= 0) continue;
2580
+ out[line.slice(0, idx)] = line.slice(idx + 1);
2581
+ }
2582
+ return out;
2583
+ }
2584
+ function createProxmoxServiceStatusTool(getClient, getSsh, vmDefaults) {
2585
+ return {
2586
+ name: NAME36,
2587
+ label: "proxmox: guest service status",
2588
+ description: "Return systemd service status from inside an LXC container or QEMU VM. Gated guest read; requires confirm:true.",
2589
+ parameters: Schema39,
2590
+ execute: async (_id, raw) => {
2591
+ assertConfirmedWrite(raw, NAME36);
2592
+ const args = validateToolArgs(Schema39, raw, NAME36);
2593
+ if (args.service.includes("\0")) throw new Error(`${NAME36} service cannot contain NUL bytes`);
2594
+ const command = `systemctl show --no-pager --property=Id,LoadState,ActiveState,SubState,UnitFileState,Description -- ${shellSingleQuote(args.service)}`;
2595
+ const { node, type, result } = await runGuestCommand(
2596
+ getClient(),
2597
+ getSsh(),
2598
+ vmDefaults,
2599
+ args.vmid,
2600
+ command,
2601
+ 3e4
2602
+ );
2603
+ if (result.exitCode !== 0) {
2604
+ throw new Error(result.stderr.trim() || `service_status failed with exit code ${result.exitCode}`);
2605
+ }
2606
+ const status = parseSystemctlShow(result.stdout);
2607
+ return jsonToolResult({ vmid: args.vmid, node, type, service: args.service, status });
2608
+ }
2609
+ };
2610
+ }
2611
+
2612
+ // src/tools/service-action.ts
2613
+ import { Type as Type41 } from "@sinclair/typebox";
2614
+ function parseSystemctlShow2(stdout) {
2615
+ const out = {};
2616
+ for (const line of stdout.trimEnd().split("\n")) {
2617
+ const idx = line.indexOf("=");
2618
+ if (idx <= 0) continue;
2619
+ out[line.slice(0, idx)] = line.slice(idx + 1);
2620
+ }
2621
+ return out;
2622
+ }
2623
+ function schemaFor(action) {
2624
+ return Type41.Object(
2625
+ {
2626
+ vmid: Type41.Integer({ minimum: 1, description: "Container or VM id." }),
2627
+ service: Type41.String({ minLength: 1, description: `systemd service name to ${action} inside the guest.` }),
2628
+ confirm: Type41.Boolean({ description: `Must be true to ${action} a guest service.` })
2629
+ },
2630
+ { additionalProperties: false }
2631
+ );
2632
+ }
2633
+ function createServiceActionTool(action, getClient, getSsh, vmDefaults) {
2634
+ const name = `proxmox_service_${action}`;
2635
+ const schema = schemaFor(action);
2636
+ return {
2637
+ name,
2638
+ label: `proxmox: guest service ${action}`,
2639
+ description: `${action[0].toUpperCase()}${action.slice(1)} a systemd service inside an LXC container or QEMU VM. Tier-2 write; requires confirm:true.`,
2640
+ parameters: schema,
2641
+ execute: async (_id, raw) => {
2642
+ assertConfirmedWrite(raw, name);
2643
+ const args = validateToolArgs(schema, raw, name);
2644
+ if (args.service.includes("\0")) throw new Error(`${name} service cannot contain NUL bytes`);
2645
+ const quoted = shellSingleQuote(args.service);
2646
+ const command = `systemctl ${action} -- ${quoted} && systemctl show --no-pager --property=Id,LoadState,ActiveState,SubState,UnitFileState,Description -- ${quoted}`;
2647
+ const { node, type, result } = await runGuestCommand(
2648
+ getClient(),
2649
+ getSsh(),
2650
+ vmDefaults,
2651
+ args.vmid,
2652
+ command,
2653
+ 6e4
2654
+ );
2655
+ if (result.exitCode !== 0) {
2656
+ throw new Error(result.stderr.trim() || `service_${action} failed with exit code ${result.exitCode}`);
2657
+ }
2658
+ return jsonToolResult({
2659
+ vmid: args.vmid,
2660
+ node,
2661
+ type,
2662
+ service: args.service,
2663
+ action,
2664
+ status: parseSystemctlShow2(result.stdout)
2665
+ });
2666
+ }
2667
+ };
2668
+ }
2669
+
2670
+ // src/tools/proxmox_service_start.ts
2671
+ function createProxmoxServiceStartTool(getClient, getSsh, vmDefaults) {
2672
+ return createServiceActionTool("start", getClient, getSsh, vmDefaults);
2673
+ }
2674
+
2675
+ // src/tools/proxmox_service_stop.ts
2676
+ function createProxmoxServiceStopTool(getClient, getSsh, vmDefaults) {
2677
+ return createServiceActionTool("stop", getClient, getSsh, vmDefaults);
2678
+ }
2679
+
2680
+ // src/tools/proxmox_service_restart.ts
2681
+ function createProxmoxServiceRestartTool(getClient, getSsh, vmDefaults) {
2682
+ return createServiceActionTool("restart", getClient, getSsh, vmDefaults);
2683
+ }
2684
+
2685
+ // src/tools/proxmox_update_vm_config.ts
2686
+ import { Type as Type43 } from "@sinclair/typebox";
2687
+
2688
+ // src/tools/resource-config.ts
2689
+ import { Type as Type42 } from "@sinclair/typebox";
2690
+ var CONFIG_KEY_RE = /^[a-zA-Z][a-zA-Z0-9_]*$/;
2691
+ var configEditFields = {
2692
+ cores: Type42.Optional(Type42.Integer({ minimum: 1, description: "CPU cores." })),
2693
+ memory: Type42.Optional(Type42.Integer({ minimum: 16, description: "RAM in MiB." })),
2694
+ description: Type42.Optional(Type42.String({ description: "Free-form description / notes." })),
2695
+ onboot: Type42.Optional(Type42.Boolean({ description: "Start on host boot." })),
2696
+ tags: Type42.Optional(Type42.String({ description: "Semicolon-delimited Proxmox tags." })),
2697
+ cpulimit: Type42.Optional(Type42.Number({ minimum: 0, description: "CPU limit (0 = unlimited)." })),
2698
+ cpuunits: Type42.Optional(Type42.Integer({ minimum: 1, description: "CPU weight / shares." })),
2699
+ protection: Type42.Optional(
2700
+ Type42.Boolean({ description: "Protection flag (blocks destroy/disk-remove)." })
2701
+ ),
2702
+ set: Type42.Optional(
2703
+ Type42.Record(Type42.String(), Type42.Union([Type42.String(), Type42.Number(), Type42.Boolean()]), {
2704
+ description: 'Arbitrary PVE config keys to set, e.g. {"net0":"virtio,bridge=vmbr0","bios":"ovmf"}. Escape hatch for keys not exposed as typed fields.'
2705
+ })
2706
+ ),
2707
+ unset: Type42.Optional(
2708
+ Type42.Array(Type42.String(), {
2709
+ description: 'Config keys to unset/revert to default, e.g. ["tags","description"].'
2710
+ })
2711
+ ),
2712
+ digest: Type42.Optional(
2713
+ Type42.String({
2714
+ description: "SHA1 config digest for optimistic concurrency; edit is rejected if config changed."
2715
+ })
2716
+ )
2717
+ };
2718
+ function normalize(v) {
2719
+ if (typeof v === "boolean") return v ? 1 : 0;
2720
+ if (typeof v === "number") return v;
2721
+ return String(v);
2722
+ }
2723
+ function buildConfigBody(args, extraTyped, toolName) {
2724
+ const body = {};
2725
+ const typed = {
2726
+ cores: args.cores,
2727
+ memory: args.memory,
2728
+ description: args.description,
2729
+ onboot: args.onboot,
2730
+ tags: args.tags,
2731
+ cpulimit: args.cpulimit,
2732
+ cpuunits: args.cpuunits,
2733
+ protection: args.protection,
2734
+ ...extraTyped
2735
+ };
2736
+ for (const [k, v] of Object.entries(typed)) {
2737
+ if (v !== void 0) body[k] = normalize(v);
2738
+ }
2739
+ if (args.set) {
2740
+ for (const [k, v] of Object.entries(args.set)) {
2741
+ if (!CONFIG_KEY_RE.test(k)) {
2742
+ throw new ToolInputError(`${toolName}: invalid config key "${k}" in set`);
2743
+ }
2744
+ body[k] = normalize(v);
2745
+ }
2746
+ }
2747
+ const unset = (args.unset ?? []).filter((k) => k.length > 0);
2748
+ for (const k of unset) {
2749
+ if (!CONFIG_KEY_RE.test(k)) {
2750
+ throw new ToolInputError(`${toolName}: invalid config key "${k}" in unset`);
2751
+ }
2752
+ }
2753
+ if (unset.length > 0) body.delete = unset.join(",");
2754
+ if (args.digest) body.digest = args.digest;
2755
+ const mutations = Object.keys(body).filter((k) => k !== "digest");
2756
+ if (mutations.length === 0) {
2757
+ throw new ToolInputError(
2758
+ `${toolName}: no config changes supplied. Provide at least one field, a "set" entry, or an "unset" key.`
2759
+ );
2760
+ }
2761
+ return body;
2762
+ }
2763
+
2764
+ // src/tools/proxmox_update_vm_config.ts
2765
+ var Schema40 = Type43.Object(
2766
+ {
2767
+ vmid: Type43.Integer({ minimum: 1, description: "QEMU VM ID to reconfigure." }),
2768
+ name: Type43.Optional(Type43.String({ minLength: 1, description: "VM name." })),
2769
+ sockets: Type43.Optional(Type43.Integer({ minimum: 1, description: "CPU sockets." })),
2770
+ balloon: Type43.Optional(
2771
+ Type43.Integer({ minimum: 0, description: "Ballooning target in MiB (0 disables)." })
2772
+ ),
2773
+ ...configEditFields,
2774
+ confirm: Type43.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
2775
+ },
2776
+ { additionalProperties: false }
2777
+ );
2778
+ var NAME37 = "proxmox_update_vm_config";
2779
+ function createProxmoxUpdateVmConfigTool(getClient) {
2780
+ return {
2781
+ name: NAME37,
2782
+ label: "proxmox: update VM config",
2783
+ description: "Edit an existing QEMU VM's config (PUT /nodes/{node}/qemu/{vmid}/config): cores, memory, sockets, balloon, name, description, onboot, tags, plus arbitrary keys via `set` and key removal via `unset`. Some changes (CPU/mem/disk on a running VM) apply as pending until reboot. Tier-2 write; requires confirm:true.",
2784
+ parameters: Schema40,
2785
+ execute: async (_id, raw) => {
2786
+ assertConfirmedWrite(raw, NAME37);
2787
+ const args = validateToolArgs(Schema40, raw, NAME37);
2788
+ const client = getClient();
2789
+ const { node, type } = await resolveResource(client, args.vmid);
2790
+ if (type !== "qemu") {
2791
+ throw new Error(`vmid ${args.vmid} is an LXC container, not a QEMU VM. Use proxmox_update_container_config.`);
2792
+ }
2793
+ const body = buildConfigBody(args, { name: args.name, sockets: args.sockets, balloon: args.balloon }, NAME37);
2794
+ const upid = await client.put(`/nodes/${node}/qemu/${args.vmid}/config`, body);
2795
+ const changed = Object.keys(body).filter((k) => k !== "digest" && k !== "delete");
2796
+ const removed = typeof body.delete === "string" ? body.delete.split(",") : [];
2797
+ return jsonToolResult({ vmid: args.vmid, node, type, changed, removed, upid: upid ?? null });
2798
+ }
2799
+ };
2800
+ }
2801
+
2802
+ // src/tools/proxmox_update_container_config.ts
2803
+ import { Type as Type44 } from "@sinclair/typebox";
2804
+ var Schema41 = Type44.Object(
2805
+ {
2806
+ vmid: Type44.Integer({ minimum: 1, description: "LXC container ID to reconfigure." }),
2807
+ hostname: Type44.Optional(Type44.String({ minLength: 1, description: "Container hostname." })),
2808
+ swap: Type44.Optional(Type44.Integer({ minimum: 0, description: "Swap in MiB." })),
2809
+ nameserver: Type44.Optional(Type44.String({ minLength: 1, description: "DNS server IP(s), space-separated." })),
2810
+ ...configEditFields,
2811
+ confirm: Type44.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
2812
+ },
2813
+ { additionalProperties: false }
2814
+ );
2815
+ var NAME38 = "proxmox_update_container_config";
2816
+ function createProxmoxUpdateContainerConfigTool(getClient) {
2817
+ return {
2818
+ name: NAME38,
2819
+ label: "proxmox: update container config",
2820
+ description: "Edit an existing LXC container's config (PUT /nodes/{node}/lxc/{vmid}/config): cores, memory, swap, hostname, nameserver, description, onboot, tags, plus arbitrary keys via `set` and key removal via `unset`. Tier-2 write; requires confirm:true.",
2821
+ parameters: Schema41,
2822
+ execute: async (_id, raw) => {
2823
+ assertConfirmedWrite(raw, NAME38);
2824
+ const args = validateToolArgs(Schema41, raw, NAME38);
2825
+ const client = getClient();
2826
+ const { node, type } = await resolveResource(client, args.vmid);
2827
+ if (type !== "lxc") {
2828
+ throw new Error(`vmid ${args.vmid} is a QEMU VM, not an LXC container. Use proxmox_update_vm_config.`);
2829
+ }
2830
+ const body = buildConfigBody(
2831
+ args,
2832
+ { hostname: args.hostname, swap: args.swap, nameserver: args.nameserver },
2833
+ NAME38
2834
+ );
2835
+ const upid = await client.put(`/nodes/${node}/lxc/${args.vmid}/config`, body);
2836
+ const changed = Object.keys(body).filter((k) => k !== "digest" && k !== "delete");
2837
+ const removed = typeof body.delete === "string" ? body.delete.split(",") : [];
2838
+ return jsonToolResult({ vmid: args.vmid, node, type, changed, removed, upid: upid ?? null });
2839
+ }
2840
+ };
2841
+ }
2842
+
2843
+ // src/tools/proxmox_resize_disk.ts
2844
+ import { Type as Type45 } from "@sinclair/typebox";
2845
+ var DISK_KEY_RE = /^[a-zA-Z][a-zA-Z0-9_]*$/;
2846
+ var SIZE_RE = /^\+?\d+(\.\d+)?[KMGT]?$/;
2847
+ var Schema42 = Type45.Object(
2848
+ {
2849
+ vmid: Type45.Integer({ minimum: 1, description: "Container or VM ID." }),
2850
+ disk: Type45.String({
2851
+ minLength: 1,
2852
+ description: "Disk key to resize, e.g. 'scsi0', 'virtio0', 'rootfs', 'mp0'."
2853
+ }),
2854
+ size: Type45.String({
2855
+ minLength: 1,
2856
+ description: "New size ('32G') or growth increment ('+2G'). PVE grows only; shrink is refused."
2857
+ }),
2858
+ confirm: Type45.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." }),
2859
+ ...taskWaitFields
2860
+ },
2861
+ { additionalProperties: false }
2862
+ );
2863
+ var NAME39 = "proxmox_resize_disk";
2864
+ function createProxmoxResizeDiskTool(getClient) {
2865
+ return {
2866
+ name: NAME39,
2867
+ label: "proxmox: resize disk",
2868
+ description: "Grow a VM or container disk (PUT /nodes/{node}/{type}/{vmid}/resize) with {disk,size}. Size is absolute ('32G') or an increment ('+2G'); Proxmox only grows disks. Tier-2 write; requires confirm:true.",
2869
+ parameters: Schema42,
2870
+ execute: async (_id, raw) => {
2871
+ assertConfirmedWrite(raw, NAME39);
2872
+ const args = validateToolArgs(
2873
+ Schema42,
2874
+ raw,
2875
+ NAME39
2876
+ );
2877
+ if (!DISK_KEY_RE.test(args.disk)) {
2878
+ throw new ToolInputError(`${NAME39}: invalid disk key "${args.disk}"`);
2879
+ }
2880
+ if (!SIZE_RE.test(args.size)) {
2881
+ throw new ToolInputError(
2882
+ `${NAME39}: invalid size "${args.size}". Use '32G' (absolute) or '+2G' (growth).`
2883
+ );
2884
+ }
2885
+ const client = getClient();
2886
+ const { node, type } = await resolveResource(client, args.vmid);
2887
+ const upid = await client.put(`/nodes/${node}/${type}/${args.vmid}/resize`, {
2888
+ disk: args.disk,
2889
+ size: args.size
2890
+ });
2891
+ const task = await resolveTaskWait(client, upid, args);
2892
+ return jsonToolResult({ vmid: args.vmid, node, type, disk: args.disk, size: args.size, upid: upid ?? null, ...task ? { task } : {} });
2893
+ }
2894
+ };
2895
+ }
2896
+
2897
+ // src/tools/proxmox_restore_backup.ts
2898
+ import { Type as Type46 } from "@sinclair/typebox";
2899
+ var Schema43 = Type46.Object(
2900
+ {
2901
+ vmid: Type46.Integer({ minimum: 1, description: "Target VMID to restore into." }),
2902
+ archive: Type46.String({
2903
+ minLength: 1,
2904
+ description: "Backup archive volid or path, e.g. 'local:backup/vzdump-lxc-115-2026_01_01-00_00_00.tar.zst' or a PBS volid."
2905
+ }),
2906
+ type: Type46.Optional(
2907
+ Type46.Union([Type46.Literal("lxc"), Type46.Literal("qemu")], {
2908
+ description: "Guest type. Inferred from the archive name when omitted."
2909
+ })
2910
+ ),
2911
+ node: Type46.Optional(
2912
+ Type46.String({ minLength: 1, description: "Node to restore on (defaults to first node for a new vmid)." })
2913
+ ),
2914
+ storage: Type46.Optional(
2915
+ Type46.String({ minLength: 1, description: "Target storage for restored disks (defaults to the archive's)." })
2916
+ ),
2917
+ pool: Type46.Optional(Type46.String({ minLength: 1, description: "Resource pool to place the guest into." })),
2918
+ unique: Type46.Optional(
2919
+ Type46.Boolean({ description: "QEMU: regenerate MAC addresses / UUID on restore." })
2920
+ ),
2921
+ force: Type46.Optional(
2922
+ Type46.Boolean({
2923
+ description: "Overwrite an EXISTING vmid (wipes its disks). Requires the destructive gate."
2924
+ })
2925
+ ),
2926
+ confirm: Type46.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." }),
2927
+ destructive: Type46.Optional(
2928
+ Type46.Boolean({ description: "Required only when overwriting an existing vmid (force)." })
2929
+ ),
2930
+ ...taskWaitFields
2931
+ },
2932
+ { additionalProperties: false }
2933
+ );
2934
+ var NAME40 = "proxmox_restore_backup";
2935
+ function inferType(archive) {
2936
+ const a = archive.toLowerCase();
2937
+ if (a.includes("qemu") || a.includes("/vm/")) return "qemu";
2938
+ if (a.includes("lxc") || a.includes("/ct/")) return "lxc";
2939
+ return null;
2940
+ }
2941
+ function createProxmoxRestoreBackupTool(getClient) {
2942
+ return {
2943
+ name: NAME40,
2944
+ label: "proxmox: restore backup",
2945
+ description: "Restore a vzdump/PBS backup into a VMID (POST /nodes/{node}/{type}/{vmid} with restore=1). Restoring to a new VMID is Tier-2 (confirm:true). Overwriting an EXISTING VMID wipes its disks and additionally requires force:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
2946
+ parameters: Schema43,
2947
+ execute: async (_id, raw) => {
2948
+ assertConfirmedWrite(raw, NAME40);
2949
+ const args = validateToolArgs(Schema43, raw, NAME40);
2950
+ if (/[\r\n]/.test(args.archive)) {
2951
+ throw new ToolInputError(`${NAME40}: archive must not contain newlines`);
2952
+ }
2953
+ const type = args.type ?? inferType(args.archive);
2954
+ if (!type) {
2955
+ throw new ToolInputError(
2956
+ `${NAME40}: could not infer guest type from archive "${args.archive}". Pass type:"lxc" or "qemu".`
2957
+ );
2958
+ }
2959
+ const client = getClient();
2960
+ const resources = await client.get("/cluster/resources");
2961
+ const existing = resources.find(
2962
+ (r) => r.vmid === args.vmid && (r.type === "lxc" || r.type === "qemu")
2963
+ );
2964
+ let node;
2965
+ if (existing) {
2966
+ if (args.force !== true) {
2967
+ throw new ToolInputError(
2968
+ `${NAME40}: vmid ${args.vmid} already exists on ${existing.node}. To overwrite it, pass force:true (also requires destructive:true + PROXMOX_ENABLE_DESTRUCTIVE=1).`
2969
+ );
2970
+ }
2971
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME40);
2972
+ assertDestructive(raw, NAME40);
2973
+ if (existing.type !== type) {
2974
+ throw new Error(
2975
+ `vmid ${args.vmid} exists as ${existing.type} but archive is ${type}. Refusing cross-type overwrite.`
2976
+ );
2977
+ }
2978
+ node = existing.node;
2979
+ } else {
2980
+ if (args.node) {
2981
+ assertSafePathSegment(args.node, "node");
2982
+ node = args.node;
2983
+ } else {
2984
+ const nodes = resources.filter((r) => r.type === "node");
2985
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
2986
+ node = nodes[0].node;
2987
+ }
2988
+ }
2989
+ const body = {
2990
+ vmid: args.vmid,
2991
+ restore: 1
2992
+ };
2993
+ if (type === "qemu") body.archive = args.archive;
2994
+ else body.ostemplate = args.archive;
2995
+ if (existing && args.force === true) body.force = 1;
2996
+ if (args.storage) body.storage = args.storage;
2997
+ if (args.pool) body.pool = args.pool;
2998
+ if (args.unique === true && type === "qemu") body.unique = 1;
2999
+ const upid = await client.post(`/nodes/${node}/${type}`, body);
3000
+ const task = await resolveTaskWait(client, upid, args);
3001
+ return jsonToolResult({
3002
+ vmid: args.vmid,
3003
+ node,
3004
+ type,
3005
+ archive: args.archive,
3006
+ overwrite: Boolean(existing),
3007
+ upid,
3008
+ ...task ? { task } : {}
3009
+ });
3010
+ }
3011
+ };
3012
+ }
3013
+
3014
+ // src/tools/proxmox_migrate_resource.ts
3015
+ import { Type as Type47 } from "@sinclair/typebox";
3016
+ var Schema44 = Type47.Object(
3017
+ {
3018
+ vmid: Type47.Integer({ minimum: 1, description: "Container or VM ID to migrate." }),
3019
+ target: Type47.String({ minLength: 1, description: "Target node name to migrate to." }),
3020
+ online: Type47.Optional(
3021
+ Type47.Boolean({ description: "QEMU: live-migrate a running VM (no downtime)." })
3022
+ ),
3023
+ restart: Type47.Optional(
3024
+ Type47.Boolean({ description: "LXC: restart-migrate a running container (brief downtime)." })
3025
+ ),
3026
+ with_local_disks: Type47.Optional(
3027
+ Type47.Boolean({ description: "QEMU: also migrate local (non-shared) disks." })
3028
+ ),
3029
+ targetstorage: Type47.Optional(
3030
+ Type47.String({ minLength: 1, description: "Map disks onto this storage on the target node." })
3031
+ ),
3032
+ bwlimit: Type47.Optional(
3033
+ Type47.Integer({ minimum: 0, description: "Bandwidth limit in KiB/s (0 = unlimited)." })
3034
+ ),
3035
+ confirm: Type47.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." }),
3036
+ ...taskWaitFields
3037
+ },
3038
+ { additionalProperties: false }
3039
+ );
3040
+ var NAME41 = "proxmox_migrate_resource";
3041
+ function createProxmoxMigrateResourceTool(getClient) {
3042
+ return {
3043
+ name: NAME41,
3044
+ label: "proxmox: migrate resource",
3045
+ description: "Migrate a VM or container to another node (POST /nodes/{node}/{type}/{vmid}/migrate). QEMU supports online (live) migration; LXC uses restart mode. Tier-2 write; requires confirm:true.",
3046
+ parameters: Schema44,
3047
+ execute: async (_id, raw) => {
3048
+ assertConfirmedWrite(raw, NAME41);
3049
+ const args = validateToolArgs(Schema44, raw, NAME41);
3050
+ assertSafePathSegment(args.target, "target node");
3051
+ const client = getClient();
3052
+ const { node, type } = await resolveResource(client, args.vmid);
3053
+ if (args.target === node) {
3054
+ throw new Error(`vmid ${args.vmid} is already on node ${node}; nothing to migrate.`);
3055
+ }
3056
+ const body = { target: args.target };
3057
+ if (type === "qemu") {
3058
+ if (args.online) body.online = 1;
3059
+ if (args.with_local_disks) body["with-local-disks"] = 1;
3060
+ } else {
3061
+ if (args.restart || args.online) body.restart = 1;
3062
+ }
3063
+ if (args.targetstorage) body.targetstorage = args.targetstorage;
3064
+ if (typeof args.bwlimit === "number") body.bwlimit = args.bwlimit;
3065
+ const upid = await client.post(`/nodes/${node}/${type}/${args.vmid}/migrate`, body);
3066
+ const task = await resolveTaskWait(client, upid, args);
3067
+ return jsonToolResult({ vmid: args.vmid, node, type, target: args.target, upid, ...task ? { task } : {} });
3068
+ }
3069
+ };
3070
+ }
3071
+
3072
+ // src/tools/proxmox_suspend_resource.ts
3073
+ import { Type as Type48 } from "@sinclair/typebox";
3074
+ var Schema45 = Type48.Object(
3075
+ {
3076
+ vmid: Type48.Integer({ minimum: 1, description: "Container or VM ID." }),
3077
+ todisk: Type48.Optional(
3078
+ Type48.Boolean({ description: "QEMU: suspend to disk (hibernate) instead of to RAM." })
3079
+ ),
3080
+ confirm: Type48.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3081
+ },
3082
+ { additionalProperties: false }
3083
+ );
3084
+ var NAME42 = "proxmox_suspend_resource";
3085
+ function createProxmoxSuspendResourceTool(getClient) {
3086
+ return {
3087
+ name: NAME42,
3088
+ label: "proxmox: suspend resource",
3089
+ description: "Suspend (pause) a running LXC or QEMU guest (POST /nodes/{node}/{type}/{vmid}/status/suspend). QEMU can suspend to disk with todisk:true. Tier-2 write; requires confirm:true.",
3090
+ parameters: Schema45,
3091
+ execute: async (_id, raw) => {
3092
+ assertConfirmedWrite(raw, NAME42);
3093
+ const args = validateToolArgs(Schema45, raw, NAME42);
3094
+ const client = getClient();
3095
+ const { node, type } = await resolveResource(client, args.vmid);
3096
+ const body = {};
3097
+ if (args.todisk && type === "qemu") body.todisk = 1;
3098
+ const upid = await client.post(`/nodes/${node}/${type}/${args.vmid}/status/suspend`, body);
3099
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
3100
+ }
3101
+ };
3102
+ }
3103
+
3104
+ // src/tools/proxmox_resume_resource.ts
3105
+ import { Type as Type49 } from "@sinclair/typebox";
3106
+ var Schema46 = Type49.Object(
3107
+ {
3108
+ vmid: Type49.Integer({ minimum: 1, description: "Container or VM ID." }),
3109
+ confirm: Type49.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3110
+ },
3111
+ { additionalProperties: false }
3112
+ );
3113
+ var NAME43 = "proxmox_resume_resource";
3114
+ function createProxmoxResumeResourceTool(getClient) {
3115
+ return {
3116
+ name: NAME43,
3117
+ label: "proxmox: resume resource",
3118
+ description: "Resume a suspended LXC or QEMU guest (POST /nodes/{node}/{type}/{vmid}/status/resume). Tier-2 write; requires confirm:true.",
3119
+ parameters: Schema46,
3120
+ execute: async (_id, raw) => {
3121
+ assertConfirmedWrite(raw, NAME43);
3122
+ const args = validateToolArgs(Schema46, raw, NAME43);
3123
+ const client = getClient();
3124
+ const { node, type } = await resolveResource(client, args.vmid);
3125
+ const upid = await client.post(`/nodes/${node}/${type}/${args.vmid}/status/resume`, {});
3126
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
3127
+ }
3128
+ };
3129
+ }
3130
+
3131
+ // src/tools/proxmox_reset_resource.ts
3132
+ import { Type as Type50 } from "@sinclair/typebox";
3133
+ var Schema47 = Type50.Object(
3134
+ {
3135
+ vmid: Type50.Integer({ minimum: 1, description: "QEMU VM ID." }),
3136
+ confirm: Type50.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3137
+ },
3138
+ { additionalProperties: false }
3139
+ );
3140
+ var NAME44 = "proxmox_reset_resource";
3141
+ function createProxmoxResetResourceTool(getClient) {
3142
+ return {
3143
+ name: NAME44,
3144
+ label: "proxmox: reset resource",
3145
+ description: "Hard-reset a running QEMU VM (POST /nodes/{node}/qemu/{vmid}/status/reset) - equivalent to the reset button, no graceful shutdown. QEMU only. Tier-2 write; requires confirm:true.",
3146
+ parameters: Schema47,
3147
+ execute: async (_id, raw) => {
3148
+ assertConfirmedWrite(raw, NAME44);
3149
+ const args = validateToolArgs(Schema47, raw, NAME44);
3150
+ const client = getClient();
3151
+ const { node, type } = await resolveResource(client, args.vmid);
3152
+ if (type !== "qemu") {
3153
+ throw new Error(`vmid ${args.vmid} is an LXC container; reset is QEMU-only. Use proxmox_reboot_resource.`);
3154
+ }
3155
+ const upid = await client.post(`/nodes/${node}/qemu/${args.vmid}/status/reset`, {});
3156
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
3157
+ }
3158
+ };
3159
+ }
3160
+
3161
+ // src/tools/proxmox_convert_to_template.ts
3162
+ import { Type as Type51 } from "@sinclair/typebox";
3163
+ var Schema48 = Type51.Object(
3164
+ {
3165
+ vmid: Type51.Integer({ minimum: 1, description: "Container or VM ID to convert into a template." }),
3166
+ confirm: Type51.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3167
+ },
3168
+ { additionalProperties: false }
3169
+ );
3170
+ var NAME45 = "proxmox_convert_to_template";
3171
+ function createProxmoxConvertToTemplateTool(getClient) {
3172
+ return {
3173
+ name: NAME45,
3174
+ label: "proxmox: convert to template",
3175
+ description: "Convert a stopped VM or container into a template (POST /nodes/{node}/{type}/{vmid}/template). One-way: a template cannot be started, only cloned from. Tier-2 write; requires confirm:true.",
3176
+ parameters: Schema48,
3177
+ execute: async (_id, raw) => {
3178
+ assertConfirmedWrite(raw, NAME45);
3179
+ const args = validateToolArgs(Schema48, raw, NAME45);
3180
+ const client = getClient();
3181
+ const { node, type } = await resolveResource(client, args.vmid);
3182
+ const upid = await client.post(`/nodes/${node}/${type}/${args.vmid}/template`, {});
3183
+ return jsonToolResult({ vmid: args.vmid, node, type, template: true, upid: upid ?? null });
3184
+ }
3185
+ };
3186
+ }
3187
+
3188
+ // src/tools/proxmox_list_storage_content.ts
3189
+ import { Type as Type52 } from "@sinclair/typebox";
3190
+ var Schema49 = Type52.Object(
3191
+ {
3192
+ node: Type52.String({ minLength: 1, description: "Node whose storage to inspect." }),
3193
+ storage: Type52.String({ minLength: 1, description: "Storage ID, e.g. 'local', 'local-lvm'." }),
3194
+ content: Type52.Optional(
3195
+ Type52.Union(
3196
+ [
3197
+ Type52.Literal("backup"),
3198
+ Type52.Literal("iso"),
3199
+ Type52.Literal("vztmpl"),
3200
+ Type52.Literal("images"),
3201
+ Type52.Literal("rootdir"),
3202
+ Type52.Literal("snippets")
3203
+ ],
3204
+ { description: "Filter by content type (backup, iso, vztmpl, images, rootdir, snippets)." }
3205
+ )
3206
+ ),
3207
+ vmid: Type52.Optional(Type52.Integer({ minimum: 1, description: "Filter to a single owning VMID." }))
3208
+ },
3209
+ { additionalProperties: false }
3210
+ );
3211
+ var NAME46 = "proxmox_list_storage_content";
3212
+ function createProxmoxListStorageContentTool(getClient) {
3213
+ return {
3214
+ name: NAME46,
3215
+ label: "proxmox: list storage content",
3216
+ description: "List volumes on a storage (GET /nodes/{node}/storage/{storage}/content): ISOs, container templates, disk images, and backups, with size + owning vmid. Optionally filter by content type or vmid. Tier-1 read.",
3217
+ parameters: Schema49,
3218
+ execute: async (_id, raw) => {
3219
+ const args = validateToolArgs(
3220
+ Schema49,
3221
+ raw,
3222
+ NAME46
3223
+ );
3224
+ assertSafePathSegment(args.node, "node");
3225
+ assertSafePathSegment(args.storage, "storage");
3226
+ const params = new URLSearchParams();
3227
+ if (args.content) params.append("content", args.content);
3228
+ if (typeof args.vmid === "number") params.append("vmid", String(args.vmid));
3229
+ const qs = params.toString();
3230
+ const path2 = `/nodes/${args.node}/storage/${args.storage}/content${qs ? `?${qs}` : ""}`;
3231
+ const items = await getClient().get(path2);
3232
+ return jsonToolResult({ node: args.node, storage: args.storage, count: items.length, content: items });
3233
+ }
3234
+ };
3235
+ }
3236
+
3237
+ // src/tools/proxmox_download_url.ts
3238
+ import { Type as Type53 } from "@sinclair/typebox";
3239
+ var Schema50 = Type53.Object(
3240
+ {
3241
+ node: Type53.String({ minLength: 1, description: "Node to download onto." }),
3242
+ storage: Type53.String({ minLength: 1, description: "Target storage ID (must allow iso/vztmpl content)." }),
3243
+ content: Type53.Union([Type53.Literal("iso"), Type53.Literal("vztmpl")], {
3244
+ description: "Content type: 'iso' for an install image, 'vztmpl' for a container template."
3245
+ }),
3246
+ url: Type53.String({ minLength: 1, description: "HTTP(S) URL to download from." }),
3247
+ filename: Type53.String({ minLength: 1, description: "Destination filename on the storage." }),
3248
+ checksum: Type53.Optional(Type53.String({ minLength: 1, description: "Expected checksum of the download." })),
3249
+ checksum_algorithm: Type53.Optional(
3250
+ Type53.Union(
3251
+ [Type53.Literal("md5"), Type53.Literal("sha1"), Type53.Literal("sha256"), Type53.Literal("sha512")],
3252
+ { description: "Algorithm for the checksum." }
3253
+ )
3254
+ ),
3255
+ verify_certificates: Type53.Optional(
3256
+ Type53.Boolean({ description: "Verify the source server's TLS cert (default true)." })
3257
+ ),
3258
+ confirm: Type53.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." }),
3259
+ ...taskWaitFields
3260
+ },
3261
+ { additionalProperties: false }
3262
+ );
3263
+ var NAME47 = "proxmox_download_url";
3264
+ function createProxmoxDownloadUrlTool(getClient) {
3265
+ return {
3266
+ name: NAME47,
3267
+ label: "proxmox: download url",
3268
+ description: "Download an ISO or container template from a URL onto a storage (POST /nodes/{node}/storage/{storage}/download-url). Optional checksum verification. Tier-2 write; requires confirm:true.",
3269
+ parameters: Schema50,
3270
+ execute: async (_id, raw) => {
3271
+ assertConfirmedWrite(raw, NAME47);
3272
+ const args = validateToolArgs(Schema50, raw, NAME47);
3273
+ assertSafePathSegment(args.node, "node");
3274
+ assertSafePathSegment(args.storage, "storage");
3275
+ if (!/^https?:\/\//i.test(args.url)) {
3276
+ throw new ToolInputError(`${NAME47}: url must be http(s)`);
3277
+ }
3278
+ if (args.checksum && !args.checksum_algorithm) {
3279
+ throw new ToolInputError(`${NAME47}: checksum_algorithm is required when checksum is set`);
3280
+ }
3281
+ const body = {
3282
+ content: args.content,
3283
+ url: args.url,
3284
+ filename: args.filename
3285
+ };
3286
+ if (args.checksum) body.checksum = args.checksum;
3287
+ if (args.checksum_algorithm) body["checksum-algorithm"] = args.checksum_algorithm;
3288
+ if (args.verify_certificates === false) body["verify-certificates"] = 0;
3289
+ const client = getClient();
3290
+ const upid = await client.post(
3291
+ `/nodes/${args.node}/storage/${args.storage}/download-url`,
3292
+ body
3293
+ );
3294
+ const task = await resolveTaskWait(client, upid, args);
3295
+ return jsonToolResult({
3296
+ node: args.node,
3297
+ storage: args.storage,
3298
+ content: args.content,
3299
+ filename: args.filename,
3300
+ upid,
3301
+ ...task ? { task } : {}
3302
+ });
3303
+ }
3304
+ };
3305
+ }
3306
+
3307
+ // src/tools/proxmox_delete_volume.ts
3308
+ import { Type as Type54 } from "@sinclair/typebox";
3309
+ var VOLID_RE = /^[\w.-]+:[\w./-]+$/;
3310
+ var Schema51 = Type54.Object(
3311
+ {
3312
+ node: Type54.String({ minLength: 1, description: "Node the storage is on." }),
3313
+ storage: Type54.String({ minLength: 1, description: "Storage ID holding the volume." }),
3314
+ volume: Type54.String({
3315
+ minLength: 1,
3316
+ description: "Full volid to delete, e.g. 'local:backup/vzdump-lxc-100-...tar.zst'."
3317
+ }),
3318
+ confirm: Type54.Boolean({ description: "Must be true. Tier-3 destructive gate." }),
3319
+ destructive: Type54.Boolean({ description: "Must be true. Tier-3 destructive gate." })
3320
+ },
3321
+ { additionalProperties: false }
3322
+ );
3323
+ var NAME48 = "proxmox_delete_volume";
3324
+ function createProxmoxDeleteVolumeTool(getClient) {
3325
+ return {
3326
+ name: NAME48,
3327
+ label: "proxmox: delete volume",
3328
+ description: "Permanently delete a storage volume - a backup archive, ISO, template, or disk image (DELETE /nodes/{node}/storage/{storage}/content/{volume}). Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
3329
+ parameters: Schema51,
3330
+ execute: async (_id, raw) => {
3331
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME48);
3332
+ assertDestructive(raw, NAME48);
3333
+ const args = validateToolArgs(Schema51, raw, NAME48);
3334
+ assertSafePathSegment(args.node, "node");
3335
+ assertSafePathSegment(args.storage, "storage");
3336
+ if (args.volume.includes("..") || !VOLID_RE.test(args.volume)) {
3337
+ throw new ToolInputError(`${NAME48}: invalid volume id "${args.volume}"`);
3338
+ }
3339
+ const path2 = `/nodes/${args.node}/storage/${args.storage}/content/${encodeURIComponent(args.volume)}`;
3340
+ const upid = await getClient().delete(path2);
3341
+ return jsonToolResult({ node: args.node, storage: args.storage, volume: args.volume, upid: upid ?? null });
3342
+ }
3343
+ };
3344
+ }
3345
+
3346
+ // src/tools/proxmox_list_node_services.ts
3347
+ import { Type as Type55 } from "@sinclair/typebox";
3348
+ var Schema52 = Type55.Object(
3349
+ { node: Type55.String({ minLength: 1, description: "Node to inspect." }) },
3350
+ { additionalProperties: false }
3351
+ );
3352
+ var NAME49 = "proxmox_list_node_services";
3353
+ function createProxmoxListNodeServicesTool(getClient) {
3354
+ return {
3355
+ name: NAME49,
3356
+ label: "proxmox: list node services",
3357
+ description: "List the Proxmox host's systemd services and their state (GET /nodes/{node}/services): pveproxy, pvedaemon, pve-cluster, corosync, etc. Tier-1 read.",
3358
+ parameters: Schema52,
3359
+ execute: async (_id, raw) => {
3360
+ const args = validateToolArgs(Schema52, raw, NAME49);
3361
+ assertSafePathSegment(args.node, "node");
3362
+ const services = await getClient().get(`/nodes/${args.node}/services`);
3363
+ return jsonToolResult({ node: args.node, count: services.length, services });
3364
+ }
3365
+ };
3366
+ }
3367
+
3368
+ // src/tools/proxmox_list_updates.ts
3369
+ import { Type as Type56 } from "@sinclair/typebox";
3370
+ var Schema53 = Type56.Object(
3371
+ { node: Type56.String({ minLength: 1, description: "Node to check for pending package updates." }) },
3372
+ { additionalProperties: false }
3373
+ );
3374
+ var NAME50 = "proxmox_list_updates";
3375
+ function createProxmoxListUpdatesTool(getClient) {
3376
+ return {
3377
+ name: NAME50,
3378
+ label: "proxmox: list updates",
3379
+ description: "List pending APT package updates on a node (GET /nodes/{node}/apt/update): package, current and candidate versions. Read-only; does not refresh the index or install anything. Note: Proxmox gates this endpoint behind the Sys.Modify privilege, so an audit-only token gets 403. Tier-1 read.",
3380
+ parameters: Schema53,
3381
+ execute: async (_id, raw) => {
3382
+ const args = validateToolArgs(Schema53, raw, NAME50);
3383
+ assertSafePathSegment(args.node, "node");
3384
+ const updates = await getClient().get(`/nodes/${args.node}/apt/update`);
3385
+ return jsonToolResult({ node: args.node, count: updates.length, updates });
3386
+ }
3387
+ };
3388
+ }
3389
+
3390
+ // src/tools/proxmox_list_disks.ts
3391
+ import { Type as Type57 } from "@sinclair/typebox";
3392
+ var Schema54 = Type57.Object(
3393
+ {
3394
+ node: Type57.String({ minLength: 1, description: "Node whose physical disks to list." }),
3395
+ include_partitions: Type57.Optional(
3396
+ Type57.Boolean({ description: "Include partitions in the listing (default false)." })
3397
+ )
3398
+ },
3399
+ { additionalProperties: false }
3400
+ );
3401
+ var NAME51 = "proxmox_list_disks";
3402
+ function createProxmoxListDisksTool(getClient) {
3403
+ return {
3404
+ name: NAME51,
3405
+ label: "proxmox: list disks",
3406
+ description: "List a node's physical disks with model, size, type, SMART health and wearout (GET /nodes/{node}/disks/list). Tier-1 read.",
3407
+ parameters: Schema54,
3408
+ execute: async (_id, raw) => {
3409
+ const args = validateToolArgs(Schema54, raw, NAME51);
3410
+ assertSafePathSegment(args.node, "node");
3411
+ const qs = args.include_partitions ? "?include-partitions=1" : "";
3412
+ const disks = await getClient().get(`/nodes/${args.node}/disks/list${qs}`);
3413
+ return jsonToolResult({ node: args.node, count: disks.length, disks });
3414
+ }
3415
+ };
3416
+ }
3417
+
3418
+ // src/tools/proxmox_cancel_task.ts
3419
+ import { Type as Type58 } from "@sinclair/typebox";
3420
+ var Schema55 = Type58.Object(
3421
+ {
3422
+ upid: Type58.String({ minLength: 1, description: "UPID of the running task to stop." }),
3423
+ confirm: Type58.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3424
+ },
3425
+ { additionalProperties: false }
3426
+ );
3427
+ var NAME52 = "proxmox_cancel_task";
3428
+ function createProxmoxCancelTaskTool(getClient) {
3429
+ return {
3430
+ name: NAME52,
3431
+ label: "proxmox: cancel task",
3432
+ description: "Stop a running Proxmox task by UPID (DELETE /nodes/{node}/tasks/{upid}) - e.g. abort a stuck migration or backup. The node is parsed from the UPID. Tier-2 write; requires confirm:true.",
3433
+ parameters: Schema55,
3434
+ execute: async (_id, raw) => {
3435
+ assertConfirmedWrite(raw, NAME52);
3436
+ const args = validateToolArgs(Schema55, raw, NAME52);
3437
+ const { node } = parseTaskUpid(args.upid);
3438
+ await getClient().delete(`/nodes/${node}/tasks/${encodeURIComponent(args.upid)}`);
3439
+ return jsonToolResult({ upid: args.upid, node, stopped: true });
3440
+ }
3441
+ };
3442
+ }
3443
+
3444
+ // src/tools/proxmox_node_power.ts
3445
+ import { Type as Type59 } from "@sinclair/typebox";
3446
+ var Schema56 = Type59.Object(
3447
+ {
3448
+ node: Type59.String({ minLength: 1, description: "Node to power-cycle." }),
3449
+ command: Type59.Union([Type59.Literal("reboot"), Type59.Literal("shutdown")], {
3450
+ description: "'reboot' or 'shutdown' the physical/virtual host."
3451
+ }),
3452
+ confirm: Type59.Boolean({ description: "Must be true. Tier-3 destructive gate." }),
3453
+ destructive: Type59.Boolean({ description: "Must be true. Tier-3 destructive gate." })
3454
+ },
3455
+ { additionalProperties: false }
3456
+ );
3457
+ var NAME53 = "proxmox_node_power";
3458
+ function createProxmoxNodePowerTool(getClient) {
3459
+ return {
3460
+ name: NAME53,
3461
+ label: "proxmox: node power",
3462
+ description: "Reboot or shut down an entire Proxmox node (POST /nodes/{node}/status), which takes down every guest on it. Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
3463
+ parameters: Schema56,
3464
+ execute: async (_id, raw) => {
3465
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME53);
3466
+ assertDestructive(raw, NAME53);
3467
+ const args = validateToolArgs(Schema56, raw, NAME53);
3468
+ assertSafePathSegment(args.node, "node");
3469
+ await getClient().post(`/nodes/${args.node}/status`, { command: args.command });
3470
+ return jsonToolResult({ node: args.node, command: args.command, issued: true });
3471
+ }
3472
+ };
3473
+ }
3474
+
3475
+ // src/tools/proxmox_list_firewall_rules.ts
3476
+ import { Type as Type61 } from "@sinclair/typebox";
3477
+
3478
+ // src/tools/firewall-target.ts
3479
+ import { Type as Type60 } from "@sinclair/typebox";
3480
+ var firewallScopeFields = {
3481
+ scope: Type60.Union(
3482
+ [Type60.Literal("cluster"), Type60.Literal("node"), Type60.Literal("guest")],
3483
+ { description: "Firewall scope: 'cluster', 'node' (needs node), or 'guest' (needs vmid)." }
3484
+ ),
3485
+ node: Type60.Optional(Type60.String({ minLength: 1, description: "Node name (required when scope='node')." })),
3486
+ vmid: Type60.Optional(Type60.Integer({ minimum: 1, description: "Guest VMID (required when scope='guest')." }))
3487
+ };
3488
+ async function resolveFirewallBase(client, args, toolName) {
3489
+ if (args.scope === "cluster") {
3490
+ return { base: "/cluster/firewall", label: "cluster" };
3491
+ }
3492
+ if (args.scope === "node") {
3493
+ if (!args.node) throw new ToolInputError(`${toolName}: node is required when scope='node'`);
3494
+ assertSafePathSegment(args.node, "node");
3495
+ return { base: `/nodes/${args.node}/firewall`, label: `node ${args.node}` };
3496
+ }
3497
+ if (typeof args.vmid !== "number") {
3498
+ throw new ToolInputError(`${toolName}: vmid is required when scope='guest'`);
3499
+ }
3500
+ const { node, type } = await resolveResource(client, args.vmid);
3501
+ return { base: `/nodes/${node}/${type}/${args.vmid}/firewall`, label: `${type} ${args.vmid}` };
3502
+ }
3503
+
3504
+ // src/tools/proxmox_list_firewall_rules.ts
3505
+ var Schema57 = Type61.Object({ ...firewallScopeFields }, { additionalProperties: false });
3506
+ var NAME54 = "proxmox_list_firewall_rules";
3507
+ function createProxmoxListFirewallRulesTool(getClient) {
3508
+ return {
3509
+ name: NAME54,
3510
+ label: "proxmox: list firewall rules",
3511
+ description: "List firewall rules at the cluster, node, or guest scope (GET {base}/firewall/rules). Returns rule position, action, direction, and match fields. Tier-1 read.",
3512
+ parameters: Schema57,
3513
+ execute: async (_id, raw) => {
3514
+ const args = validateToolArgs(Schema57, raw, NAME54);
3515
+ const client = getClient();
3516
+ const { base, label } = await resolveFirewallBase(client, args, NAME54);
3517
+ const rules = await client.get(`${base}/rules`);
3518
+ return jsonToolResult({ scope: label, count: Array.isArray(rules) ? rules.length : 0, rules });
3519
+ }
3520
+ };
3521
+ }
3522
+
3523
+ // src/tools/proxmox_get_firewall_options.ts
3524
+ import { Type as Type62 } from "@sinclair/typebox";
3525
+ var Schema58 = Type62.Object({ ...firewallScopeFields }, { additionalProperties: false });
3526
+ var NAME55 = "proxmox_get_firewall_options";
3527
+ function createProxmoxGetFirewallOptionsTool(getClient) {
3528
+ return {
3529
+ name: NAME55,
3530
+ label: "proxmox: get firewall options",
3531
+ description: "Read firewall options at the cluster, node, or guest scope (GET {base}/firewall/options): whether the firewall is enabled, default in/out policy, logging. Tier-1 read.",
3532
+ parameters: Schema58,
3533
+ execute: async (_id, raw) => {
3534
+ const args = validateToolArgs(Schema58, raw, NAME55);
3535
+ const client = getClient();
3536
+ const { base, label } = await resolveFirewallBase(client, args, NAME55);
3537
+ const options = await client.get(`${base}/options`);
3538
+ return jsonToolResult({ scope: label, options });
3539
+ }
3540
+ };
3541
+ }
3542
+
3543
+ // src/tools/proxmox_add_firewall_rule.ts
3544
+ import { Type as Type63 } from "@sinclair/typebox";
3545
+ var Schema59 = Type63.Object(
3546
+ {
3547
+ ...firewallScopeFields,
3548
+ type: Type63.Union([Type63.Literal("in"), Type63.Literal("out"), Type63.Literal("group")], {
3549
+ description: "Rule direction: 'in', 'out', or 'group' (attach a security group)."
3550
+ }),
3551
+ action: Type63.String({
3552
+ minLength: 1,
3553
+ description: "ACCEPT, DROP, REJECT, or a security-group name when type='group'."
3554
+ }),
3555
+ source: Type63.Optional(Type63.String({ minLength: 1, description: "Source CIDR/IP/alias." })),
3556
+ dest: Type63.Optional(Type63.String({ minLength: 1, description: "Destination CIDR/IP/alias." })),
3557
+ proto: Type63.Optional(Type63.String({ minLength: 1, description: "Protocol, e.g. tcp, udp, icmp." })),
3558
+ dport: Type63.Optional(Type63.String({ minLength: 1, description: "Destination port(s), e.g. '22' or '8000:8100'." })),
3559
+ sport: Type63.Optional(Type63.String({ minLength: 1, description: "Source port(s)." })),
3560
+ macro: Type63.Optional(Type63.String({ minLength: 1, description: "Predefined macro, e.g. 'SSH', 'HTTP'." })),
3561
+ comment: Type63.Optional(Type63.String({ description: "Human-readable comment." })),
3562
+ enable: Type63.Optional(Type63.Boolean({ description: "Whether the rule is active (default true)." })),
3563
+ pos: Type63.Optional(Type63.Integer({ minimum: 0, description: "Insert position (default: prepend at 0)." })),
3564
+ confirm: Type63.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3565
+ },
3566
+ { additionalProperties: false }
3567
+ );
3568
+ var NAME56 = "proxmox_add_firewall_rule";
3569
+ function createProxmoxAddFirewallRuleTool(getClient) {
3570
+ return {
3571
+ name: NAME56,
3572
+ label: "proxmox: add firewall rule",
3573
+ description: "Add a firewall rule at the cluster, node, or guest scope (POST {base}/firewall/rules). Tier-2 write; requires confirm:true.",
3574
+ parameters: Schema59,
3575
+ execute: async (_id, raw) => {
3576
+ assertConfirmedWrite(raw, NAME56);
3577
+ const args = validateToolArgs(Schema59, raw, NAME56);
3578
+ const client = getClient();
3579
+ const { base, label } = await resolveFirewallBase(client, args, NAME56);
3580
+ const body = { type: args.type, action: args.action };
3581
+ for (const k of ["source", "dest", "proto", "dport", "sport", "macro", "comment"]) {
3582
+ const v = args[k];
3583
+ if (typeof v === "string" && v.length > 0) body[k] = v;
3584
+ }
3585
+ body.enable = args.enable === false ? 0 : 1;
3586
+ if (typeof args.pos === "number") body.pos = args.pos;
3587
+ await client.post(`${base}/rules`, body);
3588
+ return jsonToolResult({ scope: label, type: args.type, action: args.action, added: true });
3589
+ }
3590
+ };
3591
+ }
3592
+
3593
+ // src/tools/proxmox_delete_firewall_rule.ts
3594
+ import { Type as Type64 } from "@sinclair/typebox";
3595
+ var Schema60 = Type64.Object(
3596
+ {
3597
+ ...firewallScopeFields,
3598
+ pos: Type64.Integer({ minimum: 0, description: "Rule position/index to delete (see list_firewall_rules)." }),
3599
+ digest: Type64.Optional(
3600
+ Type64.String({ minLength: 1, description: "Ruleset digest for optimistic concurrency." })
3601
+ ),
3602
+ confirm: Type64.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3603
+ },
3604
+ { additionalProperties: false }
3605
+ );
3606
+ var NAME57 = "proxmox_delete_firewall_rule";
3607
+ function createProxmoxDeleteFirewallRuleTool(getClient) {
3608
+ return {
3609
+ name: NAME57,
3610
+ label: "proxmox: delete firewall rule",
3611
+ description: "Delete a firewall rule by position at the cluster, node, or guest scope (DELETE {base}/firewall/rules/{pos}). Tier-2 write; requires confirm:true.",
3612
+ parameters: Schema60,
3613
+ execute: async (_id, raw) => {
3614
+ assertConfirmedWrite(raw, NAME57);
3615
+ const args = validateToolArgs(Schema60, raw, NAME57);
3616
+ const client = getClient();
3617
+ const { base, label } = await resolveFirewallBase(client, args, NAME57);
3618
+ const qs = args.digest ? `?digest=${encodeURIComponent(args.digest)}` : "";
3619
+ await client.delete(`${base}/rules/${args.pos}${qs}`);
3620
+ return jsonToolResult({ scope: label, pos: args.pos, deleted: true });
3621
+ }
3622
+ };
3623
+ }
3624
+
3625
+ // src/tools/proxmox_set_firewall_enabled.ts
3626
+ import { Type as Type65 } from "@sinclair/typebox";
3627
+ var Schema61 = Type65.Object(
3628
+ {
3629
+ ...firewallScopeFields,
3630
+ enable: Type65.Boolean({ description: "Turn the firewall on (true) or off (false) for this scope." }),
3631
+ confirm: Type65.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3632
+ },
3633
+ { additionalProperties: false }
3634
+ );
3635
+ var NAME58 = "proxmox_set_firewall_enabled";
3636
+ function createProxmoxSetFirewallEnabledTool(getClient) {
3637
+ return {
3638
+ name: NAME58,
3639
+ label: "proxmox: set firewall enabled",
3640
+ description: "Enable or disable the firewall at the cluster, node, or guest scope (PUT {base}/firewall/options with enable). Note: the cluster-level switch gates all others. Tier-2 write; requires confirm:true.",
3641
+ parameters: Schema61,
3642
+ execute: async (_id, raw) => {
3643
+ assertConfirmedWrite(raw, NAME58);
3644
+ const args = validateToolArgs(Schema61, raw, NAME58);
3645
+ const client = getClient();
3646
+ const { base, label } = await resolveFirewallBase(client, args, NAME58);
3647
+ await client.put(`${base}/options`, { enable: args.enable ? 1 : 0 });
3648
+ return jsonToolResult({ scope: label, enabled: args.enable });
3649
+ }
3650
+ };
3651
+ }
3652
+
3653
+ // src/tools/proxmox_move_disk.ts
3654
+ import { Type as Type66 } from "@sinclair/typebox";
3655
+ var DISK_KEY_RE2 = /^[a-zA-Z][a-zA-Z0-9_]*$/;
3656
+ var Schema62 = Type66.Object(
3657
+ {
3658
+ vmid: Type66.Integer({ minimum: 1, description: "Container or VM ID." }),
3659
+ disk: Type66.String({
3660
+ minLength: 1,
3661
+ description: "Disk/volume key to move, e.g. 'scsi0' (QEMU) or 'rootfs'/'mp0' (LXC)."
3662
+ }),
3663
+ target_storage: Type66.String({ minLength: 1, description: "Target storage to move the disk onto." }),
3664
+ delete_source: Type66.Optional(
3665
+ Type66.Boolean({ description: "Delete the original disk after a successful move (default false)." })
3666
+ ),
3667
+ confirm: Type66.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." }),
3668
+ ...taskWaitFields
3669
+ },
3670
+ { additionalProperties: false }
3671
+ );
3672
+ var NAME59 = "proxmox_move_disk";
3673
+ function createProxmoxMoveDiskTool(getClient) {
3674
+ return {
3675
+ name: NAME59,
3676
+ label: "proxmox: move disk",
3677
+ description: "Relocate a VM disk (POST /nodes/{node}/qemu/{vmid}/move_disk) or container volume (POST /nodes/{node}/lxc/{vmid}/move_volume) to another storage. Optionally deletes the source after a successful copy. Tier-2 write; requires confirm:true.",
3678
+ parameters: Schema62,
3679
+ execute: async (_id, raw) => {
3680
+ assertConfirmedWrite(raw, NAME59);
3681
+ const args = validateToolArgs(Schema62, raw, NAME59);
3682
+ if (!DISK_KEY_RE2.test(args.disk)) {
3683
+ throw new Error(`${NAME59}: invalid disk key "${args.disk}"`);
3684
+ }
3685
+ assertSafePathSegment(args.target_storage, "target_storage");
3686
+ const client = getClient();
3687
+ const { node, type } = await resolveResource(client, args.vmid);
3688
+ const del = args.delete_source === true ? 1 : 0;
3689
+ let upid;
3690
+ if (type === "qemu") {
3691
+ upid = await client.post(`/nodes/${node}/qemu/${args.vmid}/move_disk`, {
3692
+ disk: args.disk,
3693
+ storage: args.target_storage,
3694
+ delete: del
3695
+ });
3696
+ } else {
3697
+ upid = await client.post(`/nodes/${node}/lxc/${args.vmid}/move_volume`, {
3698
+ volume: args.disk,
3699
+ storage: args.target_storage,
3700
+ delete: del
3701
+ });
3702
+ }
3703
+ const task = await resolveTaskWait(client, upid, args);
3704
+ return jsonToolResult({
3705
+ vmid: args.vmid,
3706
+ node,
3707
+ type,
3708
+ disk: args.disk,
3709
+ target_storage: args.target_storage,
3710
+ deleted_source: del === 1,
3711
+ upid,
3712
+ ...task ? { task } : {}
3713
+ });
3714
+ }
3715
+ };
3716
+ }
3717
+
3718
+ // src/tools/proxmox_list_storage_config.ts
3719
+ import { Type as Type67 } from "@sinclair/typebox";
3720
+ var Schema63 = Type67.Object({}, { additionalProperties: false });
3721
+ var NAME60 = "proxmox_list_storage_config";
3722
+ function createProxmoxListStorageConfigTool(getClient) {
3723
+ return {
3724
+ name: NAME60,
3725
+ label: "proxmox: list storage config",
3726
+ description: "List datacenter storage definitions (GET /storage): id, type, allowed content, node restrictions, shared/disabled flags. This is the cluster storage configuration, distinct from per-node status. Tier-1 read.",
3727
+ parameters: Schema63,
3728
+ execute: async () => {
3729
+ const defs = await getClient().get("/storage");
3730
+ return jsonToolResult({ count: defs.length, storage: defs });
3731
+ }
3732
+ };
3733
+ }
3734
+
3735
+ // src/tools/proxmox_create_storage.ts
3736
+ import { Type as Type68 } from "@sinclair/typebox";
3737
+ var OPT_KEY_RE = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
3738
+ var Schema64 = Type68.Object(
3739
+ {
3740
+ storage: Type68.String({ minLength: 1, description: "New storage ID." }),
3741
+ type: Type68.Union(
3742
+ [
3743
+ Type68.Literal("dir"),
3744
+ Type68.Literal("nfs"),
3745
+ Type68.Literal("cifs"),
3746
+ Type68.Literal("lvm"),
3747
+ Type68.Literal("lvmthin"),
3748
+ Type68.Literal("zfspool"),
3749
+ Type68.Literal("pbs"),
3750
+ Type68.Literal("cephfs"),
3751
+ Type68.Literal("rbd")
3752
+ ],
3753
+ { description: "Storage backend type." }
3754
+ ),
3755
+ content: Type68.Optional(
3756
+ Type68.String({ minLength: 1, description: "Comma-separated content types, e.g. 'images,rootdir' or 'iso,backup,vztmpl'." })
3757
+ ),
3758
+ options: Type68.Optional(
3759
+ Type68.Record(Type68.String(), Type68.Union([Type68.String(), Type68.Number(), Type68.Boolean()]), {
3760
+ description: 'Type-specific keys, e.g. {"path":"/mnt/data"} for dir, {"server":"1.2.3.4","export":"/nfs"} for nfs, {"vgname":"pve","thinpool":"data"} for lvmthin.'
3761
+ })
3762
+ ),
3763
+ nodes: Type68.Optional(Type68.String({ minLength: 1, description: "Restrict to these nodes (comma-separated)." })),
3764
+ disable: Type68.Optional(Type68.Boolean({ description: "Create the storage in a disabled state." })),
3765
+ confirm: Type68.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3766
+ },
3767
+ { additionalProperties: false }
3768
+ );
3769
+ var NAME61 = "proxmox_create_storage";
3770
+ function createProxmoxCreateStorageTool(getClient) {
3771
+ return {
3772
+ name: NAME61,
3773
+ label: "proxmox: create storage",
3774
+ description: "Define a new datacenter storage (POST /storage) of a given type with content types and type-specific keys via `options`. Tier-2 write; requires confirm:true.",
3775
+ parameters: Schema64,
3776
+ execute: async (_id, raw) => {
3777
+ assertConfirmedWrite(raw, NAME61);
3778
+ const args = validateToolArgs(Schema64, raw, NAME61);
3779
+ assertSafePathSegment(args.storage, "storage");
3780
+ const body = { storage: args.storage, type: args.type };
3781
+ if (args.content) body.content = args.content;
3782
+ if (args.nodes) body.nodes = args.nodes;
3783
+ if (args.disable) body.disable = 1;
3784
+ if (args.options) {
3785
+ for (const [k, v] of Object.entries(args.options)) {
3786
+ if (!OPT_KEY_RE.test(k)) throw new ToolInputError(`${NAME61}: invalid option key "${k}"`);
3787
+ body[k] = typeof v === "boolean" ? v ? 1 : 0 : v;
3788
+ }
3789
+ }
3790
+ await getClient().post(`/storage`, body);
3791
+ return jsonToolResult({ storage: args.storage, type: args.type, created: true });
3792
+ }
3793
+ };
3794
+ }
3795
+
3796
+ // src/tools/proxmox_delete_storage.ts
3797
+ import { Type as Type69 } from "@sinclair/typebox";
3798
+ var Schema65 = Type69.Object(
3799
+ {
3800
+ storage: Type69.String({ minLength: 1, description: "Storage ID to remove from the datacenter config." }),
3801
+ confirm: Type69.Boolean({ description: "Must be true. Tier-3 destructive gate." }),
3802
+ destructive: Type69.Boolean({ description: "Must be true. Tier-3 destructive gate." })
3803
+ },
3804
+ { additionalProperties: false }
3805
+ );
3806
+ var NAME62 = "proxmox_delete_storage";
3807
+ function createProxmoxDeleteStorageTool(getClient) {
3808
+ return {
3809
+ name: NAME62,
3810
+ label: "proxmox: delete storage",
3811
+ description: "Remove a storage definition from the datacenter config (DELETE /storage/{id}). Does not erase the underlying data, but detaches it from Proxmox. Tier-3 destructive; requires confirm:true, destructive:true, and env PROXMOX_ENABLE_DESTRUCTIVE=1.",
3812
+ parameters: Schema65,
3813
+ execute: async (_id, raw) => {
3814
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME62);
3815
+ assertDestructive(raw, NAME62);
3816
+ const args = validateToolArgs(Schema65, raw, NAME62);
3817
+ assertSafePathSegment(args.storage, "storage");
3818
+ await getClient().delete(`/storage/${args.storage}`);
3819
+ return jsonToolResult({ storage: args.storage, deleted: true });
3820
+ }
3821
+ };
3822
+ }
3823
+
3824
+ // src/tools/proxmox_list_backup_jobs.ts
3825
+ import { Type as Type70 } from "@sinclair/typebox";
3826
+ var Schema66 = Type70.Object({}, { additionalProperties: false });
3827
+ var NAME63 = "proxmox_list_backup_jobs";
3828
+ function createProxmoxListBackupJobsTool(getClient) {
3829
+ return {
3830
+ name: NAME63,
3831
+ label: "proxmox: list backup jobs",
3832
+ description: "List scheduled backup (vzdump) jobs (GET /cluster/backup): id, schedule, target storage, selection, and enabled state. Tier-1 read.",
3833
+ parameters: Schema66,
3834
+ execute: async () => {
3835
+ const jobs = await getClient().get("/cluster/backup");
3836
+ return jsonToolResult({ count: jobs.length, jobs });
3837
+ }
3838
+ };
3839
+ }
3840
+
3841
+ // src/tools/proxmox_create_backup_job.ts
3842
+ import { Type as Type71 } from "@sinclair/typebox";
3843
+ var Schema67 = Type71.Object(
3844
+ {
3845
+ schedule: Type71.String({ minLength: 1, description: "Systemd-calendar schedule, e.g. '02:00' or 'mon..fri 21:00'." }),
3846
+ storage: Type71.String({ minLength: 1, description: "Target storage for the backups." }),
3847
+ all: Type71.Optional(Type71.Boolean({ description: "Back up all guests. Mutually exclusive with vmid/pool." })),
3848
+ vmid: Type71.Optional(Type71.String({ minLength: 1, description: "Comma-separated VMIDs to back up." })),
3849
+ pool: Type71.Optional(Type71.String({ minLength: 1, description: "Back up all guests in this pool." })),
3850
+ mode: Type71.Optional(
3851
+ Type71.Union([Type71.Literal("snapshot"), Type71.Literal("suspend"), Type71.Literal("stop")], {
3852
+ description: "Backup mode (default snapshot)."
3853
+ })
3854
+ ),
3855
+ compress: Type71.Optional(
3856
+ Type71.Union([Type71.Literal("zstd"), Type71.Literal("gzip"), Type71.Literal("lzo"), Type71.Literal("0")], {
3857
+ description: "Compression (default zstd)."
3858
+ })
3859
+ ),
3860
+ enabled: Type71.Optional(Type71.Boolean({ description: "Whether the job is active (default true)." })),
3861
+ mailto: Type71.Optional(Type71.String({ minLength: 1, description: "Email address for notifications." })),
3862
+ comment: Type71.Optional(Type71.String({ description: "Job comment/description." })),
3863
+ confirm: Type71.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3864
+ },
3865
+ { additionalProperties: false }
3866
+ );
3867
+ var NAME64 = "proxmox_create_backup_job";
3868
+ function createProxmoxCreateBackupJobTool(getClient) {
3869
+ return {
3870
+ name: NAME64,
3871
+ label: "proxmox: create backup job",
3872
+ description: "Create a scheduled backup (vzdump) job (POST /cluster/backup). Specify a schedule + storage and a selection (all, vmid list, or pool). Tier-2 write; requires confirm:true.",
3873
+ parameters: Schema67,
3874
+ execute: async (_id, raw) => {
3875
+ assertConfirmedWrite(raw, NAME64);
3876
+ const args = validateToolArgs(Schema67, raw, NAME64);
3877
+ const selectors = [args.all ? "all" : null, args.vmid ? "vmid" : null, args.pool ? "pool" : null].filter(Boolean);
3878
+ if (selectors.length === 0) {
3879
+ throw new ToolInputError(`${NAME64}: provide exactly one selection - all, vmid, or pool.`);
3880
+ }
3881
+ if (selectors.length > 1) {
3882
+ throw new ToolInputError(`${NAME64}: selection is exclusive - pass only one of all/vmid/pool.`);
3883
+ }
3884
+ const body = {
3885
+ schedule: args.schedule,
3886
+ storage: args.storage,
3887
+ mode: args.mode ?? "snapshot",
3888
+ compress: args.compress ?? "zstd",
3889
+ enabled: args.enabled === false ? 0 : 1
3890
+ };
3891
+ if (args.all) body.all = 1;
3892
+ if (args.vmid) body.vmid = args.vmid;
3893
+ if (args.pool) body.pool = args.pool;
3894
+ if (args.mailto) body.mailto = args.mailto;
3895
+ if (typeof args.comment === "string" && args.comment.length > 0) body.comment = args.comment;
3896
+ await getClient().post(`/cluster/backup`, body);
3897
+ return jsonToolResult({ schedule: args.schedule, storage: args.storage, created: true });
3898
+ }
3899
+ };
3900
+ }
3901
+
3902
+ // src/tools/proxmox_delete_backup_job.ts
3903
+ import { Type as Type72 } from "@sinclair/typebox";
3904
+ var Schema68 = Type72.Object(
3905
+ {
3906
+ id: Type72.String({ minLength: 1, description: "Backup job ID (from proxmox_list_backup_jobs)." }),
3907
+ confirm: Type72.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
3908
+ },
3909
+ { additionalProperties: false }
3910
+ );
3911
+ var NAME65 = "proxmox_delete_backup_job";
3912
+ function createProxmoxDeleteBackupJobTool(getClient) {
3913
+ return {
3914
+ name: NAME65,
3915
+ label: "proxmox: delete backup job",
3916
+ description: "Delete a scheduled backup job by id (DELETE /cluster/backup/{id}). Removes the schedule only; existing backup archives are untouched. Tier-2 write; requires confirm:true.",
3917
+ parameters: Schema68,
3918
+ execute: async (_id, raw) => {
3919
+ assertConfirmedWrite(raw, NAME65);
3920
+ const args = validateToolArgs(Schema68, raw, NAME65);
3921
+ assertSafePathSegment(args.id, "id");
3922
+ await getClient().delete(`/cluster/backup/${args.id}`);
3923
+ return jsonToolResult({ id: args.id, deleted: true });
3924
+ }
3925
+ };
3926
+ }
3927
+
3928
+ // src/tools/proxmox_list_users.ts
3929
+ import { Type as Type73 } from "@sinclair/typebox";
3930
+ var Schema69 = Type73.Object({}, { additionalProperties: false });
3931
+ var NAME66 = "proxmox_list_users";
3932
+ function createProxmoxListUsersTool(getClient) {
3933
+ return {
3934
+ name: NAME66,
3935
+ label: "proxmox: list users",
3936
+ description: "List Proxmox access users (GET /access/users): userid, realm, enabled/expire state, comment. Tier-1 read.",
3937
+ parameters: Schema69,
3938
+ execute: async () => {
3939
+ const users = await getClient().get("/access/users");
3940
+ return jsonToolResult({ count: users.length, users });
3941
+ }
3942
+ };
3943
+ }
3944
+
3945
+ // src/tools/proxmox_list_roles.ts
3946
+ import { Type as Type74 } from "@sinclair/typebox";
3947
+ var Schema70 = Type74.Object({}, { additionalProperties: false });
3948
+ var NAME67 = "proxmox_list_roles";
3949
+ function createProxmoxListRolesTool(getClient) {
3950
+ return {
3951
+ name: NAME67,
3952
+ label: "proxmox: list roles",
3953
+ description: "List Proxmox roles and their privileges (GET /access/roles). Tier-1 read.",
3954
+ parameters: Schema70,
3955
+ execute: async () => {
3956
+ const roles = await getClient().get("/access/roles");
3957
+ return jsonToolResult({ count: roles.length, roles });
3958
+ }
3959
+ };
3960
+ }
3961
+
3962
+ // src/tools/proxmox_list_acl.ts
3963
+ import { Type as Type75 } from "@sinclair/typebox";
3964
+ var Schema71 = Type75.Object({}, { additionalProperties: false });
3965
+ var NAME68 = "proxmox_list_acl";
3966
+ function createProxmoxListAclTool(getClient) {
3967
+ return {
3968
+ name: NAME68,
3969
+ label: "proxmox: list ACL",
3970
+ description: "List access-control entries (GET /access/acl): which user/group/token holds which role on which path, and whether it propagates. Tier-1 read.",
3971
+ parameters: Schema71,
3972
+ execute: async () => {
3973
+ const acl = await getClient().get("/access/acl");
3974
+ return jsonToolResult({ count: acl.length, acl });
3975
+ }
3976
+ };
3977
+ }
3978
+
3979
+ // src/tools/proxmox_list_pools.ts
3980
+ import { Type as Type76 } from "@sinclair/typebox";
3981
+ var Schema72 = Type76.Object({}, { additionalProperties: false });
3982
+ var NAME69 = "proxmox_list_pools";
3983
+ function createProxmoxListPoolsTool(getClient) {
3984
+ return {
3985
+ name: NAME69,
3986
+ label: "proxmox: list pools",
3987
+ description: "List all resource pools (GET /pools) with their comments. Use proxmox_list_pool_resources for a pool's members. Tier-1 read.",
3988
+ parameters: Schema72,
3989
+ execute: async () => {
3990
+ const pools = await getClient().get("/pools");
3991
+ return jsonToolResult({ count: pools.length, pools });
3992
+ }
3993
+ };
3994
+ }
3995
+
3996
+ // src/tools/proxmox_list_tokens.ts
3997
+ import { Type as Type77 } from "@sinclair/typebox";
3998
+ var USERID_RE = /^[\w.+-]+@[\w.-]+$/;
3999
+ var Schema73 = Type77.Object(
4000
+ { userid: Type77.String({ minLength: 1, description: "User to list API tokens for, e.g. 'root@pam'." }) },
4001
+ { additionalProperties: false }
4002
+ );
4003
+ var NAME70 = "proxmox_list_tokens";
4004
+ function createProxmoxListTokensTool(getClient) {
4005
+ return {
4006
+ name: NAME70,
4007
+ label: "proxmox: list tokens",
4008
+ description: "List API tokens for a user (GET /access/users/{userid}/token). Secrets are never returned by Proxmox after creation. Tier-1 read.",
4009
+ parameters: Schema73,
4010
+ execute: async (_id, raw) => {
4011
+ const args = validateToolArgs(Schema73, raw, NAME70);
4012
+ if (!USERID_RE.test(args.userid)) throw new ToolInputError(`${NAME70}: invalid userid "${args.userid}"`);
4013
+ const tokens = await getClient().get(`/access/users/${encodeURIComponent(args.userid)}/token`);
4014
+ return jsonToolResult({ userid: args.userid, count: tokens.length, tokens });
4015
+ }
4016
+ };
4017
+ }
4018
+
4019
+ // src/tools/proxmox_set_acl.ts
4020
+ import { Type as Type78 } from "@sinclair/typebox";
4021
+ var ACL_PATH_RE = /^\/[\w./-]*$/;
4022
+ var ROLE_RE = /^[A-Za-z][\w.-]*$/;
4023
+ var UGID_RE = /^[\w.+-]+(@[\w.-]+)?(![\w.-]+)?$/;
4024
+ var Schema74 = Type78.Object(
4025
+ {
4026
+ path: Type78.String({ minLength: 1, description: "ACL path, e.g. '/vms/100', '/pool/team', '/storage/local', '/'." }),
4027
+ roles: Type78.String({ minLength: 1, description: "Role name(s), comma-separated, e.g. 'PVEVMAdmin'." }),
4028
+ userid: Type78.Optional(Type78.String({ minLength: 1, description: "User or token to grant, e.g. 'bob@pve' or 'bob@pve!ci'." })),
4029
+ group: Type78.Optional(Type78.String({ minLength: 1, description: "Group to grant." })),
4030
+ propagate: Type78.Optional(Type78.Boolean({ description: "Propagate to child paths (default true)." })),
4031
+ remove: Type78.Optional(Type78.Boolean({ description: "Remove the ACL instead of adding it." })),
4032
+ confirm: Type78.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4033
+ },
4034
+ { additionalProperties: false }
4035
+ );
4036
+ var NAME71 = "proxmox_set_acl";
4037
+ function createProxmoxSetAclTool(getClient) {
4038
+ return {
4039
+ name: NAME71,
4040
+ label: "proxmox: set ACL",
4041
+ description: "Grant or remove a role for a user/token or group on a path (PUT /access/acl). Set remove:true to revoke. Tier-2 write; requires confirm:true.",
4042
+ parameters: Schema74,
4043
+ execute: async (_id, raw) => {
4044
+ assertConfirmedWrite(raw, NAME71);
4045
+ const args = validateToolArgs(Schema74, raw, NAME71);
4046
+ if (!ACL_PATH_RE.test(args.path)) throw new ToolInputError(`${NAME71}: invalid path "${args.path}"`);
4047
+ for (const r of args.roles.split(",")) {
4048
+ if (!ROLE_RE.test(r.trim())) throw new ToolInputError(`${NAME71}: invalid role "${r}"`);
4049
+ }
4050
+ if (!args.userid && !args.group) {
4051
+ throw new ToolInputError(`${NAME71}: provide userid or group.`);
4052
+ }
4053
+ const body = { path: args.path, roles: args.roles };
4054
+ if (args.userid) {
4055
+ if (!UGID_RE.test(args.userid)) throw new ToolInputError(`${NAME71}: invalid userid "${args.userid}"`);
4056
+ if (args.userid.includes("!")) body.tokens = args.userid;
4057
+ else body.users = args.userid;
4058
+ }
4059
+ if (args.group) body.groups = args.group;
4060
+ body.propagate = args.propagate === false ? 0 : 1;
4061
+ if (args.remove === true) body.delete = 1;
4062
+ await getClient().put(`/access/acl`, body);
4063
+ return jsonToolResult({
4064
+ path: args.path,
4065
+ roles: args.roles,
4066
+ userid: args.userid,
4067
+ group: args.group,
4068
+ removed: args.remove === true
4069
+ });
4070
+ }
4071
+ };
4072
+ }
4073
+
4074
+ // src/tools/proxmox_create_token.ts
4075
+ import { Type as Type79 } from "@sinclair/typebox";
4076
+ var TOKENID_RE = /^[\w.-]+$/;
4077
+ var Schema75 = Type79.Object(
4078
+ {
4079
+ userid: Type79.String({ minLength: 1, description: "Owning user, e.g. 'automation@pve'." }),
4080
+ tokenid: Type79.String({ minLength: 1, description: "New token name (the part after '!')." }),
4081
+ comment: Type79.Optional(Type79.String({ description: "Token comment." })),
4082
+ privsep: Type79.Optional(
4083
+ Type79.Boolean({ description: "Privilege separation (default true): the token gets only ACLs granted to it directly." })
4084
+ ),
4085
+ expire: Type79.Optional(Type79.Integer({ minimum: 0, description: "Expiry as a Unix timestamp (0 = never)." })),
4086
+ confirm: Type79.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4087
+ },
4088
+ { additionalProperties: false }
4089
+ );
4090
+ var NAME72 = "proxmox_create_token";
4091
+ function createProxmoxCreateTokenTool(getClient) {
4092
+ return {
4093
+ name: NAME72,
4094
+ label: "proxmox: create token",
4095
+ description: "Create an API token for a user (POST /access/users/{userid}/token/{tokenid}). Returns the secret ONCE - it cannot be retrieved later. With privsep (default), grant it access separately via proxmox_set_acl. Tier-2 write; requires confirm:true.",
4096
+ parameters: Schema75,
4097
+ execute: async (_id, raw) => {
4098
+ assertConfirmedWrite(raw, NAME72);
4099
+ const args = validateToolArgs(Schema75, raw, NAME72);
4100
+ if (!USERID_RE.test(args.userid)) throw new ToolInputError(`${NAME72}: invalid userid "${args.userid}"`);
4101
+ if (!TOKENID_RE.test(args.tokenid)) throw new ToolInputError(`${NAME72}: invalid tokenid "${args.tokenid}"`);
4102
+ const body = { privsep: args.privsep === false ? 0 : 1 };
4103
+ if (typeof args.comment === "string" && args.comment.length > 0) body.comment = args.comment;
4104
+ if (typeof args.expire === "number") body.expire = args.expire;
4105
+ const res = await getClient().post(
4106
+ `/access/users/${encodeURIComponent(args.userid)}/token/${encodeURIComponent(args.tokenid)}`,
4107
+ body
4108
+ );
4109
+ return jsonToolResult({
4110
+ userid: args.userid,
4111
+ tokenid: args.tokenid,
4112
+ full_tokenid: res?.["full-tokenid"] ?? `${args.userid}!${args.tokenid}`,
4113
+ secret: res?.value ?? null,
4114
+ note: "Store the secret now; Proxmox will not show it again."
4115
+ });
4116
+ }
4117
+ };
4118
+ }
4119
+
4120
+ // src/tools/proxmox_delete_token.ts
4121
+ import { Type as Type80 } from "@sinclair/typebox";
4122
+ var TOKENID_RE2 = /^[\w.-]+$/;
4123
+ var Schema76 = Type80.Object(
4124
+ {
4125
+ userid: Type80.String({ minLength: 1, description: "Owning user, e.g. 'automation@pve'." }),
4126
+ tokenid: Type80.String({ minLength: 1, description: "Token name to revoke (the part after '!')." }),
4127
+ confirm: Type80.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4128
+ },
4129
+ { additionalProperties: false }
4130
+ );
4131
+ var NAME73 = "proxmox_delete_token";
4132
+ function createProxmoxDeleteTokenTool(getClient) {
4133
+ return {
4134
+ name: NAME73,
4135
+ label: "proxmox: delete token",
4136
+ description: "Revoke an API token (DELETE /access/users/{userid}/token/{tokenid}). Immediately invalidates the token. Tier-2 write; requires confirm:true.",
4137
+ parameters: Schema76,
4138
+ execute: async (_id, raw) => {
4139
+ assertConfirmedWrite(raw, NAME73);
4140
+ const args = validateToolArgs(Schema76, raw, NAME73);
4141
+ if (!USERID_RE.test(args.userid)) throw new ToolInputError(`${NAME73}: invalid userid "${args.userid}"`);
4142
+ if (!TOKENID_RE2.test(args.tokenid)) throw new ToolInputError(`${NAME73}: invalid tokenid "${args.tokenid}"`);
4143
+ await getClient().delete(
4144
+ `/access/users/${encodeURIComponent(args.userid)}/token/${encodeURIComponent(args.tokenid)}`
4145
+ );
4146
+ return jsonToolResult({ userid: args.userid, tokenid: args.tokenid, deleted: true });
4147
+ }
4148
+ };
4149
+ }
4150
+
4151
+ // src/tools/proxmox_create_pool.ts
4152
+ import { Type as Type81 } from "@sinclair/typebox";
4153
+ var Schema77 = Type81.Object(
4154
+ {
4155
+ poolid: Type81.String({ minLength: 1, description: "New pool ID." }),
4156
+ comment: Type81.Optional(Type81.String({ description: "Pool comment/description." })),
4157
+ confirm: Type81.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4158
+ },
4159
+ { additionalProperties: false }
4160
+ );
4161
+ var NAME74 = "proxmox_create_pool";
4162
+ function createProxmoxCreatePoolTool(getClient) {
4163
+ return {
4164
+ name: NAME74,
4165
+ label: "proxmox: create pool",
4166
+ description: "Create a resource pool (POST /pools). Add guests/storage to it with proxmox_update_pool. Tier-2 write; requires confirm:true.",
4167
+ parameters: Schema77,
4168
+ execute: async (_id, raw) => {
4169
+ assertConfirmedWrite(raw, NAME74);
4170
+ const args = validateToolArgs(Schema77, raw, NAME74);
4171
+ assertSafePathSegment(args.poolid, "poolid");
4172
+ const body = { poolid: args.poolid };
4173
+ if (typeof args.comment === "string" && args.comment.length > 0) body.comment = args.comment;
4174
+ await getClient().post(`/pools`, body);
4175
+ return jsonToolResult({ poolid: args.poolid, created: true });
4176
+ }
4177
+ };
4178
+ }
4179
+
4180
+ // src/tools/proxmox_update_pool.ts
4181
+ import { Type as Type82 } from "@sinclair/typebox";
4182
+ var VMID_LIST_RE = /^\d+(,\d+)*$/;
4183
+ var Schema78 = Type82.Object(
4184
+ {
4185
+ poolid: Type82.String({ minLength: 1, description: "Pool to modify." }),
4186
+ vms: Type82.Optional(Type82.String({ minLength: 1, description: "Comma-separated VMIDs to add (or remove with remove:true)." })),
4187
+ storage: Type82.Optional(Type82.String({ minLength: 1, description: "Comma-separated storage IDs to add/remove." })),
4188
+ comment: Type82.Optional(Type82.String({ description: "Update the pool comment." })),
4189
+ remove: Type82.Optional(Type82.Boolean({ description: "Remove the listed members instead of adding them." })),
4190
+ confirm: Type82.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4191
+ },
4192
+ { additionalProperties: false }
4193
+ );
4194
+ var NAME75 = "proxmox_update_pool";
4195
+ function createProxmoxUpdatePoolTool(getClient) {
4196
+ return {
4197
+ name: NAME75,
4198
+ label: "proxmox: update pool",
4199
+ description: "Add or remove guests/storage in a resource pool, or update its comment (PUT /pools/{poolid}). Set remove:true to detach the listed members. Tier-2 write; requires confirm:true.",
4200
+ parameters: Schema78,
4201
+ execute: async (_id, raw) => {
4202
+ assertConfirmedWrite(raw, NAME75);
4203
+ const args = validateToolArgs(Schema78, raw, NAME75);
4204
+ assertSafePathSegment(args.poolid, "poolid");
4205
+ if (args.vms && !VMID_LIST_RE.test(args.vms)) {
4206
+ throw new ToolInputError(`${NAME75}: vms must be a comma-separated list of numeric VMIDs`);
4207
+ }
4208
+ if (!args.vms && !args.storage && typeof args.comment !== "string") {
4209
+ throw new ToolInputError(`${NAME75}: provide vms, storage, or comment to change.`);
4210
+ }
4211
+ const body = {};
4212
+ if (args.vms) body.vms = args.vms;
4213
+ if (args.storage) body.storage = args.storage;
4214
+ if (typeof args.comment === "string") body.comment = args.comment;
4215
+ if (args.remove === true) body.delete = 1;
4216
+ await getClient().put(`/pools/${args.poolid}`, body);
4217
+ return jsonToolResult({
4218
+ poolid: args.poolid,
4219
+ vms: args.vms,
4220
+ storage: args.storage,
4221
+ removed: args.remove === true
4222
+ });
4223
+ }
4224
+ };
4225
+ }
4226
+
4227
+ // src/tools/proxmox_delete_pool.ts
4228
+ import { Type as Type83 } from "@sinclair/typebox";
4229
+ var Schema79 = Type83.Object(
4230
+ {
4231
+ poolid: Type83.String({ minLength: 1, description: "Pool to delete (must be empty)." }),
4232
+ confirm: Type83.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4233
+ },
4234
+ { additionalProperties: false }
4235
+ );
4236
+ var NAME76 = "proxmox_delete_pool";
4237
+ function createProxmoxDeletePoolTool(getClient) {
4238
+ return {
4239
+ name: NAME76,
4240
+ label: "proxmox: delete pool",
4241
+ description: "Delete a resource pool (DELETE /pools/{poolid}). Proxmox requires the pool to be empty first; guests/storage are not deleted, only the grouping. Tier-2 write; requires confirm:true.",
4242
+ parameters: Schema79,
4243
+ execute: async (_id, raw) => {
4244
+ assertConfirmedWrite(raw, NAME76);
4245
+ const args = validateToolArgs(Schema79, raw, NAME76);
4246
+ assertSafePathSegment(args.poolid, "poolid");
4247
+ await getClient().delete(`/pools/${args.poolid}`);
4248
+ return jsonToolResult({ poolid: args.poolid, deleted: true });
4249
+ }
4250
+ };
4251
+ }
4252
+
4253
+ // src/tools/proxmox_cluster_status.ts
4254
+ import { Type as Type84 } from "@sinclair/typebox";
4255
+ var Schema80 = Type84.Object({}, { additionalProperties: false });
4256
+ var NAME77 = "proxmox_cluster_status";
4257
+ function createProxmoxClusterStatusTool(getClient) {
4258
+ return {
4259
+ name: NAME77,
4260
+ label: "proxmox: cluster status",
4261
+ description: "Cluster membership + quorum: each node's id, IP, online state, and (on a cluster) the quorate flag. (GET /cluster/status). Tier-1 read.",
4262
+ parameters: Schema80,
4263
+ execute: async () => {
4264
+ const items = await getClient().get("/cluster/status");
4265
+ const list = Array.isArray(items) ? items : [items];
4266
+ return jsonToolResult({ count: list.length, nodes: list });
4267
+ }
4268
+ };
4269
+ }
4270
+
4271
+ // src/tools/proxmox_ha_status.ts
4272
+ import { Type as Type85 } from "@sinclair/typebox";
4273
+ var Schema81 = Type85.Object({}, { additionalProperties: false });
4274
+ var NAME78 = "proxmox_ha_status";
4275
+ function createProxmoxHaStatusTool(getClient) {
4276
+ return {
4277
+ name: NAME78,
4278
+ label: "proxmox: HA status",
4279
+ description: "Current HA manager status: quorum, fencing/CRM state, and per-resource HA state. (GET /cluster/ha/status/current). Tier-1 read.",
4280
+ parameters: Schema81,
4281
+ execute: async () => {
4282
+ const items = await getClient().get("/cluster/ha/status/current");
4283
+ const list = Array.isArray(items) ? items : [items];
4284
+ return jsonToolResult({ count: list.length, entries: list });
4285
+ }
4286
+ };
4287
+ }
4288
+
4289
+ // src/tools/proxmox_list_ha_resources.ts
4290
+ import { Type as Type86 } from "@sinclair/typebox";
4291
+ var Schema82 = Type86.Object({}, { additionalProperties: false });
4292
+ var NAME79 = "proxmox_list_ha_resources";
4293
+ function createProxmoxListHaResourcesTool(getClient) {
4294
+ return {
4295
+ name: NAME79,
4296
+ label: "proxmox: list HA resources",
4297
+ description: "HA-managed resources (sid, state, group/comment). (GET /cluster/ha/resources). Tier-1 read.",
4298
+ parameters: Schema82,
4299
+ execute: async () => {
4300
+ const items = await getClient().get("/cluster/ha/resources");
4301
+ const list = Array.isArray(items) ? items : [items];
4302
+ return jsonToolResult({ count: list.length, resources: list });
4303
+ }
4304
+ };
4305
+ }
4306
+
4307
+ // src/tools/proxmox_list_ha_rules.ts
4308
+ import { Type as Type87 } from "@sinclair/typebox";
4309
+ var Schema83 = Type87.Object({}, { additionalProperties: false });
4310
+ var NAME80 = "proxmox_list_ha_rules";
4311
+ function createProxmoxListHaRulesTool(getClient) {
4312
+ return {
4313
+ name: NAME80,
4314
+ label: "proxmox: list HA rules",
4315
+ description: "HA rules (PVE 9+ replacement for HA groups): node affinity and resource placement. (GET /cluster/ha/rules). Tier-1 read.",
4316
+ parameters: Schema83,
4317
+ execute: async () => {
4318
+ const items = await getClient().get("/cluster/ha/rules");
4319
+ const list = Array.isArray(items) ? items : [items];
4320
+ return jsonToolResult({ count: list.length, rules: list });
4321
+ }
4322
+ };
4323
+ }
4324
+
4325
+ // src/tools/proxmox_list_replication.ts
4326
+ import { Type as Type88 } from "@sinclair/typebox";
4327
+ var Schema84 = Type88.Object({}, { additionalProperties: false });
4328
+ var NAME81 = "proxmox_list_replication";
4329
+ function createProxmoxListReplicationTool(getClient) {
4330
+ return {
4331
+ name: NAME81,
4332
+ label: "proxmox: list replication",
4333
+ description: "Storage replication jobs (id, source guest, target node, schedule). (GET /cluster/replication). Tier-1 read.",
4334
+ parameters: Schema84,
4335
+ execute: async () => {
4336
+ const items = await getClient().get("/cluster/replication");
4337
+ const list = Array.isArray(items) ? items : [items];
4338
+ return jsonToolResult({ count: list.length, jobs: list });
4339
+ }
4340
+ };
4341
+ }
4342
+
4343
+ // src/tools/proxmox_list_sdn_zones.ts
4344
+ import { Type as Type89 } from "@sinclair/typebox";
4345
+ var Schema85 = Type89.Object({}, { additionalProperties: false });
4346
+ var NAME82 = "proxmox_list_sdn_zones";
4347
+ function createProxmoxListSdnZonesTool(getClient) {
4348
+ return {
4349
+ name: NAME82,
4350
+ label: "proxmox: list SDN zones",
4351
+ description: "Software-defined-networking zones. (GET /cluster/sdn/zones). Tier-1 read.",
4352
+ parameters: Schema85,
4353
+ execute: async () => {
4354
+ const items = await getClient().get("/cluster/sdn/zones");
4355
+ const list = Array.isArray(items) ? items : [items];
4356
+ return jsonToolResult({ count: list.length, zones: list });
4357
+ }
4358
+ };
4359
+ }
4360
+
4361
+ // src/tools/proxmox_list_sdn_vnets.ts
4362
+ import { Type as Type90 } from "@sinclair/typebox";
4363
+ var Schema86 = Type90.Object({}, { additionalProperties: false });
4364
+ var NAME83 = "proxmox_list_sdn_vnets";
4365
+ function createProxmoxListSdnVnetsTool(getClient) {
4366
+ return {
4367
+ name: NAME83,
4368
+ label: "proxmox: list SDN vnets",
4369
+ description: "Software-defined-networking virtual networks. (GET /cluster/sdn/vnets). Tier-1 read.",
4370
+ parameters: Schema86,
4371
+ execute: async () => {
4372
+ const items = await getClient().get("/cluster/sdn/vnets");
4373
+ const list = Array.isArray(items) ? items : [items];
4374
+ return jsonToolResult({ count: list.length, vnets: list });
4375
+ }
4376
+ };
4377
+ }
4378
+
4379
+ // src/tools/proxmox_list_metric_servers.ts
4380
+ import { Type as Type91 } from "@sinclair/typebox";
4381
+ var Schema87 = Type91.Object({}, { additionalProperties: false });
4382
+ var NAME84 = "proxmox_list_metric_servers";
4383
+ function createProxmoxListMetricServersTool(getClient) {
4384
+ return {
4385
+ name: NAME84,
4386
+ label: "proxmox: list metric servers",
4387
+ description: "External metrics servers (InfluxDB/Graphite) configured for the cluster. (GET /cluster/metrics/server). Tier-1 read.",
4388
+ parameters: Schema87,
4389
+ execute: async () => {
4390
+ const items = await getClient().get("/cluster/metrics/server");
4391
+ const list = Array.isArray(items) ? items : [items];
4392
+ return jsonToolResult({ count: list.length, servers: list });
4393
+ }
4394
+ };
4395
+ }
4396
+
4397
+ // src/tools/proxmox_get_cluster_options.ts
4398
+ import { Type as Type92 } from "@sinclair/typebox";
4399
+ var Schema88 = Type92.Object({}, { additionalProperties: false });
4400
+ var NAME85 = "proxmox_get_cluster_options";
4401
+ function createProxmoxGetClusterOptionsTool(getClient) {
4402
+ return {
4403
+ name: NAME85,
4404
+ label: "proxmox: get cluster options",
4405
+ description: "Read datacenter-wide options (GET /cluster/options): keyboard, MAC prefix, allowed tags, default migration settings, etc. Tier-1 read.",
4406
+ parameters: Schema88,
4407
+ execute: async () => {
4408
+ const options = await getClient().get("/cluster/options");
4409
+ return jsonToolResult({ options });
4410
+ }
4411
+ };
4412
+ }
4413
+
4414
+ // src/tools/proxmox_cluster_log.ts
4415
+ import { Type as Type93 } from "@sinclair/typebox";
4416
+ var Schema89 = Type93.Object(
4417
+ {
4418
+ max: Type93.Optional(
4419
+ Type93.Integer({ minimum: 1, maximum: 1e3, description: "Max number of recent log entries (default 50)." })
4420
+ )
4421
+ },
4422
+ { additionalProperties: false }
4423
+ );
4424
+ var NAME86 = "proxmox_cluster_log";
4425
+ function createProxmoxClusterLogTool(getClient) {
4426
+ return {
4427
+ name: NAME86,
4428
+ label: "proxmox: cluster log",
4429
+ description: "Read the recent cluster-wide log (GET /cluster/log): task start/end, auth, and daemon messages across all nodes. Tier-1 read.",
4430
+ parameters: Schema89,
4431
+ execute: async (_id, raw) => {
4432
+ const args = validateToolArgs(Schema89, raw, NAME86);
4433
+ const max = args.max ?? 50;
4434
+ const entries = await getClient().get(`/cluster/log?max=${max}`);
4435
+ return jsonToolResult({ count: Array.isArray(entries) ? entries.length : 0, entries });
4436
+ }
4437
+ };
4438
+ }
4439
+
4440
+ // src/tools/proxmox_add_ha_resource.ts
4441
+ import { Type as Type94 } from "@sinclair/typebox";
4442
+ var SID_RE = /^(vm|ct):\d+$/;
4443
+ var Schema90 = Type94.Object(
4444
+ {
4445
+ sid: Type94.String({ minLength: 1, description: "HA resource id, 'vm:<vmid>' or 'ct:<vmid>'." }),
4446
+ state: Type94.Optional(
4447
+ Type94.Union(
4448
+ [Type94.Literal("started"), Type94.Literal("stopped"), Type94.Literal("disabled"), Type94.Literal("ignored")],
4449
+ { description: "Requested HA state (default 'started')." }
4450
+ )
4451
+ ),
4452
+ comment: Type94.Optional(Type94.String({ description: "Comment." })),
4453
+ max_restart: Type94.Optional(Type94.Integer({ minimum: 0, description: "Max restart attempts on the same node." })),
4454
+ max_relocate: Type94.Optional(Type94.Integer({ minimum: 0, description: "Max relocation attempts to other nodes." })),
4455
+ confirm: Type94.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4456
+ },
4457
+ { additionalProperties: false }
4458
+ );
4459
+ var NAME87 = "proxmox_add_ha_resource";
4460
+ function createProxmoxAddHaResourceTool(getClient) {
4461
+ return {
4462
+ name: NAME87,
4463
+ label: "proxmox: add HA resource",
4464
+ description: "Place a VM or container under HA management (POST /cluster/ha/resources). Only meaningful on a quorate multi-node cluster. Tier-2 write; requires confirm:true.",
4465
+ parameters: Schema90,
4466
+ execute: async (_id, raw) => {
4467
+ assertConfirmedWrite(raw, NAME87);
4468
+ const args = validateToolArgs(Schema90, raw, NAME87);
4469
+ if (!SID_RE.test(args.sid)) throw new ToolInputError(`${NAME87}: sid must be 'vm:<vmid>' or 'ct:<vmid>'`);
4470
+ const body = { sid: args.sid, state: args.state ?? "started" };
4471
+ if (typeof args.comment === "string" && args.comment.length > 0) body.comment = args.comment;
4472
+ if (typeof args.max_restart === "number") body.max_restart = args.max_restart;
4473
+ if (typeof args.max_relocate === "number") body.max_relocate = args.max_relocate;
4474
+ await getClient().post(`/cluster/ha/resources`, body);
4475
+ return jsonToolResult({ sid: args.sid, state: args.state ?? "started", added: true });
4476
+ }
4477
+ };
4478
+ }
4479
+
4480
+ // src/tools/proxmox_delete_ha_resource.ts
4481
+ import { Type as Type95 } from "@sinclair/typebox";
4482
+ var SID_RE2 = /^(vm|ct):\d+$/;
4483
+ var Schema91 = Type95.Object(
4484
+ {
4485
+ sid: Type95.String({ minLength: 1, description: "HA resource id to remove, 'vm:<vmid>' or 'ct:<vmid>'." }),
4486
+ confirm: Type95.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4487
+ },
4488
+ { additionalProperties: false }
4489
+ );
4490
+ var NAME88 = "proxmox_delete_ha_resource";
4491
+ function createProxmoxDeleteHaResourceTool(getClient) {
4492
+ return {
4493
+ name: NAME88,
4494
+ label: "proxmox: delete HA resource",
4495
+ description: "Remove a VM or container from HA management (DELETE /cluster/ha/resources/{sid}). The guest keeps running; only HA management stops. Tier-2 write; requires confirm:true.",
4496
+ parameters: Schema91,
4497
+ execute: async (_id, raw) => {
4498
+ assertConfirmedWrite(raw, NAME88);
4499
+ const args = validateToolArgs(Schema91, raw, NAME88);
4500
+ if (!SID_RE2.test(args.sid)) throw new ToolInputError(`${NAME88}: sid must be 'vm:<vmid>' or 'ct:<vmid>'`);
4501
+ await getClient().delete(`/cluster/ha/resources/${encodeURIComponent(args.sid)}`);
4502
+ return jsonToolResult({ sid: args.sid, deleted: true });
4503
+ }
4504
+ };
4505
+ }
4506
+
4507
+ // src/tools/proxmox_create_replication.ts
4508
+ import { Type as Type96 } from "@sinclair/typebox";
4509
+ var Schema92 = Type96.Object(
4510
+ {
4511
+ vmid: Type96.Integer({ minimum: 1, description: "Guest to replicate." }),
4512
+ target: Type96.String({ minLength: 1, description: "Target node to replicate to (must differ from the source node)." }),
4513
+ job_number: Type96.Optional(Type96.Integer({ minimum: 0, description: "Job number, forming the id '<vmid>-<n>' (default 0)." })),
4514
+ schedule: Type96.Optional(Type96.String({ minLength: 1, description: "Replication schedule, e.g. '*/15' or '02:00' (default '*/15')." })),
4515
+ rate: Type96.Optional(Type96.Number({ minimum: 0, description: "Rate limit in MB/s (0 = unlimited)." })),
4516
+ comment: Type96.Optional(Type96.String({ description: "Comment." })),
4517
+ disable: Type96.Optional(Type96.Boolean({ description: "Create the job disabled." })),
4518
+ confirm: Type96.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4519
+ },
4520
+ { additionalProperties: false }
4521
+ );
4522
+ var NAME89 = "proxmox_create_replication";
4523
+ function createProxmoxCreateReplicationTool(getClient) {
4524
+ return {
4525
+ name: NAME89,
4526
+ label: "proxmox: create replication",
4527
+ description: "Create a storage replication job for a guest to another node (POST /cluster/replication). Requires a multi-node cluster with a different target node. Tier-2 write; requires confirm:true.",
4528
+ parameters: Schema92,
4529
+ execute: async (_id, raw) => {
4530
+ assertConfirmedWrite(raw, NAME89);
4531
+ const args = validateToolArgs(Schema92, raw, NAME89);
4532
+ assertSafePathSegment(args.target, "target");
4533
+ const client = getClient();
4534
+ const { node } = await resolveResource(client, args.vmid);
4535
+ if (args.target === node) {
4536
+ throw new Error(`replication target ${args.target} must differ from the guest's node ${node}.`);
4537
+ }
4538
+ const id = `${args.vmid}-${args.job_number ?? 0}`;
4539
+ const body = {
4540
+ id,
4541
+ type: "local",
4542
+ target: args.target,
4543
+ schedule: args.schedule ?? "*/15"
4544
+ };
4545
+ if (typeof args.rate === "number") body.rate = args.rate;
4546
+ if (typeof args.comment === "string" && args.comment.length > 0) body.comment = args.comment;
4547
+ if (args.disable) body.disable = 1;
4548
+ await client.post(`/cluster/replication`, body);
4549
+ return jsonToolResult({ id, vmid: args.vmid, node, target: args.target, created: true });
4550
+ }
4551
+ };
4552
+ }
4553
+
4554
+ // src/tools/proxmox_delete_replication.ts
4555
+ import { Type as Type97 } from "@sinclair/typebox";
4556
+ var REPL_ID_RE = /^\d+-\d+$/;
4557
+ var Schema93 = Type97.Object(
4558
+ {
4559
+ id: Type97.String({ minLength: 1, description: "Replication job id, '<vmid>-<n>' (from proxmox_list_replication)." }),
4560
+ force: Type97.Optional(Type97.Boolean({ description: "Force removal even if the target is unreachable." })),
4561
+ confirm: Type97.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
4562
+ },
4563
+ { additionalProperties: false }
4564
+ );
4565
+ var NAME90 = "proxmox_delete_replication";
4566
+ function createProxmoxDeleteReplicationTool(getClient) {
4567
+ return {
4568
+ name: NAME90,
4569
+ label: "proxmox: delete replication",
4570
+ description: "Delete a storage replication job (DELETE /cluster/replication/{id}). Tier-2 write; requires confirm:true.",
4571
+ parameters: Schema93,
4572
+ execute: async (_id, raw) => {
4573
+ assertConfirmedWrite(raw, NAME90);
4574
+ const args = validateToolArgs(Schema93, raw, NAME90);
4575
+ if (!REPL_ID_RE.test(args.id)) throw new ToolInputError(`${NAME90}: id must be '<vmid>-<n>'`);
4576
+ const qs = args.force ? "?force=1" : "";
4577
+ await getClient().delete(`/cluster/replication/${args.id}${qs}`);
4578
+ return jsonToolResult({ id: args.id, deleted: true });
4579
+ }
4580
+ };
4581
+ }
4582
+
4583
+ // index.ts
4584
+ function withRedactedErrors(tool) {
4585
+ const orig = tool.execute.bind(tool);
4586
+ return {
4587
+ ...tool,
4588
+ execute: async (id, args) => {
4589
+ try {
4590
+ return await orig(id, args);
4591
+ } catch (e) {
4592
+ const msg = redact(e.message);
4593
+ return { content: [{ type: "text", text: JSON.stringify({ error: msg }) }], isError: true };
4594
+ }
4595
+ }
4596
+ };
4597
+ }
4598
+ function makeFactory(cfg) {
4599
+ registerSecret(cfg.tokenId);
4600
+ registerSecret(cfg.tokenSecret);
4601
+ registerSecret(`PVEAPIToken=${cfg.tokenId}=${cfg.tokenSecret}`);
4602
+ return () => new ProxmoxClient(cfg);
4603
+ }
4604
+ var index_default = definePluginEntry({
4605
+ id: "proxmox",
4606
+ name: "Proxmox",
4607
+ description: "Proxmox VE control: status, container + VM lifecycle, snapshots, backups, recent tasks. Single-cluster, token auth, optional TLS-insecure. Tier-2 writes gated by confirm:true.",
4608
+ register(api) {
4609
+ if (api.registrationMode !== "full") return;
4610
+ const cfg = resolveConfig(process.env);
4611
+ const getClient = makeFactory(cfg);
4612
+ const hostCfg = { host: cfg.ssh.host, port: cfg.ssh.port, user: cfg.ssh.user, keyPath: cfg.ssh.keyPath };
4613
+ const getSsh = () => ({
4614
+ execInLxc: (vmid, command, timeoutMs, stdin) => execInLxc(hostCfg, vmid, command, timeoutMs, stdin),
4615
+ execViaDirectSsh: (target, command, timeoutMs, stdin) => execViaDirectSsh(target, command, timeoutMs, stdin)
4616
+ });
4617
+ const vmDefaults = { vmUser: cfg.ssh.vmUser, vmKeyPath: cfg.ssh.vmKeyPath };
4618
+ const register = (t) => api.registerTool(withRedactedErrors(t));
4619
+ register(createProxmoxStatusTool(getClient));
4620
+ register(createProxmoxListContainersTool(getClient));
4621
+ register(createProxmoxListVmsTool(getClient));
4622
+ register(createProxmoxGetResourceTool(getClient));
4623
+ register(createProxmoxGetVmConfigTool(getClient));
4624
+ register(createProxmoxGetContainerConfigTool(getClient));
4625
+ register(createProxmoxValidateQemuSmokeSourceTool(getClient));
4626
+ register(createProxmoxAuditPermissionsTool(getClient));
4627
+ register(createProxmoxRecentTasksTool(getClient));
4628
+ register(createProxmoxListBackupsTool(getClient));
1153
4629
  register(createProxmoxResourceUsageTool(getClient));
4630
+ register(createProxmoxListTemplatesTool(getClient));
4631
+ register(createProxmoxListStorageTool(getClient));
4632
+ register(createProxmoxListSnapshotsTool(getClient));
4633
+ register(createProxmoxGuestNetworkTool(getClient));
4634
+ register(createProxmoxWaitTaskTool(getClient));
4635
+ register(createProxmoxNextVmidTool(getClient));
4636
+ register(createProxmoxListPoolResourcesTool(getClient));
4637
+ register(createProxmoxGetTaskStatusTool(getClient));
4638
+ register(createProxmoxGetTaskLogTool(getClient));
4639
+ register(createProxmoxListStorageContentTool(getClient));
4640
+ register(createProxmoxListNodeServicesTool(getClient));
4641
+ register(createProxmoxListUpdatesTool(getClient));
4642
+ register(createProxmoxListDisksTool(getClient));
4643
+ register(createProxmoxListFirewallRulesTool(getClient));
4644
+ register(createProxmoxGetFirewallOptionsTool(getClient));
4645
+ register(createProxmoxListStorageConfigTool(getClient));
4646
+ register(createProxmoxListBackupJobsTool(getClient));
4647
+ register(createProxmoxListUsersTool(getClient));
4648
+ register(createProxmoxListRolesTool(getClient));
4649
+ register(createProxmoxListAclTool(getClient));
4650
+ register(createProxmoxListPoolsTool(getClient));
4651
+ register(createProxmoxListTokensTool(getClient));
4652
+ register(createProxmoxClusterStatusTool(getClient));
4653
+ register(createProxmoxHaStatusTool(getClient));
4654
+ register(createProxmoxListHaResourcesTool(getClient));
4655
+ register(createProxmoxListHaRulesTool(getClient));
4656
+ register(createProxmoxListReplicationTool(getClient));
4657
+ register(createProxmoxListSdnZonesTool(getClient));
4658
+ register(createProxmoxListSdnVnetsTool(getClient));
4659
+ register(createProxmoxListMetricServersTool(getClient));
4660
+ register(createProxmoxGetClusterOptionsTool(getClient));
4661
+ register(createProxmoxClusterLogTool(getClient));
1154
4662
  register(createProxmoxStartResourceTool(getClient));
1155
4663
  register(createProxmoxStopResourceTool(getClient));
1156
4664
  register(createProxmoxRebootResourceTool(getClient));
4665
+ register(createProxmoxSuspendResourceTool(getClient));
4666
+ register(createProxmoxResumeResourceTool(getClient));
4667
+ register(createProxmoxResetResourceTool(getClient));
1157
4668
  register(createProxmoxSnapshotResourceTool(getClient));
1158
4669
  register(createProxmoxRunBackupTool(getClient));
1159
- register(createProxmoxGetTaskStatusTool(getClient));
1160
- register(createProxmoxGetTaskLogTool(getClient));
1161
- register(createProxmoxListTemplatesTool(getClient));
1162
4670
  register(createProxmoxCreateContainerTool(getClient));
1163
4671
  register(createProxmoxCreateVmTool(getClient));
1164
4672
  register(createProxmoxCloneResourceTool(getClient));
4673
+ register(createProxmoxConvertToTemplateTool(getClient));
4674
+ register(createProxmoxUpdateVmConfigTool(getClient));
4675
+ register(createProxmoxUpdateContainerConfigTool(getClient));
4676
+ register(createProxmoxResizeDiskTool(getClient));
4677
+ register(createProxmoxRestoreBackupTool(getClient));
4678
+ register(createProxmoxMigrateResourceTool(getClient));
4679
+ register(createProxmoxMoveDiskTool(getClient));
4680
+ register(createProxmoxCreateStorageTool(getClient));
4681
+ register(createProxmoxCreateBackupJobTool(getClient));
4682
+ register(createProxmoxDeleteBackupJobTool(getClient));
4683
+ register(createProxmoxSetAclTool(getClient));
4684
+ register(createProxmoxCreateTokenTool(getClient));
4685
+ register(createProxmoxDeleteTokenTool(getClient));
4686
+ register(createProxmoxCreatePoolTool(getClient));
4687
+ register(createProxmoxUpdatePoolTool(getClient));
4688
+ register(createProxmoxDeletePoolTool(getClient));
4689
+ register(createProxmoxAddHaResourceTool(getClient));
4690
+ register(createProxmoxDeleteHaResourceTool(getClient));
4691
+ register(createProxmoxCreateReplicationTool(getClient));
4692
+ register(createProxmoxDeleteReplicationTool(getClient));
4693
+ register(createProxmoxDownloadUrlTool(getClient));
4694
+ register(createProxmoxCancelTaskTool(getClient));
4695
+ register(createProxmoxAddFirewallRuleTool(getClient));
4696
+ register(createProxmoxDeleteFirewallRuleTool(getClient));
4697
+ register(createProxmoxSetFirewallEnabledTool(getClient));
4698
+ register(createProxmoxExecTool(getClient, getSsh, vmDefaults));
4699
+ register(createProxmoxReadFileTool(getClient, getSsh, vmDefaults));
4700
+ register(createProxmoxWriteFileTool(getClient, getSsh, vmDefaults));
4701
+ register(createProxmoxStatPathTool(getClient, getSsh, vmDefaults));
4702
+ register(createProxmoxListDirectoryTool(getClient, getSsh, vmDefaults));
4703
+ register(createProxmoxServiceStatusTool(getClient, getSsh, vmDefaults));
4704
+ register(createProxmoxServiceStartTool(getClient, getSsh, vmDefaults));
4705
+ register(createProxmoxServiceStopTool(getClient, getSsh, vmDefaults));
4706
+ register(createProxmoxServiceRestartTool(getClient, getSsh, vmDefaults));
4707
+ register(createProxmoxRollbackSnapshotTool(getClient));
1165
4708
  register(createProxmoxDestroyResourceTool(getClient));
4709
+ register(createProxmoxCleanupSmokeResourcesTool(getClient));
1166
4710
  register(createProxmoxDeleteSnapshotTool(getClient));
1167
4711
  register(createProxmoxForceStopResourceTool(getClient));
4712
+ register(createProxmoxDeleteVolumeTool(getClient));
4713
+ register(createProxmoxNodePowerTool(getClient));
4714
+ register(createProxmoxDeleteStorageTool(getClient));
1168
4715
  }
1169
4716
  });
1170
4717
  export {