@solomonneas/proxmox-mcp 0.2.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +313 -38
- package/dist/cli.js +3060 -0
- package/dist/index.js +1024 -117
- package/dist/mcp-bin.js +2735 -0
- package/dist/mcp-server.js +2203 -191
- package/openclaw.plugin.json +1 -1
- package/package.json +44 -11
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,16 +28,29 @@ 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:
|
|
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 {
|
|
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}`);
|
|
@@ -50,25 +70,23 @@ var ProxmoxClient = class {
|
|
|
50
70
|
this.cfg = cfg;
|
|
51
71
|
this.authHeader = `PVEAPIToken=${cfg.tokenId}=${cfg.tokenSecret}`;
|
|
52
72
|
this.retryDelayMs = opts.retryDelayMs ?? 1e3;
|
|
53
|
-
|
|
54
|
-
this.dispatcher = new UndiciAgent({ connect: { rejectUnauthorized: false } });
|
|
55
|
-
}
|
|
73
|
+
this.usesInsecureTls = cfg.tlsInsecure && cfg.url.startsWith("https://");
|
|
56
74
|
}
|
|
57
75
|
cfg;
|
|
58
76
|
authHeader;
|
|
59
77
|
retryDelayMs;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
dispatcher;
|
|
64
|
-
async get(path) {
|
|
65
|
-
return this.request("GET", path);
|
|
78
|
+
usesInsecureTls;
|
|
79
|
+
async get(path2) {
|
|
80
|
+
return this.request("GET", path2);
|
|
66
81
|
}
|
|
67
|
-
async post(
|
|
68
|
-
return this.request("POST",
|
|
82
|
+
async post(path2, body) {
|
|
83
|
+
return this.request("POST", path2, body);
|
|
69
84
|
}
|
|
70
|
-
async
|
|
71
|
-
|
|
85
|
+
async delete(path2) {
|
|
86
|
+
return this.request("DELETE", path2);
|
|
87
|
+
}
|
|
88
|
+
async request(method, path2, body) {
|
|
89
|
+
const url = this.cfg.url + "/api2/json" + path2;
|
|
72
90
|
const headers = { authorization: this.authHeader };
|
|
73
91
|
let bodyStr;
|
|
74
92
|
if (body !== void 0) {
|
|
@@ -88,16 +106,14 @@ var ProxmoxClient = class {
|
|
|
88
106
|
let lastErr;
|
|
89
107
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
90
108
|
try {
|
|
91
|
-
const
|
|
92
|
-
if (this.dispatcher) init.dispatcher = this.dispatcher;
|
|
93
|
-
const res = await fetch(url, init);
|
|
109
|
+
const res = await this.fetchUrl(url, method, headers, bodyStr);
|
|
94
110
|
if (res.status >= 200 && res.status < 300) {
|
|
95
111
|
const text = await res.text();
|
|
96
112
|
if (!text) return void 0;
|
|
97
113
|
const parsed = JSON.parse(text);
|
|
98
114
|
return parsed && typeof parsed === "object" && "data" in parsed ? parsed.data : parsed;
|
|
99
115
|
}
|
|
100
|
-
if (res.status
|
|
116
|
+
if ([502, 503, 504].includes(res.status)) {
|
|
101
117
|
lastErr = new ProxmoxUnreachableError(`HTTP ${res.status}`);
|
|
102
118
|
if (attempt === 0) await sleep(this.retryDelayMs);
|
|
103
119
|
continue;
|
|
@@ -117,10 +133,43 @@ var ProxmoxClient = class {
|
|
|
117
133
|
}
|
|
118
134
|
throw lastErr ?? new ProxmoxUnreachableError("unknown");
|
|
119
135
|
}
|
|
136
|
+
async fetchUrl(url, method, headers, body) {
|
|
137
|
+
if (!this.usesInsecureTls) {
|
|
138
|
+
return fetch(url, { method, headers, body });
|
|
139
|
+
}
|
|
140
|
+
return nodeRequest(url, method, headers, body, false);
|
|
141
|
+
}
|
|
120
142
|
};
|
|
121
143
|
function sleep(ms) {
|
|
122
144
|
return new Promise((r) => setTimeout(r, ms));
|
|
123
145
|
}
|
|
146
|
+
function nodeRequest(url, method, headers, body, rejectUnauthorized) {
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
const parsed = new URL(url);
|
|
149
|
+
const requestHeaders = { ...headers };
|
|
150
|
+
if (body !== void 0 && requestHeaders["content-length"] === void 0) {
|
|
151
|
+
requestHeaders["content-length"] = String(Buffer.byteLength(body, "utf8"));
|
|
152
|
+
}
|
|
153
|
+
const req = httpsRequest(
|
|
154
|
+
parsed,
|
|
155
|
+
{ method, headers: requestHeaders, rejectUnauthorized },
|
|
156
|
+
(res) => {
|
|
157
|
+
const chunks = [];
|
|
158
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
159
|
+
res.on("end", () => {
|
|
160
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
161
|
+
resolve({
|
|
162
|
+
status: res.statusCode ?? 0,
|
|
163
|
+
text: async () => text
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
req.on("error", reject);
|
|
169
|
+
if (body !== void 0) req.write(body);
|
|
170
|
+
req.end();
|
|
171
|
+
});
|
|
172
|
+
}
|
|
124
173
|
|
|
125
174
|
// src/security.ts
|
|
126
175
|
var SECRETS = /* @__PURE__ */ new Set();
|
|
@@ -160,11 +209,34 @@ function redact(value) {
|
|
|
160
209
|
import { Type } from "@sinclair/typebox";
|
|
161
210
|
|
|
162
211
|
// src/tools/_util.ts
|
|
212
|
+
import { Value } from "@sinclair/typebox/value";
|
|
163
213
|
function jsonToolResult(payload) {
|
|
164
214
|
return {
|
|
165
215
|
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }]
|
|
166
216
|
};
|
|
167
217
|
}
|
|
218
|
+
var ToolInputError = class extends Error {
|
|
219
|
+
constructor(message) {
|
|
220
|
+
super(message);
|
|
221
|
+
this.name = "ToolInputError";
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
function validateToolArgs(schema, raw, toolName) {
|
|
225
|
+
if (Value.Check(schema, raw)) return raw;
|
|
226
|
+
const first = [...Value.Errors(schema, raw)][0];
|
|
227
|
+
const where = first?.path ? ` at ${first.path}` : "";
|
|
228
|
+
const message = first?.message ?? "input does not match schema";
|
|
229
|
+
throw new ToolInputError(`${toolName} invalid input${where}: ${message}`);
|
|
230
|
+
}
|
|
231
|
+
var SAFE_SEGMENT_RE = /^[\w.-]+$/;
|
|
232
|
+
function assertSafePathSegment(value, label) {
|
|
233
|
+
if (!SAFE_SEGMENT_RE.test(value)) {
|
|
234
|
+
throw new ToolInputError(
|
|
235
|
+
`invalid ${label} "${value}": expected only letters, digits, '_', '.', or '-'`
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
return value;
|
|
239
|
+
}
|
|
168
240
|
async function resolveResource(client, vmid) {
|
|
169
241
|
const resources = await client.get(
|
|
170
242
|
"/cluster/resources"
|
|
@@ -247,6 +319,7 @@ function createProxmoxListVmsTool(getClient) {
|
|
|
247
319
|
|
|
248
320
|
// src/tools/proxmox_get_resource.ts
|
|
249
321
|
import { Type as Type4 } from "@sinclair/typebox";
|
|
322
|
+
var NAME = "proxmox_get_resource";
|
|
250
323
|
var Schema4 = Type4.Object(
|
|
251
324
|
{
|
|
252
325
|
vmid: Type4.Integer({ minimum: 1, description: "Container or VM ID." })
|
|
@@ -255,12 +328,12 @@ var Schema4 = Type4.Object(
|
|
|
255
328
|
);
|
|
256
329
|
function createProxmoxGetResourceTool(getClient) {
|
|
257
330
|
return {
|
|
258
|
-
name:
|
|
331
|
+
name: NAME,
|
|
259
332
|
label: "proxmox: get resource",
|
|
260
333
|
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).",
|
|
261
334
|
parameters: Schema4,
|
|
262
335
|
execute: async (_id, raw) => {
|
|
263
|
-
const args = raw;
|
|
336
|
+
const args = validateToolArgs(Schema4, raw, NAME);
|
|
264
337
|
const client = getClient();
|
|
265
338
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
266
339
|
const status = await client.get(
|
|
@@ -271,27 +344,93 @@ function createProxmoxGetResourceTool(getClient) {
|
|
|
271
344
|
};
|
|
272
345
|
}
|
|
273
346
|
|
|
274
|
-
// src/tools/
|
|
347
|
+
// src/tools/proxmox_get_vm_config.ts
|
|
275
348
|
import { Type as Type5 } from "@sinclair/typebox";
|
|
276
349
|
var Schema5 = Type5.Object(
|
|
277
350
|
{
|
|
278
|
-
|
|
279
|
-
|
|
351
|
+
vmid: Type5.Integer({ minimum: 1, description: "QEMU VM ID." })
|
|
352
|
+
},
|
|
353
|
+
{ additionalProperties: false }
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
// src/tools/proxmox_get_container_config.ts
|
|
357
|
+
import { Type as Type6 } from "@sinclair/typebox";
|
|
358
|
+
var Schema6 = Type6.Object(
|
|
359
|
+
{
|
|
360
|
+
vmid: Type6.Integer({ minimum: 1, description: "LXC container ID." })
|
|
361
|
+
},
|
|
362
|
+
{ additionalProperties: false }
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
// src/tools/proxmox_validate_qemu_smoke_source.ts
|
|
366
|
+
import { Type as Type7 } from "@sinclair/typebox";
|
|
367
|
+
var Schema7 = Type7.Object(
|
|
368
|
+
{
|
|
369
|
+
vmid: Type7.Integer({ minimum: 1, description: "QEMU VM ID to validate as a smoke clone source." }),
|
|
370
|
+
max_disk_gb: Type7.Optional(
|
|
371
|
+
Type7.Integer({ minimum: 1, description: "Maximum acceptable source disk size in GiB (default 64)." })
|
|
280
372
|
),
|
|
281
|
-
|
|
282
|
-
|
|
373
|
+
allow_running: Type7.Optional(
|
|
374
|
+
Type7.Boolean({ description: "Allow running sources instead of requiring stopped/template state (default false)." })
|
|
375
|
+
)
|
|
376
|
+
},
|
|
377
|
+
{ additionalProperties: false }
|
|
378
|
+
);
|
|
379
|
+
var GIB = 1024 ** 3;
|
|
380
|
+
|
|
381
|
+
// src/tools/proxmox_audit_permissions.ts
|
|
382
|
+
import { Type as Type8 } from "@sinclair/typebox";
|
|
383
|
+
var Schema8 = Type8.Object(
|
|
384
|
+
{
|
|
385
|
+
userid: Type8.Optional(
|
|
386
|
+
Type8.String({
|
|
387
|
+
minLength: 1,
|
|
388
|
+
description: "Optional user or full API token ID to audit. Defaults to current API identity."
|
|
389
|
+
})
|
|
390
|
+
),
|
|
391
|
+
paths: Type8.Optional(
|
|
392
|
+
Type8.Array(Type8.String({ minLength: 1 }), {
|
|
393
|
+
minItems: 1,
|
|
394
|
+
description: "Permission paths to inspect. Defaults to common smoke-test paths."
|
|
395
|
+
})
|
|
396
|
+
),
|
|
397
|
+
pool: Type8.Optional(Type8.String({ minLength: 1, description: "Pool path shortcut (default mcp-smoke)." })),
|
|
398
|
+
template_storage: Type8.Optional(Type8.String({ minLength: 1, description: "Template storage shortcut (default local)." })),
|
|
399
|
+
root_storage: Type8.Optional(Type8.String({ minLength: 1, description: "Root disk storage shortcut (default local-lvm)." })),
|
|
400
|
+
source_vmid: Type8.Optional(Type8.Integer({ minimum: 1, description: "Optional source VMID path to inspect." })),
|
|
401
|
+
target_vmid: Type8.Optional(Type8.Integer({ minimum: 1, description: "Optional target VMID path to inspect." })),
|
|
402
|
+
required_privileges: Type8.Optional(
|
|
403
|
+
Type8.Array(Type8.String({ minLength: 1 }), {
|
|
404
|
+
minItems: 1,
|
|
405
|
+
description: "Privileges to summarize on every returned path."
|
|
406
|
+
})
|
|
407
|
+
)
|
|
408
|
+
},
|
|
409
|
+
{ additionalProperties: false }
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
// src/tools/proxmox_recent_tasks.ts
|
|
413
|
+
import { Type as Type9 } from "@sinclair/typebox";
|
|
414
|
+
var NAME2 = "proxmox_recent_tasks";
|
|
415
|
+
var Schema9 = Type9.Object(
|
|
416
|
+
{
|
|
417
|
+
limit: Type9.Optional(
|
|
418
|
+
Type9.Integer({ minimum: 1, maximum: 500, description: "Max tasks to return (default 25)." })
|
|
419
|
+
),
|
|
420
|
+
vmid: Type9.Optional(
|
|
421
|
+
Type9.Integer({ minimum: 1, description: "Filter tasks by vmid (post-filter)." })
|
|
283
422
|
)
|
|
284
423
|
},
|
|
285
424
|
{ additionalProperties: false }
|
|
286
425
|
);
|
|
287
426
|
function createProxmoxRecentTasksTool(getClient) {
|
|
288
427
|
return {
|
|
289
|
-
name:
|
|
428
|
+
name: NAME2,
|
|
290
429
|
label: "proxmox: recent tasks",
|
|
291
430
|
description: "List recent cluster tasks (UPID, type, status, node, user, timing) via GET /cluster/tasks. Optionally filter by vmid (post-filter client-side).",
|
|
292
|
-
parameters:
|
|
431
|
+
parameters: Schema9,
|
|
293
432
|
execute: async (_id, raw) => {
|
|
294
|
-
const args = raw;
|
|
433
|
+
const args = validateToolArgs(Schema9, raw, NAME2);
|
|
295
434
|
const limit = args.limit ?? 25;
|
|
296
435
|
const client = getClient();
|
|
297
436
|
const tasks = await client.get("/cluster/tasks");
|
|
@@ -311,26 +450,27 @@ function createProxmoxRecentTasksTool(getClient) {
|
|
|
311
450
|
}
|
|
312
451
|
|
|
313
452
|
// src/tools/proxmox_list_backups.ts
|
|
314
|
-
import { Type as
|
|
315
|
-
var
|
|
453
|
+
import { Type as Type10 } from "@sinclair/typebox";
|
|
454
|
+
var NAME3 = "proxmox_list_backups";
|
|
455
|
+
var Schema10 = Type10.Object(
|
|
316
456
|
{
|
|
317
|
-
node:
|
|
318
|
-
|
|
457
|
+
node: Type10.Optional(
|
|
458
|
+
Type10.String({ minLength: 1, description: "Node to query (defaults to first node)." })
|
|
319
459
|
),
|
|
320
|
-
vmid:
|
|
321
|
-
|
|
460
|
+
vmid: Type10.Optional(
|
|
461
|
+
Type10.Integer({ minimum: 1, description: "Filter backups to a single vmid (post-filter)." })
|
|
322
462
|
)
|
|
323
463
|
},
|
|
324
464
|
{ additionalProperties: false }
|
|
325
465
|
);
|
|
326
466
|
function createProxmoxListBackupsTool(getClient) {
|
|
327
467
|
return {
|
|
328
|
-
name:
|
|
468
|
+
name: NAME3,
|
|
329
469
|
label: "proxmox: list backups",
|
|
330
470
|
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.",
|
|
331
|
-
parameters:
|
|
471
|
+
parameters: Schema10,
|
|
332
472
|
execute: async (_id, raw) => {
|
|
333
|
-
const args = raw;
|
|
473
|
+
const args = validateToolArgs(Schema10, raw, NAME3);
|
|
334
474
|
const client = getClient();
|
|
335
475
|
let node = args.node;
|
|
336
476
|
if (!node) {
|
|
@@ -353,12 +493,13 @@ function createProxmoxListBackupsTool(getClient) {
|
|
|
353
493
|
}
|
|
354
494
|
|
|
355
495
|
// src/tools/proxmox_resource_usage.ts
|
|
356
|
-
import { Type as
|
|
357
|
-
var
|
|
496
|
+
import { Type as Type11 } from "@sinclair/typebox";
|
|
497
|
+
var NAME4 = "proxmox_resource_usage";
|
|
498
|
+
var Schema11 = Type11.Object(
|
|
358
499
|
{
|
|
359
|
-
vmid:
|
|
360
|
-
timeframe:
|
|
361
|
-
|
|
500
|
+
vmid: Type11.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
501
|
+
timeframe: Type11.Optional(
|
|
502
|
+
Type11.Union([Type11.Literal("hour"), Type11.Literal("day"), Type11.Literal("week")], {
|
|
362
503
|
description: "RRD timeframe window (default hour)."
|
|
363
504
|
})
|
|
364
505
|
)
|
|
@@ -367,12 +508,12 @@ var Schema7 = Type7.Object(
|
|
|
367
508
|
);
|
|
368
509
|
function createProxmoxResourceUsageTool(getClient) {
|
|
369
510
|
return {
|
|
370
|
-
name:
|
|
511
|
+
name: NAME4,
|
|
371
512
|
label: "proxmox: resource usage",
|
|
372
513
|
description: "Get historical CPU/memory/disk/network samples for one LXC or VM via GET /nodes/{node}/{type}/{vmid}/rrddata?timeframe=<hour|day|week>.",
|
|
373
|
-
parameters:
|
|
514
|
+
parameters: Schema11,
|
|
374
515
|
execute: async (_id, raw) => {
|
|
375
|
-
const args = raw;
|
|
516
|
+
const args = validateToolArgs(Schema11, raw, NAME4);
|
|
376
517
|
const timeframe = args.timeframe ?? "hour";
|
|
377
518
|
const client = getClient();
|
|
378
519
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
@@ -385,7 +526,7 @@ function createProxmoxResourceUsageTool(getClient) {
|
|
|
385
526
|
}
|
|
386
527
|
|
|
387
528
|
// src/tools/proxmox_start_resource.ts
|
|
388
|
-
import { Type as
|
|
529
|
+
import { Type as Type12 } from "@sinclair/typebox";
|
|
389
530
|
|
|
390
531
|
// src/gates.ts
|
|
391
532
|
var WriteGateError = class extends Error {
|
|
@@ -399,27 +540,42 @@ function assertConfirmedWrite(args, toolName) {
|
|
|
399
540
|
throw new WriteGateError(`${toolName} is a write operation. Pass {"confirm": true} to proceed.`);
|
|
400
541
|
}
|
|
401
542
|
}
|
|
543
|
+
function assertDestructive(args, toolName) {
|
|
544
|
+
if (args.confirm !== true || args.destructive !== true) {
|
|
545
|
+
throw new WriteGateError(
|
|
546
|
+
`${toolName} is a destructive operation. Pass {"confirm": true, "destructive": true} to proceed.`
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function assertEnvFlag(envKey, toolName, env = process.env) {
|
|
551
|
+
const value = env[envKey];
|
|
552
|
+
if (!value || !["true", "1", "yes"].includes(value.toLowerCase())) {
|
|
553
|
+
throw new WriteGateError(
|
|
554
|
+
`${toolName} requires env flag ${envKey}=1 to be set. This is a destructive operation gate independent of the confirm/destructive args.`
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
402
558
|
|
|
403
559
|
// src/tools/proxmox_start_resource.ts
|
|
404
|
-
var
|
|
560
|
+
var Schema12 = Type12.Object(
|
|
405
561
|
{
|
|
406
|
-
vmid:
|
|
407
|
-
confirm:
|
|
562
|
+
vmid: Type12.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
563
|
+
confirm: Type12.Boolean({
|
|
408
564
|
description: "Must be true to write. Tier-2 safe-write gate."
|
|
409
565
|
})
|
|
410
566
|
},
|
|
411
567
|
{ additionalProperties: false }
|
|
412
568
|
);
|
|
413
|
-
var
|
|
569
|
+
var NAME5 = "proxmox_start_resource";
|
|
414
570
|
function createProxmoxStartResourceTool(getClient) {
|
|
415
571
|
return {
|
|
416
|
-
name:
|
|
572
|
+
name: NAME5,
|
|
417
573
|
label: "proxmox: start resource",
|
|
418
574
|
description: "Start a stopped LXC container or QEMU VM by vmid. Tier-2 write; requires confirm:true.",
|
|
419
|
-
parameters:
|
|
575
|
+
parameters: Schema12,
|
|
420
576
|
execute: async (_id, raw) => {
|
|
421
|
-
assertConfirmedWrite(raw,
|
|
422
|
-
const args = raw;
|
|
577
|
+
assertConfirmedWrite(raw, NAME5);
|
|
578
|
+
const args = validateToolArgs(Schema12, raw, NAME5);
|
|
423
579
|
const client = getClient();
|
|
424
580
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
425
581
|
const upid = await client.post(
|
|
@@ -432,15 +588,15 @@ function createProxmoxStartResourceTool(getClient) {
|
|
|
432
588
|
}
|
|
433
589
|
|
|
434
590
|
// src/tools/proxmox_stop_resource.ts
|
|
435
|
-
import { Type as
|
|
436
|
-
var
|
|
591
|
+
import { Type as Type13 } from "@sinclair/typebox";
|
|
592
|
+
var Schema13 = Type13.Object(
|
|
437
593
|
{
|
|
438
|
-
vmid:
|
|
439
|
-
confirm:
|
|
594
|
+
vmid: Type13.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
595
|
+
confirm: Type13.Boolean({
|
|
440
596
|
description: "Must be true to write. Tier-2 safe-write gate."
|
|
441
597
|
}),
|
|
442
|
-
timeoutSeconds:
|
|
443
|
-
|
|
598
|
+
timeoutSeconds: Type13.Optional(
|
|
599
|
+
Type13.Integer({
|
|
444
600
|
minimum: 1,
|
|
445
601
|
description: "Optional shutdown timeout in seconds (passed through to PVE as `timeout`)."
|
|
446
602
|
})
|
|
@@ -448,16 +604,16 @@ var Schema9 = Type9.Object(
|
|
|
448
604
|
},
|
|
449
605
|
{ additionalProperties: false }
|
|
450
606
|
);
|
|
451
|
-
var
|
|
607
|
+
var NAME6 = "proxmox_stop_resource";
|
|
452
608
|
function createProxmoxStopResourceTool(getClient) {
|
|
453
609
|
return {
|
|
454
|
-
name:
|
|
610
|
+
name: NAME6,
|
|
455
611
|
label: "proxmox: stop resource",
|
|
456
612
|
description: "Gracefully shutdown an LXC container or QEMU VM by vmid (POST status/shutdown). Tier-2 write; requires confirm:true.",
|
|
457
|
-
parameters:
|
|
613
|
+
parameters: Schema13,
|
|
458
614
|
execute: async (_id, raw) => {
|
|
459
|
-
assertConfirmedWrite(raw,
|
|
460
|
-
const args = raw;
|
|
615
|
+
assertConfirmedWrite(raw, NAME6);
|
|
616
|
+
const args = validateToolArgs(Schema13, raw, NAME6);
|
|
461
617
|
const client = getClient();
|
|
462
618
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
463
619
|
const body = {};
|
|
@@ -474,26 +630,26 @@ function createProxmoxStopResourceTool(getClient) {
|
|
|
474
630
|
}
|
|
475
631
|
|
|
476
632
|
// src/tools/proxmox_reboot_resource.ts
|
|
477
|
-
import { Type as
|
|
478
|
-
var
|
|
633
|
+
import { Type as Type14 } from "@sinclair/typebox";
|
|
634
|
+
var Schema14 = Type14.Object(
|
|
479
635
|
{
|
|
480
|
-
vmid:
|
|
481
|
-
confirm:
|
|
636
|
+
vmid: Type14.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
637
|
+
confirm: Type14.Boolean({
|
|
482
638
|
description: "Must be true to write. Tier-2 safe-write gate."
|
|
483
639
|
})
|
|
484
640
|
},
|
|
485
641
|
{ additionalProperties: false }
|
|
486
642
|
);
|
|
487
|
-
var
|
|
643
|
+
var NAME7 = "proxmox_reboot_resource";
|
|
488
644
|
function createProxmoxRebootResourceTool(getClient) {
|
|
489
645
|
return {
|
|
490
|
-
name:
|
|
646
|
+
name: NAME7,
|
|
491
647
|
label: "proxmox: reboot resource",
|
|
492
648
|
description: "Reboot an LXC container or QEMU VM by vmid (POST status/reboot). Tier-2 write; requires confirm:true.",
|
|
493
|
-
parameters:
|
|
649
|
+
parameters: Schema14,
|
|
494
650
|
execute: async (_id, raw) => {
|
|
495
|
-
assertConfirmedWrite(raw,
|
|
496
|
-
const args = raw;
|
|
651
|
+
assertConfirmedWrite(raw, NAME7);
|
|
652
|
+
const args = validateToolArgs(Schema14, raw, NAME7);
|
|
497
653
|
const client = getClient();
|
|
498
654
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
499
655
|
const upid = await client.post(
|
|
@@ -506,33 +662,37 @@ function createProxmoxRebootResourceTool(getClient) {
|
|
|
506
662
|
}
|
|
507
663
|
|
|
508
664
|
// src/tools/proxmox_snapshot_resource.ts
|
|
509
|
-
import { Type as
|
|
510
|
-
var
|
|
665
|
+
import { Type as Type15 } from "@sinclair/typebox";
|
|
666
|
+
var Schema15 = Type15.Object(
|
|
511
667
|
{
|
|
512
|
-
vmid:
|
|
513
|
-
snapname:
|
|
668
|
+
vmid: Type15.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
669
|
+
snapname: Type15.String({
|
|
514
670
|
minLength: 1,
|
|
515
671
|
description: "Snapshot name (PVE convention: lowercase, no spaces)."
|
|
516
672
|
}),
|
|
517
|
-
description:
|
|
518
|
-
|
|
673
|
+
description: Type15.Optional(
|
|
674
|
+
Type15.String({ description: "Optional human description for the snapshot." })
|
|
519
675
|
),
|
|
520
|
-
confirm:
|
|
676
|
+
confirm: Type15.Boolean({
|
|
521
677
|
description: "Must be true to write. Tier-2 safe-write gate."
|
|
522
678
|
})
|
|
523
679
|
},
|
|
524
680
|
{ additionalProperties: false }
|
|
525
681
|
);
|
|
526
|
-
var
|
|
682
|
+
var NAME8 = "proxmox_snapshot_resource";
|
|
527
683
|
function createProxmoxSnapshotResourceTool(getClient) {
|
|
528
684
|
return {
|
|
529
|
-
name:
|
|
685
|
+
name: NAME8,
|
|
530
686
|
label: "proxmox: snapshot resource",
|
|
531
687
|
description: "Create a snapshot of an LXC container or QEMU VM by vmid (POST /snapshot with {snapname, description?}). Tier-2 write; requires confirm:true.",
|
|
532
|
-
parameters:
|
|
688
|
+
parameters: Schema15,
|
|
533
689
|
execute: async (_id, raw) => {
|
|
534
|
-
assertConfirmedWrite(raw,
|
|
535
|
-
const args =
|
|
690
|
+
assertConfirmedWrite(raw, NAME8);
|
|
691
|
+
const args = validateToolArgs(
|
|
692
|
+
Schema15,
|
|
693
|
+
raw,
|
|
694
|
+
NAME8
|
|
695
|
+
);
|
|
536
696
|
const client = getClient();
|
|
537
697
|
const { node, type } = await resolveResource(client, args.vmid);
|
|
538
698
|
const body = { snapname: args.snapname };
|
|
@@ -554,37 +714,52 @@ function createProxmoxSnapshotResourceTool(getClient) {
|
|
|
554
714
|
};
|
|
555
715
|
}
|
|
556
716
|
|
|
717
|
+
// src/tools/proxmox_rollback_snapshot.ts
|
|
718
|
+
import { Type as Type16 } from "@sinclair/typebox";
|
|
719
|
+
var Schema16 = Type16.Object(
|
|
720
|
+
{
|
|
721
|
+
vmid: Type16.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
722
|
+
snapname: Type16.String({ minLength: 1, description: "Snapshot name to roll back to." }),
|
|
723
|
+
start: Type16.Optional(
|
|
724
|
+
Type16.Boolean({ description: "Start the resource after rollback completes (default false)." })
|
|
725
|
+
),
|
|
726
|
+
confirm: Type16.Boolean({ description: "Must be true. Tier-3 destructive gate." }),
|
|
727
|
+
destructive: Type16.Boolean({ description: "Must be true. Tier-3 destructive gate." })
|
|
728
|
+
},
|
|
729
|
+
{ additionalProperties: false }
|
|
730
|
+
);
|
|
731
|
+
|
|
557
732
|
// src/tools/proxmox_run_backup.ts
|
|
558
|
-
import { Type as
|
|
559
|
-
var
|
|
733
|
+
import { Type as Type17 } from "@sinclair/typebox";
|
|
734
|
+
var Schema17 = Type17.Object(
|
|
560
735
|
{
|
|
561
|
-
vmid:
|
|
562
|
-
storage:
|
|
736
|
+
vmid: Type17.Integer({ minimum: 1, description: "Container or VM ID to back up." }),
|
|
737
|
+
storage: Type17.String({
|
|
563
738
|
minLength: 1,
|
|
564
739
|
description: "PVE storage ID where the vzdump archive should be written."
|
|
565
740
|
}),
|
|
566
|
-
mode:
|
|
567
|
-
|
|
568
|
-
[
|
|
741
|
+
mode: Type17.Optional(
|
|
742
|
+
Type17.Union(
|
|
743
|
+
[Type17.Literal("snapshot"), Type17.Literal("suspend"), Type17.Literal("stop")],
|
|
569
744
|
{ description: "Backup mode. Defaults to 'snapshot'." }
|
|
570
745
|
)
|
|
571
746
|
),
|
|
572
|
-
confirm:
|
|
747
|
+
confirm: Type17.Boolean({
|
|
573
748
|
description: "Must be true to write. Tier-2 safe-write gate."
|
|
574
749
|
})
|
|
575
750
|
},
|
|
576
751
|
{ additionalProperties: false }
|
|
577
752
|
);
|
|
578
|
-
var
|
|
753
|
+
var NAME9 = "proxmox_run_backup";
|
|
579
754
|
function createProxmoxRunBackupTool(getClient) {
|
|
580
755
|
return {
|
|
581
|
-
name:
|
|
756
|
+
name: NAME9,
|
|
582
757
|
label: "proxmox: run backup",
|
|
583
758
|
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.",
|
|
584
|
-
parameters:
|
|
759
|
+
parameters: Schema17,
|
|
585
760
|
execute: async (_id, raw) => {
|
|
586
|
-
assertConfirmedWrite(raw,
|
|
587
|
-
const args = raw;
|
|
761
|
+
assertConfirmedWrite(raw, NAME9);
|
|
762
|
+
const args = validateToolArgs(Schema17, raw, NAME9);
|
|
588
763
|
const mode = args.mode ?? "snapshot";
|
|
589
764
|
const client = getClient();
|
|
590
765
|
const { node } = await resolveResource(client, args.vmid);
|
|
@@ -606,10 +781,11 @@ function createProxmoxRunBackupTool(getClient) {
|
|
|
606
781
|
}
|
|
607
782
|
|
|
608
783
|
// src/tools/proxmox_get_task_status.ts
|
|
609
|
-
import { Type as
|
|
610
|
-
var
|
|
784
|
+
import { Type as Type18 } from "@sinclair/typebox";
|
|
785
|
+
var NAME10 = "proxmox_get_task_status";
|
|
786
|
+
var Schema18 = Type18.Object(
|
|
611
787
|
{
|
|
612
|
-
upid:
|
|
788
|
+
upid: Type18.String({
|
|
613
789
|
minLength: 1,
|
|
614
790
|
description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
|
|
615
791
|
})
|
|
@@ -618,12 +794,12 @@ var Schema13 = Type13.Object(
|
|
|
618
794
|
);
|
|
619
795
|
function createProxmoxGetTaskStatusTool(getClient) {
|
|
620
796
|
return {
|
|
621
|
-
name:
|
|
797
|
+
name: NAME10,
|
|
622
798
|
label: "proxmox: get task status",
|
|
623
799
|
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.",
|
|
624
|
-
parameters:
|
|
800
|
+
parameters: Schema18,
|
|
625
801
|
execute: async (_id, raw) => {
|
|
626
|
-
const args = raw;
|
|
802
|
+
const args = validateToolArgs(Schema18, raw, NAME10);
|
|
627
803
|
const { node } = parseTaskUpid(args.upid);
|
|
628
804
|
const client = getClient();
|
|
629
805
|
const status = await client.get(
|
|
@@ -635,18 +811,19 @@ function createProxmoxGetTaskStatusTool(getClient) {
|
|
|
635
811
|
}
|
|
636
812
|
|
|
637
813
|
// src/tools/proxmox_get_task_log.ts
|
|
638
|
-
import { Type as
|
|
639
|
-
var
|
|
814
|
+
import { Type as Type19 } from "@sinclair/typebox";
|
|
815
|
+
var NAME11 = "proxmox_get_task_log";
|
|
816
|
+
var Schema19 = Type19.Object(
|
|
640
817
|
{
|
|
641
|
-
upid:
|
|
818
|
+
upid: Type19.String({
|
|
642
819
|
minLength: 1,
|
|
643
820
|
description: "Task UPID returned by a prior write tool."
|
|
644
821
|
}),
|
|
645
|
-
start:
|
|
646
|
-
|
|
822
|
+
start: Type19.Optional(
|
|
823
|
+
Type19.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
|
|
647
824
|
),
|
|
648
|
-
limit:
|
|
649
|
-
|
|
825
|
+
limit: Type19.Optional(
|
|
826
|
+
Type19.Integer({
|
|
650
827
|
minimum: 1,
|
|
651
828
|
maximum: 500,
|
|
652
829
|
description: "Max lines to return (default 50, max 500)."
|
|
@@ -657,12 +834,12 @@ var Schema14 = Type14.Object(
|
|
|
657
834
|
);
|
|
658
835
|
function createProxmoxGetTaskLogTool(getClient) {
|
|
659
836
|
return {
|
|
660
|
-
name:
|
|
837
|
+
name: NAME11,
|
|
661
838
|
label: "proxmox: get task log",
|
|
662
839
|
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 }.",
|
|
663
|
-
parameters:
|
|
840
|
+
parameters: Schema19,
|
|
664
841
|
execute: async (_id, raw) => {
|
|
665
|
-
const args = raw;
|
|
842
|
+
const args = validateToolArgs(Schema19, raw, NAME11);
|
|
666
843
|
const { node } = parseTaskUpid(args.upid);
|
|
667
844
|
const start = args.start ?? 0;
|
|
668
845
|
const limit = args.limit ?? 50;
|
|
@@ -675,6 +852,729 @@ function createProxmoxGetTaskLogTool(getClient) {
|
|
|
675
852
|
};
|
|
676
853
|
}
|
|
677
854
|
|
|
855
|
+
// src/tools/proxmox_list_templates.ts
|
|
856
|
+
import { Type as Type20 } from "@sinclair/typebox";
|
|
857
|
+
var NAME12 = "proxmox_list_templates";
|
|
858
|
+
var Schema20 = Type20.Object(
|
|
859
|
+
{
|
|
860
|
+
node: Type20.Optional(
|
|
861
|
+
Type20.String({ minLength: 1, description: "Node to query (defaults to first node)." })
|
|
862
|
+
),
|
|
863
|
+
storage: Type20.Optional(
|
|
864
|
+
Type20.String({ minLength: 1, description: "Storage to query (defaults to 'local')." })
|
|
865
|
+
),
|
|
866
|
+
kind: Type20.Optional(
|
|
867
|
+
Type20.Union(
|
|
868
|
+
[Type20.Literal("vztmpl"), Type20.Literal("iso"), Type20.Literal("both")],
|
|
869
|
+
{ description: "Template kind: 'vztmpl' (CT templates), 'iso' (VM ISOs), or 'both'. Defaults to 'both'." }
|
|
870
|
+
)
|
|
871
|
+
)
|
|
872
|
+
},
|
|
873
|
+
{ additionalProperties: false }
|
|
874
|
+
);
|
|
875
|
+
function createProxmoxListTemplatesTool(getClient) {
|
|
876
|
+
return {
|
|
877
|
+
name: NAME12,
|
|
878
|
+
label: "proxmox: list templates",
|
|
879
|
+
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'.",
|
|
880
|
+
parameters: Schema20,
|
|
881
|
+
execute: async (_id, raw) => {
|
|
882
|
+
const args = validateToolArgs(Schema20, raw, NAME12);
|
|
883
|
+
const client = getClient();
|
|
884
|
+
let node = args.node;
|
|
885
|
+
if (!node) {
|
|
886
|
+
const nodes = await client.get("/cluster/resources?type=node");
|
|
887
|
+
if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
|
|
888
|
+
node = nodes[0].node;
|
|
889
|
+
}
|
|
890
|
+
const storage = args.storage ?? "local";
|
|
891
|
+
const kind = args.kind ?? "both";
|
|
892
|
+
assertSafePathSegment(node, "node");
|
|
893
|
+
assertSafePathSegment(storage, "storage");
|
|
894
|
+
const nodeSeg = encodeURIComponent(node);
|
|
895
|
+
const storageSeg = encodeURIComponent(storage);
|
|
896
|
+
const out = {
|
|
897
|
+
node,
|
|
898
|
+
storage
|
|
899
|
+
};
|
|
900
|
+
if (kind === "vztmpl" || kind === "both") {
|
|
901
|
+
out.container_templates = await client.get(
|
|
902
|
+
`/nodes/${nodeSeg}/storage/${storageSeg}/content?content=vztmpl`
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
if (kind === "iso" || kind === "both") {
|
|
906
|
+
out.vm_isos = await client.get(
|
|
907
|
+
`/nodes/${nodeSeg}/storage/${storageSeg}/content?content=iso`
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
return jsonToolResult(out);
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/tools/proxmox_list_storage.ts
|
|
916
|
+
import { Type as Type21 } from "@sinclair/typebox";
|
|
917
|
+
var Schema21 = Type21.Object(
|
|
918
|
+
{
|
|
919
|
+
node: Type21.Optional(
|
|
920
|
+
Type21.String({ minLength: 1, description: "Node to query. Defaults to all nodes." })
|
|
921
|
+
)
|
|
922
|
+
},
|
|
923
|
+
{ additionalProperties: false }
|
|
924
|
+
);
|
|
925
|
+
|
|
926
|
+
// src/tools/proxmox_list_snapshots.ts
|
|
927
|
+
import { Type as Type22 } from "@sinclair/typebox";
|
|
928
|
+
var Schema22 = Type22.Object(
|
|
929
|
+
{
|
|
930
|
+
vmid: Type22.Integer({ minimum: 1, description: "Container or VM ID." })
|
|
931
|
+
},
|
|
932
|
+
{ additionalProperties: false }
|
|
933
|
+
);
|
|
934
|
+
|
|
935
|
+
// src/tools/proxmox_guest_network.ts
|
|
936
|
+
import { Type as Type23 } from "@sinclair/typebox";
|
|
937
|
+
var Schema23 = Type23.Object(
|
|
938
|
+
{
|
|
939
|
+
vmid: Type23.Integer({ minimum: 1, description: "Container or VM ID." })
|
|
940
|
+
},
|
|
941
|
+
{ additionalProperties: false }
|
|
942
|
+
);
|
|
943
|
+
|
|
944
|
+
// src/tools/proxmox_wait_task.ts
|
|
945
|
+
import { Type as Type24 } from "@sinclair/typebox";
|
|
946
|
+
var Schema24 = Type24.Object(
|
|
947
|
+
{
|
|
948
|
+
upid: Type24.String({ minLength: 1, description: "Task UPID to wait for." }),
|
|
949
|
+
timeoutSeconds: Type24.Optional(
|
|
950
|
+
Type24.Integer({ minimum: 1, maximum: 3600, description: "Max wait time in seconds. Default 60." })
|
|
951
|
+
),
|
|
952
|
+
intervalMs: Type24.Optional(
|
|
953
|
+
Type24.Integer({ minimum: 100, maximum: 1e4, description: "Polling interval in milliseconds. Default 1000." })
|
|
954
|
+
)
|
|
955
|
+
},
|
|
956
|
+
{ additionalProperties: false }
|
|
957
|
+
);
|
|
958
|
+
|
|
959
|
+
// src/tools/proxmox_next_vmid.ts
|
|
960
|
+
import { Type as Type25 } from "@sinclair/typebox";
|
|
961
|
+
var Schema25 = Type25.Object({}, { additionalProperties: false });
|
|
962
|
+
|
|
963
|
+
// src/tools/proxmox_list_pool_resources.ts
|
|
964
|
+
import { Type as Type26 } from "@sinclair/typebox";
|
|
965
|
+
var Schema26 = Type26.Object(
|
|
966
|
+
{
|
|
967
|
+
pool: Type26.Optional(
|
|
968
|
+
Type26.String({ minLength: 1, description: "Pool ID to inspect (default mcp-smoke)." })
|
|
969
|
+
)
|
|
970
|
+
},
|
|
971
|
+
{ additionalProperties: false }
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
// src/tools/proxmox_create_container.ts
|
|
975
|
+
import { Type as Type27 } from "@sinclair/typebox";
|
|
976
|
+
var Schema27 = Type27.Object(
|
|
977
|
+
{
|
|
978
|
+
vmid: Type27.Integer({ minimum: 1, description: "VMID for the new container." }),
|
|
979
|
+
hostname: Type27.String({ minLength: 1, description: "Container hostname." }),
|
|
980
|
+
ostemplate: Type27.String({
|
|
981
|
+
minLength: 1,
|
|
982
|
+
description: "OS template volid (e.g. 'local:vztmpl/ubuntu-24.04-standard_*.tar.zst')."
|
|
983
|
+
}),
|
|
984
|
+
node: Type27.Optional(
|
|
985
|
+
Type27.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
|
|
986
|
+
),
|
|
987
|
+
storage: Type27.Optional(
|
|
988
|
+
Type27.String({ minLength: 1, description: "Root storage (default 'local-lvm')." })
|
|
989
|
+
),
|
|
990
|
+
memory: Type27.Optional(
|
|
991
|
+
Type27.Integer({ minimum: 16, description: "Memory in MiB (default 512)." })
|
|
992
|
+
),
|
|
993
|
+
cores: Type27.Optional(
|
|
994
|
+
Type27.Integer({ minimum: 1, description: "CPU cores (default 1)." })
|
|
995
|
+
),
|
|
996
|
+
rootfs_size: Type27.Optional(
|
|
997
|
+
Type27.String({ minLength: 1, description: "Root filesystem size in GB (default '8')." })
|
|
998
|
+
),
|
|
999
|
+
net: Type27.Optional(
|
|
1000
|
+
Type27.String({
|
|
1001
|
+
minLength: 1,
|
|
1002
|
+
description: "Network config for net0 (default 'name=eth0,bridge=vmbr0,ip=dhcp')."
|
|
1003
|
+
})
|
|
1004
|
+
),
|
|
1005
|
+
start: Type27.Optional(
|
|
1006
|
+
Type27.Boolean({ description: "Start after create (default false)." })
|
|
1007
|
+
),
|
|
1008
|
+
pool: Type27.Optional(
|
|
1009
|
+
Type27.String({ minLength: 1, description: "Optional resource pool ID to place the container into." })
|
|
1010
|
+
),
|
|
1011
|
+
onboot: Type27.Optional(
|
|
1012
|
+
Type27.Boolean({ description: "Start container on host boot (default false)." })
|
|
1013
|
+
),
|
|
1014
|
+
unprivileged: Type27.Optional(
|
|
1015
|
+
Type27.Boolean({ description: "Create an unprivileged container (default true)." })
|
|
1016
|
+
),
|
|
1017
|
+
protection: Type27.Optional(
|
|
1018
|
+
Type27.Boolean({ description: "Enable Proxmox protection flag (default false)." })
|
|
1019
|
+
),
|
|
1020
|
+
features: Type27.Optional(
|
|
1021
|
+
Type27.String({ minLength: 1, description: "Optional LXC features string, e.g. 'nesting=1'." })
|
|
1022
|
+
),
|
|
1023
|
+
description: Type27.Optional(
|
|
1024
|
+
Type27.String({ description: "Optional container description." })
|
|
1025
|
+
),
|
|
1026
|
+
tags: Type27.Optional(
|
|
1027
|
+
Type27.String({ minLength: 1, description: "Optional semicolon-delimited Proxmox tags." })
|
|
1028
|
+
),
|
|
1029
|
+
password: Type27.Optional(
|
|
1030
|
+
Type27.String({ description: "Root password (optional)." })
|
|
1031
|
+
),
|
|
1032
|
+
ssh_public_keys: Type27.Optional(
|
|
1033
|
+
Type27.String({ description: "SSH public keys (optional)." })
|
|
1034
|
+
),
|
|
1035
|
+
confirm: Type27.Boolean({
|
|
1036
|
+
description: "Must be true to write. Tier-2 safe-write gate."
|
|
1037
|
+
})
|
|
1038
|
+
},
|
|
1039
|
+
{ additionalProperties: false }
|
|
1040
|
+
);
|
|
1041
|
+
var NAME13 = "proxmox_create_container";
|
|
1042
|
+
function createProxmoxCreateContainerTool(getClient) {
|
|
1043
|
+
return {
|
|
1044
|
+
name: NAME13,
|
|
1045
|
+
label: "proxmox: create container",
|
|
1046
|
+
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.",
|
|
1047
|
+
parameters: Schema27,
|
|
1048
|
+
execute: async (_id, raw) => {
|
|
1049
|
+
assertConfirmedWrite(raw, NAME13);
|
|
1050
|
+
const args = validateToolArgs(Schema27, raw, NAME13);
|
|
1051
|
+
if (typeof args.password === "string" && args.password.length > 0) {
|
|
1052
|
+
registerSecret(args.password);
|
|
1053
|
+
}
|
|
1054
|
+
const client = getClient();
|
|
1055
|
+
let node = args.node;
|
|
1056
|
+
if (!node) {
|
|
1057
|
+
const nodes = await client.get("/cluster/resources?type=node");
|
|
1058
|
+
if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
|
|
1059
|
+
node = nodes[0].node;
|
|
1060
|
+
}
|
|
1061
|
+
const storage = args.storage ?? "local-lvm";
|
|
1062
|
+
const rootfsSize = args.rootfs_size ?? "8";
|
|
1063
|
+
const body = {
|
|
1064
|
+
vmid: args.vmid,
|
|
1065
|
+
hostname: args.hostname,
|
|
1066
|
+
ostemplate: args.ostemplate,
|
|
1067
|
+
storage,
|
|
1068
|
+
memory: args.memory ?? 512,
|
|
1069
|
+
cores: args.cores ?? 1,
|
|
1070
|
+
rootfs: `${storage}:${rootfsSize}`,
|
|
1071
|
+
net0: args.net ?? "name=eth0,bridge=vmbr0,ip=dhcp",
|
|
1072
|
+
start: args.start ? 1 : 0,
|
|
1073
|
+
onboot: args.onboot ? 1 : 0,
|
|
1074
|
+
unprivileged: args.unprivileged === false ? 0 : 1,
|
|
1075
|
+
protection: args.protection ? 1 : 0
|
|
1076
|
+
};
|
|
1077
|
+
for (const key of ["pool", "features"]) {
|
|
1078
|
+
const value = args[key];
|
|
1079
|
+
if (typeof value === "string" && value.length > 0) body[key] = value;
|
|
1080
|
+
}
|
|
1081
|
+
if (typeof args.password === "string" && args.password.length > 0) {
|
|
1082
|
+
body.password = args.password;
|
|
1083
|
+
}
|
|
1084
|
+
if (typeof args.ssh_public_keys === "string" && args.ssh_public_keys.length > 0) {
|
|
1085
|
+
body["ssh-public-keys"] = args.ssh_public_keys;
|
|
1086
|
+
}
|
|
1087
|
+
if (typeof args.description === "string" && args.description.length > 0) {
|
|
1088
|
+
body.description = args.description;
|
|
1089
|
+
}
|
|
1090
|
+
if (typeof args.tags === "string" && args.tags.length > 0) {
|
|
1091
|
+
body.tags = args.tags;
|
|
1092
|
+
}
|
|
1093
|
+
const upid = await client.post(`/nodes/${node}/lxc`, body);
|
|
1094
|
+
return jsonToolResult({
|
|
1095
|
+
vmid: args.vmid,
|
|
1096
|
+
node,
|
|
1097
|
+
hostname: args.hostname,
|
|
1098
|
+
upid
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// src/tools/proxmox_create_vm.ts
|
|
1105
|
+
import { Type as Type28 } from "@sinclair/typebox";
|
|
1106
|
+
var Schema28 = Type28.Object(
|
|
1107
|
+
{
|
|
1108
|
+
vmid: Type28.Integer({ minimum: 1, description: "VMID for the new VM." }),
|
|
1109
|
+
name: Type28.String({ minLength: 1, description: "VM display name." }),
|
|
1110
|
+
node: Type28.Optional(
|
|
1111
|
+
Type28.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
|
|
1112
|
+
),
|
|
1113
|
+
memory: Type28.Optional(
|
|
1114
|
+
Type28.Integer({ minimum: 16, description: "Memory in MiB (default 2048)." })
|
|
1115
|
+
),
|
|
1116
|
+
cores: Type28.Optional(
|
|
1117
|
+
Type28.Integer({ minimum: 1, description: "CPU cores (default 2)." })
|
|
1118
|
+
),
|
|
1119
|
+
iso: Type28.Optional(
|
|
1120
|
+
Type28.String({
|
|
1121
|
+
minLength: 1,
|
|
1122
|
+
description: "ISO volid for install media (e.g. 'local:iso/ubuntu-24.04.iso'). If set, attaches as ide2 cdrom."
|
|
1123
|
+
})
|
|
1124
|
+
),
|
|
1125
|
+
disk_size: Type28.Optional(
|
|
1126
|
+
Type28.String({ minLength: 1, description: "Primary disk size in GB on scsi0 (default '32')." })
|
|
1127
|
+
),
|
|
1128
|
+
storage: Type28.Optional(
|
|
1129
|
+
Type28.String({ minLength: 1, description: "Disk storage (default 'local-lvm')." })
|
|
1130
|
+
),
|
|
1131
|
+
net: Type28.Optional(
|
|
1132
|
+
Type28.String({
|
|
1133
|
+
minLength: 1,
|
|
1134
|
+
description: "Network config for net0 (default 'model=virtio,bridge=vmbr0')."
|
|
1135
|
+
})
|
|
1136
|
+
),
|
|
1137
|
+
start: Type28.Optional(
|
|
1138
|
+
Type28.Boolean({ description: "Start after create (default false)." })
|
|
1139
|
+
),
|
|
1140
|
+
pool: Type28.Optional(
|
|
1141
|
+
Type28.String({ minLength: 1, description: "Optional resource pool ID to place the VM into." })
|
|
1142
|
+
),
|
|
1143
|
+
onboot: Type28.Optional(
|
|
1144
|
+
Type28.Boolean({ description: "Start VM on host boot (default false)." })
|
|
1145
|
+
),
|
|
1146
|
+
protection: Type28.Optional(
|
|
1147
|
+
Type28.Boolean({ description: "Enable Proxmox protection flag (default false)." })
|
|
1148
|
+
),
|
|
1149
|
+
agent: Type28.Optional(
|
|
1150
|
+
Type28.Boolean({ description: "Enable QEMU guest agent in VM config (default false)." })
|
|
1151
|
+
),
|
|
1152
|
+
scsihw: Type28.Optional(
|
|
1153
|
+
Type28.String({ minLength: 1, description: "Optional SCSI controller, e.g. 'virtio-scsi-pci'." })
|
|
1154
|
+
),
|
|
1155
|
+
boot: Type28.Optional(
|
|
1156
|
+
Type28.String({ minLength: 1, description: "Optional boot order string." })
|
|
1157
|
+
),
|
|
1158
|
+
bios: Type28.Optional(
|
|
1159
|
+
Type28.Union([Type28.Literal("seabios"), Type28.Literal("ovmf")], { description: "Optional VM BIOS type." })
|
|
1160
|
+
),
|
|
1161
|
+
machine: Type28.Optional(
|
|
1162
|
+
Type28.String({ minLength: 1, description: "Optional machine type." })
|
|
1163
|
+
),
|
|
1164
|
+
cpu: Type28.Optional(
|
|
1165
|
+
Type28.String({ minLength: 1, description: "Optional CPU type." })
|
|
1166
|
+
),
|
|
1167
|
+
sockets: Type28.Optional(
|
|
1168
|
+
Type28.Integer({ minimum: 1, description: "Optional socket count." })
|
|
1169
|
+
),
|
|
1170
|
+
description: Type28.Optional(
|
|
1171
|
+
Type28.String({ description: "Optional VM description." })
|
|
1172
|
+
),
|
|
1173
|
+
tags: Type28.Optional(
|
|
1174
|
+
Type28.String({ minLength: 1, description: "Optional semicolon-delimited Proxmox tags." })
|
|
1175
|
+
),
|
|
1176
|
+
ciuser: Type28.Optional(
|
|
1177
|
+
Type28.String({ minLength: 1, description: "Optional cloud-init username." })
|
|
1178
|
+
),
|
|
1179
|
+
cipassword: Type28.Optional(
|
|
1180
|
+
Type28.String({ description: "Optional cloud-init password." })
|
|
1181
|
+
),
|
|
1182
|
+
sshkeys: Type28.Optional(
|
|
1183
|
+
Type28.String({ description: "Optional cloud-init SSH public keys." })
|
|
1184
|
+
),
|
|
1185
|
+
ipconfig0: Type28.Optional(
|
|
1186
|
+
Type28.String({ minLength: 1, description: "Optional cloud-init ipconfig0, e.g. 'ip=dhcp'." })
|
|
1187
|
+
),
|
|
1188
|
+
nameserver: Type28.Optional(
|
|
1189
|
+
Type28.String({ minLength: 1, description: "Optional cloud-init DNS server list." })
|
|
1190
|
+
),
|
|
1191
|
+
searchdomain: Type28.Optional(
|
|
1192
|
+
Type28.String({ minLength: 1, description: "Optional cloud-init DNS search domain." })
|
|
1193
|
+
),
|
|
1194
|
+
confirm: Type28.Boolean({
|
|
1195
|
+
description: "Must be true to write. Tier-2 safe-write gate."
|
|
1196
|
+
})
|
|
1197
|
+
},
|
|
1198
|
+
{ additionalProperties: false }
|
|
1199
|
+
);
|
|
1200
|
+
var NAME14 = "proxmox_create_vm";
|
|
1201
|
+
function createProxmoxCreateVmTool(getClient) {
|
|
1202
|
+
return {
|
|
1203
|
+
name: NAME14,
|
|
1204
|
+
label: "proxmox: create vm",
|
|
1205
|
+
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.",
|
|
1206
|
+
parameters: Schema28,
|
|
1207
|
+
execute: async (_id, raw) => {
|
|
1208
|
+
assertConfirmedWrite(raw, NAME14);
|
|
1209
|
+
const args = validateToolArgs(Schema28, raw, NAME14);
|
|
1210
|
+
if (typeof args.cipassword === "string" && args.cipassword.length > 0) {
|
|
1211
|
+
registerSecret(args.cipassword);
|
|
1212
|
+
}
|
|
1213
|
+
const client = getClient();
|
|
1214
|
+
let node = args.node;
|
|
1215
|
+
if (!node) {
|
|
1216
|
+
const nodes = await client.get("/cluster/resources?type=node");
|
|
1217
|
+
if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
|
|
1218
|
+
node = nodes[0].node;
|
|
1219
|
+
}
|
|
1220
|
+
const storage = args.storage ?? "local-lvm";
|
|
1221
|
+
const diskSize = args.disk_size ?? "32";
|
|
1222
|
+
const body = {
|
|
1223
|
+
vmid: args.vmid,
|
|
1224
|
+
name: args.name,
|
|
1225
|
+
memory: args.memory ?? 2048,
|
|
1226
|
+
cores: args.cores ?? 2,
|
|
1227
|
+
scsi0: `${storage}:${diskSize}`,
|
|
1228
|
+
net0: args.net ?? "model=virtio,bridge=vmbr0",
|
|
1229
|
+
start: args.start ? 1 : 0,
|
|
1230
|
+
onboot: args.onboot ? 1 : 0,
|
|
1231
|
+
protection: args.protection ? 1 : 0,
|
|
1232
|
+
agent: args.agent ? 1 : 0
|
|
1233
|
+
};
|
|
1234
|
+
if (typeof args.iso === "string" && args.iso.length > 0) {
|
|
1235
|
+
body.ide2 = `${args.iso},media=cdrom`;
|
|
1236
|
+
}
|
|
1237
|
+
for (const key of ["pool", "scsihw", "boot", "bios", "machine", "cpu", "description", "tags", "ciuser", "cipassword", "sshkeys", "ipconfig0", "nameserver", "searchdomain"]) {
|
|
1238
|
+
const value = args[key];
|
|
1239
|
+
if (typeof value === "string" && value.length > 0) body[key] = value;
|
|
1240
|
+
}
|
|
1241
|
+
if (typeof args.sockets === "number") body.sockets = args.sockets;
|
|
1242
|
+
const upid = await client.post(`/nodes/${node}/qemu`, body);
|
|
1243
|
+
return jsonToolResult({
|
|
1244
|
+
vmid: args.vmid,
|
|
1245
|
+
node,
|
|
1246
|
+
name: args.name,
|
|
1247
|
+
upid
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// src/tools/proxmox_clone_resource.ts
|
|
1254
|
+
import { Type as Type29 } from "@sinclair/typebox";
|
|
1255
|
+
var Schema29 = Type29.Object(
|
|
1256
|
+
{
|
|
1257
|
+
source_vmid: Type29.Integer({ minimum: 1, description: "Source CT/VM ID to clone from." }),
|
|
1258
|
+
new_vmid: Type29.Integer({ minimum: 1, description: "VMID for the cloned resource." }),
|
|
1259
|
+
name: Type29.String({ minLength: 1, description: "Name/hostname for the new clone." }),
|
|
1260
|
+
full: Type29.Optional(
|
|
1261
|
+
Type29.Boolean({ description: "Full clone (default true). Set false for a linked clone." })
|
|
1262
|
+
),
|
|
1263
|
+
storage: Type29.Optional(
|
|
1264
|
+
Type29.String({ minLength: 1, description: "Target storage (default: same as source)." })
|
|
1265
|
+
),
|
|
1266
|
+
target_node: Type29.Optional(
|
|
1267
|
+
Type29.String({ minLength: 1, description: "Optional target node for the clone." })
|
|
1268
|
+
),
|
|
1269
|
+
pool: Type29.Optional(
|
|
1270
|
+
Type29.String({ minLength: 1, description: "Optional resource pool ID for the clone." })
|
|
1271
|
+
),
|
|
1272
|
+
snapname: Type29.Optional(
|
|
1273
|
+
Type29.String({ minLength: 1, description: "Clone from a named snapshot (optional)." })
|
|
1274
|
+
),
|
|
1275
|
+
description: Type29.Optional(
|
|
1276
|
+
Type29.String({ description: "Optional description for the clone." })
|
|
1277
|
+
),
|
|
1278
|
+
confirm: Type29.Boolean({
|
|
1279
|
+
description: "Must be true to write. Tier-2 safe-write gate."
|
|
1280
|
+
})
|
|
1281
|
+
},
|
|
1282
|
+
{ additionalProperties: false }
|
|
1283
|
+
);
|
|
1284
|
+
var NAME15 = "proxmox_clone_resource";
|
|
1285
|
+
function createProxmoxCloneResourceTool(getClient) {
|
|
1286
|
+
return {
|
|
1287
|
+
name: NAME15,
|
|
1288
|
+
label: "proxmox: clone resource",
|
|
1289
|
+
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.",
|
|
1290
|
+
parameters: Schema29,
|
|
1291
|
+
execute: async (_id, raw) => {
|
|
1292
|
+
assertConfirmedWrite(raw, NAME15);
|
|
1293
|
+
const args = validateToolArgs(Schema29, raw, NAME15);
|
|
1294
|
+
const client = getClient();
|
|
1295
|
+
const { node, type } = await resolveResource(client, args.source_vmid);
|
|
1296
|
+
const body = {
|
|
1297
|
+
newid: args.new_vmid,
|
|
1298
|
+
name: args.name,
|
|
1299
|
+
full: args.full !== false ? 1 : 0
|
|
1300
|
+
};
|
|
1301
|
+
if (typeof args.storage === "string" && args.storage.length > 0) {
|
|
1302
|
+
body.storage = args.storage;
|
|
1303
|
+
}
|
|
1304
|
+
if (typeof args.target_node === "string" && args.target_node.length > 0) {
|
|
1305
|
+
body.target = args.target_node;
|
|
1306
|
+
}
|
|
1307
|
+
if (typeof args.pool === "string" && args.pool.length > 0) {
|
|
1308
|
+
body.pool = args.pool;
|
|
1309
|
+
}
|
|
1310
|
+
if (typeof args.snapname === "string" && args.snapname.length > 0) {
|
|
1311
|
+
body.snapname = args.snapname;
|
|
1312
|
+
}
|
|
1313
|
+
if (typeof args.description === "string" && args.description.length > 0) {
|
|
1314
|
+
body.description = args.description;
|
|
1315
|
+
}
|
|
1316
|
+
const upid = await client.post(
|
|
1317
|
+
`/nodes/${node}/${type}/${args.source_vmid}/clone`,
|
|
1318
|
+
body
|
|
1319
|
+
);
|
|
1320
|
+
return jsonToolResult({
|
|
1321
|
+
source_vmid: args.source_vmid,
|
|
1322
|
+
new_vmid: args.new_vmid,
|
|
1323
|
+
node,
|
|
1324
|
+
type,
|
|
1325
|
+
name: args.name,
|
|
1326
|
+
upid
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// src/tools/proxmox_destroy_resource.ts
|
|
1333
|
+
import { Type as Type30 } from "@sinclair/typebox";
|
|
1334
|
+
var Schema30 = Type30.Object(
|
|
1335
|
+
{
|
|
1336
|
+
vmid: Type30.Integer({ minimum: 1, description: "Container or VM ID to destroy." }),
|
|
1337
|
+
purge: Type30.Optional(
|
|
1338
|
+
Type30.Boolean({
|
|
1339
|
+
description: "Remove from PVE backup/replication config too (default true)."
|
|
1340
|
+
})
|
|
1341
|
+
),
|
|
1342
|
+
force: Type30.Optional(
|
|
1343
|
+
Type30.Boolean({
|
|
1344
|
+
description: "Allow destroying a running VM (default false)."
|
|
1345
|
+
})
|
|
1346
|
+
),
|
|
1347
|
+
confirm: Type30.Boolean({
|
|
1348
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1349
|
+
}),
|
|
1350
|
+
destructive: Type30.Boolean({
|
|
1351
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1352
|
+
})
|
|
1353
|
+
},
|
|
1354
|
+
{ additionalProperties: false }
|
|
1355
|
+
);
|
|
1356
|
+
var NAME16 = "proxmox_destroy_resource";
|
|
1357
|
+
function createProxmoxDestroyResourceTool(getClient) {
|
|
1358
|
+
return {
|
|
1359
|
+
name: NAME16,
|
|
1360
|
+
label: "proxmox: destroy resource",
|
|
1361
|
+
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.",
|
|
1362
|
+
parameters: Schema30,
|
|
1363
|
+
execute: async (_id, raw) => {
|
|
1364
|
+
assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME16);
|
|
1365
|
+
assertDestructive(raw, NAME16);
|
|
1366
|
+
const args = validateToolArgs(Schema30, raw, NAME16);
|
|
1367
|
+
const purge = args.purge !== false;
|
|
1368
|
+
const force = args.force === true;
|
|
1369
|
+
const client = getClient();
|
|
1370
|
+
const { node, type } = await resolveResource(client, args.vmid);
|
|
1371
|
+
const params = new URLSearchParams();
|
|
1372
|
+
if (purge) {
|
|
1373
|
+
params.append("purge", "1");
|
|
1374
|
+
params.append("destroy-unreferenced-disks", "1");
|
|
1375
|
+
}
|
|
1376
|
+
if (force && type === "lxc") params.append("force", "1");
|
|
1377
|
+
const qs = params.toString();
|
|
1378
|
+
const path2 = qs.length > 0 ? `/nodes/${node}/${type}/${args.vmid}?${qs}` : `/nodes/${node}/${type}/${args.vmid}`;
|
|
1379
|
+
const upid = await client.delete(path2);
|
|
1380
|
+
return jsonToolResult({ vmid: args.vmid, node, type, upid });
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
// src/tools/proxmox_cleanup_smoke_resources.ts
|
|
1386
|
+
import { Type as Type31 } from "@sinclair/typebox";
|
|
1387
|
+
var Schema31 = Type31.Object(
|
|
1388
|
+
{
|
|
1389
|
+
pool: Type31.Optional(
|
|
1390
|
+
Type31.String({ minLength: 1, description: "Pool ID to clean up (default mcp-smoke)." })
|
|
1391
|
+
),
|
|
1392
|
+
name_prefix: Type31.Optional(
|
|
1393
|
+
Type31.String({
|
|
1394
|
+
minLength: 1,
|
|
1395
|
+
description: "Only delete guest names starting with this prefix (default mcp-smoke-)."
|
|
1396
|
+
})
|
|
1397
|
+
),
|
|
1398
|
+
force: Type31.Optional(
|
|
1399
|
+
Type31.Boolean({
|
|
1400
|
+
description: "Allow deleting running smoke guests. Also passes force=1 for LXC cleanup (default false)."
|
|
1401
|
+
})
|
|
1402
|
+
),
|
|
1403
|
+
dry_run: Type31.Optional(
|
|
1404
|
+
Type31.Boolean({ description: "Preview matching targets without deleting them (default true)." })
|
|
1405
|
+
),
|
|
1406
|
+
wait: Type31.Optional(
|
|
1407
|
+
Type31.Boolean({ description: "Wait for delete tasks to finish when dry_run:false (default true)." })
|
|
1408
|
+
),
|
|
1409
|
+
confirm: Type31.Optional(
|
|
1410
|
+
Type31.Boolean({ description: "Must be true when dry_run:false. Tier-3 destructive gate." })
|
|
1411
|
+
),
|
|
1412
|
+
destructive: Type31.Optional(
|
|
1413
|
+
Type31.Boolean({ description: "Must be true when dry_run:false. Tier-3 destructive gate." })
|
|
1414
|
+
),
|
|
1415
|
+
timeoutSeconds: Type31.Optional(
|
|
1416
|
+
Type31.Integer({ minimum: 1, maximum: 3600, description: "Max seconds to wait per delete task (default 180)." })
|
|
1417
|
+
),
|
|
1418
|
+
intervalMs: Type31.Optional(
|
|
1419
|
+
Type31.Integer({ minimum: 100, maximum: 1e4, description: "Task polling interval in milliseconds (default 1000)." })
|
|
1420
|
+
)
|
|
1421
|
+
},
|
|
1422
|
+
{ additionalProperties: false }
|
|
1423
|
+
);
|
|
1424
|
+
|
|
1425
|
+
// src/tools/proxmox_delete_snapshot.ts
|
|
1426
|
+
import { Type as Type32 } from "@sinclair/typebox";
|
|
1427
|
+
var Schema32 = Type32.Object(
|
|
1428
|
+
{
|
|
1429
|
+
vmid: Type32.Integer({ minimum: 1, description: "Container or VM ID." }),
|
|
1430
|
+
snapname: Type32.String({
|
|
1431
|
+
minLength: 1,
|
|
1432
|
+
description: "Snapshot name to delete."
|
|
1433
|
+
}),
|
|
1434
|
+
confirm: Type32.Boolean({
|
|
1435
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1436
|
+
}),
|
|
1437
|
+
destructive: Type32.Boolean({
|
|
1438
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1439
|
+
})
|
|
1440
|
+
},
|
|
1441
|
+
{ additionalProperties: false }
|
|
1442
|
+
);
|
|
1443
|
+
var NAME17 = "proxmox_delete_snapshot";
|
|
1444
|
+
function createProxmoxDeleteSnapshotTool(getClient) {
|
|
1445
|
+
return {
|
|
1446
|
+
name: NAME17,
|
|
1447
|
+
label: "proxmox: delete snapshot",
|
|
1448
|
+
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.",
|
|
1449
|
+
parameters: Schema32,
|
|
1450
|
+
execute: async (_id, raw) => {
|
|
1451
|
+
assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME17);
|
|
1452
|
+
assertDestructive(raw, NAME17);
|
|
1453
|
+
const args = validateToolArgs(
|
|
1454
|
+
Schema32,
|
|
1455
|
+
raw,
|
|
1456
|
+
NAME17
|
|
1457
|
+
);
|
|
1458
|
+
const client = getClient();
|
|
1459
|
+
const { node, type } = await resolveResource(client, args.vmid);
|
|
1460
|
+
const upid = await client.delete(
|
|
1461
|
+
`/nodes/${node}/${type}/${args.vmid}/snapshot/${encodeURIComponent(args.snapname)}`
|
|
1462
|
+
);
|
|
1463
|
+
return jsonToolResult({ vmid: args.vmid, node, type, snapname: args.snapname, upid });
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
// src/tools/proxmox_force_stop_resource.ts
|
|
1469
|
+
import { Type as Type33 } from "@sinclair/typebox";
|
|
1470
|
+
var Schema33 = Type33.Object(
|
|
1471
|
+
{
|
|
1472
|
+
vmid: Type33.Integer({ minimum: 1, description: "Container or VM ID to hard-stop." }),
|
|
1473
|
+
confirm: Type33.Boolean({
|
|
1474
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1475
|
+
}),
|
|
1476
|
+
destructive: Type33.Boolean({
|
|
1477
|
+
description: "Must be true. Tier-3 destructive gate."
|
|
1478
|
+
})
|
|
1479
|
+
},
|
|
1480
|
+
{ additionalProperties: false }
|
|
1481
|
+
);
|
|
1482
|
+
var NAME18 = "proxmox_force_stop_resource";
|
|
1483
|
+
function createProxmoxForceStopResourceTool(getClient) {
|
|
1484
|
+
return {
|
|
1485
|
+
name: NAME18,
|
|
1486
|
+
label: "proxmox: force stop resource",
|
|
1487
|
+
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.",
|
|
1488
|
+
parameters: Schema33,
|
|
1489
|
+
execute: async (_id, raw) => {
|
|
1490
|
+
assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME18);
|
|
1491
|
+
assertDestructive(raw, NAME18);
|
|
1492
|
+
const args = validateToolArgs(Schema33, raw, NAME18);
|
|
1493
|
+
const client = getClient();
|
|
1494
|
+
const { node, type } = await resolveResource(client, args.vmid);
|
|
1495
|
+
const upid = await client.post(
|
|
1496
|
+
`/nodes/${node}/${type}/${args.vmid}/status/stop`,
|
|
1497
|
+
{}
|
|
1498
|
+
);
|
|
1499
|
+
return jsonToolResult({ vmid: args.vmid, node, type, upid });
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
// src/tools/proxmox_exec.ts
|
|
1505
|
+
import { Type as Type34 } from "@sinclair/typebox";
|
|
1506
|
+
var Schema34 = Type34.Object(
|
|
1507
|
+
{
|
|
1508
|
+
vmid: Type34.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1509
|
+
command: Type34.String({ minLength: 1, description: "Shell command to run inside the resource." }),
|
|
1510
|
+
timeout: Type34.Optional(
|
|
1511
|
+
Type34.Integer({ minimum: 1, maximum: 3600, description: "Timeout in seconds (default 30)." })
|
|
1512
|
+
),
|
|
1513
|
+
confirm: Type34.Boolean({ description: "Must be true to execute. Tier-2 safe-write gate." })
|
|
1514
|
+
},
|
|
1515
|
+
{ additionalProperties: false }
|
|
1516
|
+
);
|
|
1517
|
+
|
|
1518
|
+
// src/tools/proxmox_read_file.ts
|
|
1519
|
+
import { Type as Type35 } from "@sinclair/typebox";
|
|
1520
|
+
var Schema35 = Type35.Object(
|
|
1521
|
+
{
|
|
1522
|
+
vmid: Type35.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1523
|
+
path: Type35.String({ minLength: 1, description: "Absolute file path inside the resource." }),
|
|
1524
|
+
confirm: Type35.Boolean({ description: "Must be true to read files from inside a guest." })
|
|
1525
|
+
},
|
|
1526
|
+
{ additionalProperties: false }
|
|
1527
|
+
);
|
|
1528
|
+
|
|
1529
|
+
// src/tools/proxmox_write_file.ts
|
|
1530
|
+
import { Type as Type36 } from "@sinclair/typebox";
|
|
1531
|
+
import path from "path";
|
|
1532
|
+
var Schema36 = Type36.Object(
|
|
1533
|
+
{
|
|
1534
|
+
vmid: Type36.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1535
|
+
path: Type36.String({ minLength: 1, description: "Absolute destination path inside the resource." }),
|
|
1536
|
+
content: Type36.String({ description: "Text content to write." }),
|
|
1537
|
+
confirm: Type36.Boolean({ description: "Must be true to write. Tier-2 safe-write gate." })
|
|
1538
|
+
},
|
|
1539
|
+
{ additionalProperties: false }
|
|
1540
|
+
);
|
|
1541
|
+
|
|
1542
|
+
// src/tools/proxmox_stat_path.ts
|
|
1543
|
+
import { Type as Type37 } from "@sinclair/typebox";
|
|
1544
|
+
var Schema37 = Type37.Object(
|
|
1545
|
+
{
|
|
1546
|
+
vmid: Type37.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1547
|
+
path: Type37.String({ minLength: 1, description: "Absolute path inside the guest." }),
|
|
1548
|
+
confirm: Type37.Boolean({ description: "Must be true to inspect guest filesystem metadata." })
|
|
1549
|
+
},
|
|
1550
|
+
{ additionalProperties: false }
|
|
1551
|
+
);
|
|
1552
|
+
|
|
1553
|
+
// src/tools/proxmox_list_directory.ts
|
|
1554
|
+
import { Type as Type38 } from "@sinclair/typebox";
|
|
1555
|
+
var Schema38 = Type38.Object(
|
|
1556
|
+
{
|
|
1557
|
+
vmid: Type38.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1558
|
+
path: Type38.String({ minLength: 1, description: "Absolute directory path inside the guest." }),
|
|
1559
|
+
confirm: Type38.Boolean({ description: "Must be true to inspect guest directory contents." })
|
|
1560
|
+
},
|
|
1561
|
+
{ additionalProperties: false }
|
|
1562
|
+
);
|
|
1563
|
+
|
|
1564
|
+
// src/tools/proxmox_service_status.ts
|
|
1565
|
+
import { Type as Type39 } from "@sinclair/typebox";
|
|
1566
|
+
var Schema39 = Type39.Object(
|
|
1567
|
+
{
|
|
1568
|
+
vmid: Type39.Integer({ minimum: 1, description: "Container or VM id." }),
|
|
1569
|
+
service: Type39.String({ minLength: 1, description: "systemd service name inside the guest." }),
|
|
1570
|
+
confirm: Type39.Boolean({ description: "Must be true to inspect guest service state." })
|
|
1571
|
+
},
|
|
1572
|
+
{ additionalProperties: false }
|
|
1573
|
+
);
|
|
1574
|
+
|
|
1575
|
+
// src/tools/service-action.ts
|
|
1576
|
+
import { Type as Type40 } from "@sinclair/typebox";
|
|
1577
|
+
|
|
678
1578
|
// index.ts
|
|
679
1579
|
function withRedactedErrors(tool) {
|
|
680
1580
|
const orig = tool.execute.bind(tool);
|
|
@@ -719,6 +1619,13 @@ var index_default = definePluginEntry({
|
|
|
719
1619
|
register(createProxmoxRunBackupTool(getClient));
|
|
720
1620
|
register(createProxmoxGetTaskStatusTool(getClient));
|
|
721
1621
|
register(createProxmoxGetTaskLogTool(getClient));
|
|
1622
|
+
register(createProxmoxListTemplatesTool(getClient));
|
|
1623
|
+
register(createProxmoxCreateContainerTool(getClient));
|
|
1624
|
+
register(createProxmoxCreateVmTool(getClient));
|
|
1625
|
+
register(createProxmoxCloneResourceTool(getClient));
|
|
1626
|
+
register(createProxmoxDestroyResourceTool(getClient));
|
|
1627
|
+
register(createProxmoxDeleteSnapshotTool(getClient));
|
|
1628
|
+
register(createProxmoxForceStopResourceTool(getClient));
|
|
722
1629
|
}
|
|
723
1630
|
});
|
|
724
1631
|
export {
|