@solomonneas/proxmox-mcp 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,36 @@
1
1
  # proxmox-mcp
2
2
 
3
- MCP server exposing Proxmox VE read + safe-write tools via API token auth. Three-tier write gating: reads are open, writes require `confirm: true`, destructive ops would require `confirm: true` + `destructive: true` (v1 ships tier 1 + tier 2 only; tier 3 destroy ops are deferred).
3
+ MCP server exposing Proxmox VE read + safe-write + destructive tools via API token auth. Three-tier write gating: reads are open, writes require `confirm: true`, destructive ops require `confirm: true` + `destructive: true` + a process-level `PROXMOX_ENABLE_DESTRUCTIVE=1` env flag.
4
4
 
5
5
  ## Tools
6
6
 
7
- **Reads (7):** `proxmox_status`, `proxmox_list_containers`, `proxmox_list_vms`, `proxmox_get_resource`, `proxmox_recent_tasks`, `proxmox_list_backups`, `proxmox_resource_usage`.
8
-
9
- **Safe writes (5, require `confirm: true`):** `proxmox_start_resource`, `proxmox_stop_resource`, `proxmox_reboot_resource`, `proxmox_snapshot_resource`, `proxmox_run_backup`.
10
-
11
- **Destructive (tier 3):** not in v1. Operations like resource deletion, snapshot rollback, and storage destruction are intentionally absent until the gate pattern has more field time.
7
+ | Tool | Tier | Notes |
8
+ | --- | --- | --- |
9
+ | `proxmox_status` | 1 read | Cluster + node status. |
10
+ | `proxmox_list_containers` | 1 read | LXC inventory across all nodes. |
11
+ | `proxmox_list_vms` | 1 read | QEMU inventory across all nodes. |
12
+ | `proxmox_get_resource` | 1 read | Single container or VM config + status by vmid. |
13
+ | `proxmox_recent_tasks` | 1 read | Recent UPID task list per node. |
14
+ | `proxmox_list_backups` | 1 read | Backup inventory by storage. |
15
+ | `proxmox_resource_usage` | 1 read | CPU/mem/disk RRD metrics. |
16
+ | `proxmox_list_templates` | 1 read | LXC + VM templates available for cloning + container creation. |
17
+ | `proxmox_start_resource` | 2 safe-write | Boot container or VM. |
18
+ | `proxmox_stop_resource` | 2 safe-write | Graceful shutdown. |
19
+ | `proxmox_reboot_resource` | 2 safe-write | Reboot in place. |
20
+ | `proxmox_snapshot_resource` | 2 safe-write | Create named snapshot. |
21
+ | `proxmox_run_backup` | 2 safe-write | Trigger vzdump for a vmid. |
22
+ | `proxmox_create_container` | 2 safe-write | Provision new LXC from template (`POST /nodes/{node}/lxc`). |
23
+ | `proxmox_create_vm` | 2 safe-write | Provision new QEMU VM (`POST /nodes/{node}/qemu`). |
24
+ | `proxmox_clone_resource` | 2 safe-write | Clone existing container or VM into a fresh vmid. |
25
+ | `proxmox_destroy_resource` | 3 destructive | Permanently delete an LXC or VM (`DELETE /nodes/{node}/{type}/{vmid}`). |
26
+ | `proxmox_delete_snapshot` | 3 destructive | Delete a named snapshot. |
27
+ | `proxmox_force_stop_resource` | 3 destructive | Non-graceful hard stop of a running container or VM. |
28
+ | `proxmox_get_task_status` | 1 read | Single UPID status lookup. |
29
+ | `proxmox_get_task_log` | 1 read | Task log tail for a UPID. |
30
+
31
+ **Reads (10):** open; no flags required.
32
+ **Safe writes (8):** require `confirm: true`. Schema documents the gate on every tool. `WriteGateError` fires before any HTTP call.
33
+ **Destructive (3):** require `confirm: true` + `destructive: true` + env `PROXMOX_ENABLE_DESTRUCTIVE=1`. All three gates must be satisfied; any one missing throws `WriteGateError` before resolving the resource.
12
34
 
13
35
  ## Configuration
14
36
 
@@ -124,9 +146,15 @@ PROXMOX_TLS_INSECURE = "false"
124
146
 
125
147
  This MCP uses the same three-tier write-gating pattern as the rest of the `solomonneas/*-mcp` family:
126
148
 
127
- - **Tier 1 (reads):** open. No confirm flag needed. Status, listings, usage, recent tasks, backup inventory.
128
- - **Tier 2 (safe writes):** require an explicit `confirm: true` arg. The JSON schema documents this on every write tool. Start, stop, reboot, snapshot create, run backup all live here. A hallucinated tool call without the confirm flag throws `WriteGateError` before any HTTP traffic.
129
- - **Tier 3 (destructive):** not implemented in v1. When added, ops like snapshot rollback, resource deletion, and storage destruction will additionally require `destructive: true`. The model cannot bypass either gate from a hallucinated call.
149
+ - **Tier 1 (reads):** open. No confirm flag needed. Status, listings, usage, recent tasks, backup inventory, template inventory.
150
+ - **Tier 2 (safe writes):** require an explicit `confirm: true` arg. The JSON schema documents this on every write tool. Start, stop, reboot, snapshot create, run backup, create container, create VM, clone live here. A hallucinated tool call without the confirm flag throws `WriteGateError` before any HTTP traffic.
151
+ - **Tier 3 (destructive):** require `confirm: true` + `destructive: true` + the env flag `PROXMOX_ENABLE_DESTRUCTIVE=1` on the MCP process. Permanent resource deletion, snapshot deletion, and non-graceful force-stop live here.
152
+
153
+ ### Destructive operations env gate
154
+
155
+ Tier 3 destructive tools (`proxmox_destroy_resource`, `proxmox_delete_snapshot`, `proxmox_force_stop_resource`) require an additional safety gate beyond the per-tool `confirm: true` + `destructive: true` args: the env var `PROXMOX_ENABLE_DESTRUCTIVE=1` must be set on the MCP process. Without it, the tools throw `WriteGateError` before any HTTP call is made.
156
+
157
+ This is intentional: destructive ops are rare. The env flag is a coarse "I am actively doing smoke-test cycles" toggle. Leave it unset day-to-day; flip it only when actively destroying resources is part of the workflow.
130
158
 
131
159
  **API token scope recommendation:** start with a read-only token (PVE Datastore.Audit + VM.Audit + Sys.Audit) and verify the read tools work end-to-end. Grade up to write privileges (VM.PowerMgmt, VM.Snapshot, VM.Backup) only after you've confirmed the redactor is masking your secret in your transcripts and that the model is honoring the confirm gate. Tokens are tied to a PVE user and can be revoked instantly from the Datacenter > Permissions > API Tokens UI.
132
160
 
package/dist/index.js CHANGED
@@ -67,6 +67,9 @@ var ProxmoxClient = class {
67
67
  async post(path, body) {
68
68
  return this.request("POST", path, body);
69
69
  }
70
+ async delete(path) {
71
+ return this.request("DELETE", path);
72
+ }
70
73
  async request(method, path, body) {
71
74
  const url = this.cfg.url + "/api2/json" + path;
72
75
  const headers = { authorization: this.authHeader };
@@ -179,6 +182,16 @@ async function resolveResource(client, vmid) {
179
182
  }
180
183
  return { node: matches[0].node, type: matches[0].type };
181
184
  }
185
+ function parseTaskUpid(upid) {
186
+ if (typeof upid !== "string" || !upid.startsWith("UPID:")) {
187
+ throw new Error(`invalid UPID format: ${upid}`);
188
+ }
189
+ const parts = upid.split(":");
190
+ if (parts.length < 8) throw new Error(`invalid UPID format: ${upid}`);
191
+ const node = parts[1];
192
+ if (!node) throw new Error(`UPID missing node segment: ${upid}`);
193
+ return { node };
194
+ }
182
195
 
183
196
  // src/tools/proxmox_status.ts
184
197
  var Schema = Type.Object({}, { additionalProperties: false });
@@ -389,6 +402,21 @@ function assertConfirmedWrite(args, toolName) {
389
402
  throw new WriteGateError(`${toolName} is a write operation. Pass {"confirm": true} to proceed.`);
390
403
  }
391
404
  }
405
+ function assertDestructive(args, toolName) {
406
+ if (args.confirm !== true || args.destructive !== true) {
407
+ throw new WriteGateError(
408
+ `${toolName} is a destructive operation. Pass {"confirm": true, "destructive": true} to proceed.`
409
+ );
410
+ }
411
+ }
412
+ function assertEnvFlag(envKey, toolName, env = process.env) {
413
+ const value = env[envKey];
414
+ if (!value || !["true", "1", "yes"].includes(value.toLowerCase())) {
415
+ throw new WriteGateError(
416
+ `${toolName} requires env flag ${envKey}=1 to be set. This is a destructive operation gate independent of the confirm/destructive args.`
417
+ );
418
+ }
419
+ }
392
420
 
393
421
  // src/tools/proxmox_start_resource.ts
394
422
  var Schema8 = Type8.Object(
@@ -595,6 +623,497 @@ function createProxmoxRunBackupTool(getClient) {
595
623
  };
596
624
  }
597
625
 
626
+ // src/tools/proxmox_get_task_status.ts
627
+ import { Type as Type13 } from "@sinclair/typebox";
628
+ var Schema13 = Type13.Object(
629
+ {
630
+ upid: Type13.String({
631
+ minLength: 1,
632
+ description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
633
+ })
634
+ },
635
+ { additionalProperties: false }
636
+ );
637
+ function createProxmoxGetTaskStatusTool(getClient) {
638
+ return {
639
+ name: "proxmox_get_task_status",
640
+ label: "proxmox: get task status",
641
+ 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,
643
+ execute: async (_id, raw) => {
644
+ const args = raw;
645
+ const { node } = parseTaskUpid(args.upid);
646
+ const client = getClient();
647
+ const status = await client.get(
648
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/status`
649
+ );
650
+ return jsonToolResult(status);
651
+ }
652
+ };
653
+ }
654
+
655
+ // src/tools/proxmox_get_task_log.ts
656
+ import { Type as Type14 } from "@sinclair/typebox";
657
+ var Schema14 = Type14.Object(
658
+ {
659
+ upid: Type14.String({
660
+ minLength: 1,
661
+ description: "Task UPID returned by a prior write tool."
662
+ }),
663
+ start: Type14.Optional(
664
+ Type14.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
665
+ ),
666
+ limit: Type14.Optional(
667
+ Type14.Integer({
668
+ minimum: 1,
669
+ maximum: 500,
670
+ description: "Max lines to return (default 50, max 500)."
671
+ })
672
+ )
673
+ },
674
+ { additionalProperties: false }
675
+ );
676
+ function createProxmoxGetTaskLogTool(getClient) {
677
+ return {
678
+ name: "proxmox_get_task_log",
679
+ label: "proxmox: get task log",
680
+ 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,
682
+ execute: async (_id, raw) => {
683
+ const args = raw;
684
+ const { node } = parseTaskUpid(args.upid);
685
+ const start = args.start ?? 0;
686
+ const limit = args.limit ?? 50;
687
+ const client = getClient();
688
+ const lines = await client.get(
689
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/log?start=${start}&limit=${limit}`
690
+ );
691
+ return jsonToolResult({ lines, total: lines.length });
692
+ }
693
+ };
694
+ }
695
+
696
+ // src/tools/proxmox_list_templates.ts
697
+ import { Type as Type15 } from "@sinclair/typebox";
698
+ var Schema15 = Type15.Object(
699
+ {
700
+ node: Type15.Optional(
701
+ Type15.String({ minLength: 1, description: "Node to query (defaults to first node)." })
702
+ ),
703
+ storage: Type15.Optional(
704
+ Type15.String({ minLength: 1, description: "Storage to query (defaults to 'local')." })
705
+ ),
706
+ kind: Type15.Optional(
707
+ Type15.Union(
708
+ [Type15.Literal("vztmpl"), Type15.Literal("iso"), Type15.Literal("both")],
709
+ { description: "Template kind: 'vztmpl' (CT templates), 'iso' (VM ISOs), or 'both'. Defaults to 'both'." }
710
+ )
711
+ )
712
+ },
713
+ { additionalProperties: false }
714
+ );
715
+ function createProxmoxListTemplatesTool(getClient) {
716
+ return {
717
+ name: "proxmox_list_templates",
718
+ label: "proxmox: list templates",
719
+ 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,
721
+ execute: async (_id, raw) => {
722
+ const args = raw;
723
+ const client = getClient();
724
+ let node = args.node;
725
+ if (!node) {
726
+ const nodes = await client.get("/cluster/resources?type=node");
727
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
728
+ node = nodes[0].node;
729
+ }
730
+ const storage = args.storage ?? "local";
731
+ const kind = args.kind ?? "both";
732
+ const out = {
733
+ node,
734
+ storage
735
+ };
736
+ if (kind === "vztmpl" || kind === "both") {
737
+ out.container_templates = await client.get(
738
+ `/nodes/${node}/storage/${storage}/content?content=vztmpl`
739
+ );
740
+ }
741
+ if (kind === "iso" || kind === "both") {
742
+ out.vm_isos = await client.get(
743
+ `/nodes/${node}/storage/${storage}/content?content=iso`
744
+ );
745
+ }
746
+ return jsonToolResult(out);
747
+ }
748
+ };
749
+ }
750
+
751
+ // src/tools/proxmox_create_container.ts
752
+ import { Type as Type16 } from "@sinclair/typebox";
753
+ var Schema16 = Type16.Object(
754
+ {
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({
758
+ minLength: 1,
759
+ description: "OS template volid (e.g. 'local:vztmpl/ubuntu-24.04-standard_*.tar.zst')."
760
+ }),
761
+ node: Type16.Optional(
762
+ Type16.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
763
+ ),
764
+ storage: Type16.Optional(
765
+ Type16.String({ minLength: 1, description: "Root storage (default 'local-lvm')." })
766
+ ),
767
+ memory: Type16.Optional(
768
+ Type16.Integer({ minimum: 16, description: "Memory in MiB (default 512)." })
769
+ ),
770
+ cores: Type16.Optional(
771
+ Type16.Integer({ minimum: 1, description: "CPU cores (default 1)." })
772
+ ),
773
+ rootfs_size: Type16.Optional(
774
+ Type16.String({ minLength: 1, description: "Root filesystem size in GB (default '8')." })
775
+ ),
776
+ net: Type16.Optional(
777
+ Type16.String({
778
+ minLength: 1,
779
+ description: "Network config for net0 (default 'name=eth0,bridge=vmbr0,ip=dhcp')."
780
+ })
781
+ ),
782
+ start: Type16.Optional(
783
+ Type16.Boolean({ description: "Start after create (default false)." })
784
+ ),
785
+ password: Type16.Optional(
786
+ Type16.String({ description: "Root password (optional)." })
787
+ ),
788
+ ssh_public_keys: Type16.Optional(
789
+ Type16.String({ description: "SSH public keys (optional)." })
790
+ ),
791
+ confirm: Type16.Boolean({
792
+ description: "Must be true to write. Tier-2 safe-write gate."
793
+ })
794
+ },
795
+ { additionalProperties: false }
796
+ );
797
+ var NAME6 = "proxmox_create_container";
798
+ function createProxmoxCreateContainerTool(getClient) {
799
+ return {
800
+ name: NAME6,
801
+ label: "proxmox: create container",
802
+ 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,
804
+ execute: async (_id, raw) => {
805
+ assertConfirmedWrite(raw, NAME6);
806
+ const args = raw;
807
+ const client = getClient();
808
+ let node = args.node;
809
+ if (!node) {
810
+ const nodes = await client.get("/cluster/resources?type=node");
811
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
812
+ node = nodes[0].node;
813
+ }
814
+ const storage = args.storage ?? "local-lvm";
815
+ const rootfsSize = args.rootfs_size ?? "8";
816
+ const body = {
817
+ vmid: args.vmid,
818
+ hostname: args.hostname,
819
+ ostemplate: args.ostemplate,
820
+ storage,
821
+ memory: args.memory ?? 512,
822
+ cores: args.cores ?? 1,
823
+ rootfs: `${storage}:${rootfsSize}`,
824
+ net0: args.net ?? "name=eth0,bridge=vmbr0,ip=dhcp",
825
+ start: args.start ? 1 : 0
826
+ };
827
+ if (typeof args.password === "string" && args.password.length > 0) {
828
+ body.password = args.password;
829
+ }
830
+ if (typeof args.ssh_public_keys === "string" && args.ssh_public_keys.length > 0) {
831
+ body["ssh-public-keys"] = args.ssh_public_keys;
832
+ }
833
+ const upid = await client.post(`/nodes/${node}/lxc`, body);
834
+ return jsonToolResult({
835
+ vmid: args.vmid,
836
+ node,
837
+ hostname: args.hostname,
838
+ upid
839
+ });
840
+ }
841
+ };
842
+ }
843
+
844
+ // src/tools/proxmox_create_vm.ts
845
+ import { Type as Type17 } from "@sinclair/typebox";
846
+ var Schema17 = Type17.Object(
847
+ {
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)." })
852
+ ),
853
+ memory: Type17.Optional(
854
+ Type17.Integer({ minimum: 16, description: "Memory in MiB (default 2048)." })
855
+ ),
856
+ cores: Type17.Optional(
857
+ Type17.Integer({ minimum: 1, description: "CPU cores (default 2)." })
858
+ ),
859
+ iso: Type17.Optional(
860
+ Type17.String({
861
+ minLength: 1,
862
+ description: "ISO volid for install media (e.g. 'local:iso/ubuntu-24.04.iso'). If set, attaches as ide2 cdrom."
863
+ })
864
+ ),
865
+ disk_size: Type17.Optional(
866
+ Type17.String({ minLength: 1, description: "Primary disk size in GB on scsi0 (default '32')." })
867
+ ),
868
+ storage: Type17.Optional(
869
+ Type17.String({ minLength: 1, description: "Disk storage (default 'local-lvm')." })
870
+ ),
871
+ net: Type17.Optional(
872
+ Type17.String({
873
+ minLength: 1,
874
+ description: "Network config for net0 (default 'model=virtio,bridge=vmbr0')."
875
+ })
876
+ ),
877
+ start: Type17.Optional(
878
+ Type17.Boolean({ description: "Start after create (default false)." })
879
+ ),
880
+ confirm: Type17.Boolean({
881
+ description: "Must be true to write. Tier-2 safe-write gate."
882
+ })
883
+ },
884
+ { additionalProperties: false }
885
+ );
886
+ var NAME7 = "proxmox_create_vm";
887
+ function createProxmoxCreateVmTool(getClient) {
888
+ return {
889
+ name: NAME7,
890
+ label: "proxmox: create vm",
891
+ 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,
893
+ execute: async (_id, raw) => {
894
+ assertConfirmedWrite(raw, NAME7);
895
+ const args = raw;
896
+ const client = getClient();
897
+ let node = args.node;
898
+ if (!node) {
899
+ const nodes = await client.get("/cluster/resources?type=node");
900
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
901
+ node = nodes[0].node;
902
+ }
903
+ const storage = args.storage ?? "local-lvm";
904
+ const diskSize = args.disk_size ?? "32";
905
+ const body = {
906
+ vmid: args.vmid,
907
+ name: args.name,
908
+ memory: args.memory ?? 2048,
909
+ cores: args.cores ?? 2,
910
+ scsi0: `${storage}:${diskSize}`,
911
+ net0: args.net ?? "model=virtio,bridge=vmbr0",
912
+ start: args.start ? 1 : 0
913
+ };
914
+ if (typeof args.iso === "string" && args.iso.length > 0) {
915
+ body.ide2 = `${args.iso},media=cdrom`;
916
+ }
917
+ const upid = await client.post(`/nodes/${node}/qemu`, body);
918
+ return jsonToolResult({
919
+ vmid: args.vmid,
920
+ node,
921
+ name: args.name,
922
+ upid
923
+ });
924
+ }
925
+ };
926
+ }
927
+
928
+ // src/tools/proxmox_clone_resource.ts
929
+ import { Type as Type18 } from "@sinclair/typebox";
930
+ var Schema18 = Type18.Object(
931
+ {
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." })
937
+ ),
938
+ storage: Type18.Optional(
939
+ Type18.String({ minLength: 1, description: "Target storage (default: same as source)." })
940
+ ),
941
+ snapname: Type18.Optional(
942
+ Type18.String({ minLength: 1, description: "Clone from a named snapshot (optional)." })
943
+ ),
944
+ confirm: Type18.Boolean({
945
+ description: "Must be true to write. Tier-2 safe-write gate."
946
+ })
947
+ },
948
+ { additionalProperties: false }
949
+ );
950
+ var NAME8 = "proxmox_clone_resource";
951
+ function createProxmoxCloneResourceTool(getClient) {
952
+ return {
953
+ name: NAME8,
954
+ label: "proxmox: clone resource",
955
+ 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,
957
+ execute: async (_id, raw) => {
958
+ assertConfirmedWrite(raw, NAME8);
959
+ const args = raw;
960
+ const client = getClient();
961
+ const { node, type } = await resolveResource(client, args.source_vmid);
962
+ const body = {
963
+ newid: args.new_vmid,
964
+ name: args.name,
965
+ full: args.full !== false ? 1 : 0
966
+ };
967
+ if (typeof args.storage === "string" && args.storage.length > 0) {
968
+ body.storage = args.storage;
969
+ }
970
+ if (typeof args.snapname === "string" && args.snapname.length > 0) {
971
+ body.snapname = args.snapname;
972
+ }
973
+ const upid = await client.post(
974
+ `/nodes/${node}/${type}/${args.source_vmid}/clone`,
975
+ body
976
+ );
977
+ return jsonToolResult({
978
+ source_vmid: args.source_vmid,
979
+ new_vmid: args.new_vmid,
980
+ node,
981
+ type,
982
+ name: args.name,
983
+ upid
984
+ });
985
+ }
986
+ };
987
+ }
988
+
989
+ // src/tools/proxmox_destroy_resource.ts
990
+ import { Type as Type19 } from "@sinclair/typebox";
991
+ var Schema19 = Type19.Object(
992
+ {
993
+ vmid: Type19.Integer({ minimum: 1, description: "Container or VM ID to destroy." }),
994
+ purge: Type19.Optional(
995
+ Type19.Boolean({
996
+ description: "Remove from PVE backup/replication config too (default true)."
997
+ })
998
+ ),
999
+ force: Type19.Optional(
1000
+ Type19.Boolean({
1001
+ description: "Allow destroying a running VM (default false)."
1002
+ })
1003
+ ),
1004
+ confirm: Type19.Boolean({
1005
+ description: "Must be true. Tier-3 destructive gate."
1006
+ }),
1007
+ destructive: Type19.Boolean({
1008
+ description: "Must be true. Tier-3 destructive gate."
1009
+ })
1010
+ },
1011
+ { additionalProperties: false }
1012
+ );
1013
+ var NAME9 = "proxmox_destroy_resource";
1014
+ function createProxmoxDestroyResourceTool(getClient) {
1015
+ return {
1016
+ name: NAME9,
1017
+ label: "proxmox: destroy resource",
1018
+ 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,
1020
+ execute: async (_id, raw) => {
1021
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME9);
1022
+ assertDestructive(raw, NAME9);
1023
+ const args = raw;
1024
+ const purge = args.purge !== false;
1025
+ const force = args.force === true;
1026
+ const client = getClient();
1027
+ const { node, type } = await resolveResource(client, args.vmid);
1028
+ const params = new URLSearchParams();
1029
+ if (purge) {
1030
+ params.append("purge", "1");
1031
+ params.append("destroy-unreferenced-disks", "1");
1032
+ }
1033
+ if (force && type === "lxc") params.append("force", "1");
1034
+ 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 });
1038
+ }
1039
+ };
1040
+ }
1041
+
1042
+ // src/tools/proxmox_delete_snapshot.ts
1043
+ import { Type as Type20 } from "@sinclair/typebox";
1044
+ var Schema20 = Type20.Object(
1045
+ {
1046
+ vmid: Type20.Integer({ minimum: 1, description: "Container or VM ID." }),
1047
+ snapname: Type20.String({
1048
+ minLength: 1,
1049
+ description: "Snapshot name to delete."
1050
+ }),
1051
+ confirm: Type20.Boolean({
1052
+ description: "Must be true. Tier-3 destructive gate."
1053
+ }),
1054
+ destructive: Type20.Boolean({
1055
+ description: "Must be true. Tier-3 destructive gate."
1056
+ })
1057
+ },
1058
+ { additionalProperties: false }
1059
+ );
1060
+ var NAME10 = "proxmox_delete_snapshot";
1061
+ function createProxmoxDeleteSnapshotTool(getClient) {
1062
+ return {
1063
+ name: NAME10,
1064
+ label: "proxmox: delete snapshot",
1065
+ 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,
1067
+ execute: async (_id, raw) => {
1068
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME10);
1069
+ assertDestructive(raw, NAME10);
1070
+ const args = raw;
1071
+ const client = getClient();
1072
+ const { node, type } = await resolveResource(client, args.vmid);
1073
+ const upid = await client.delete(
1074
+ `/nodes/${node}/${type}/${args.vmid}/snapshot/${encodeURIComponent(args.snapname)}`
1075
+ );
1076
+ return jsonToolResult({ vmid: args.vmid, node, type, snapname: args.snapname, upid });
1077
+ }
1078
+ };
1079
+ }
1080
+
1081
+ // src/tools/proxmox_force_stop_resource.ts
1082
+ import { Type as Type21 } from "@sinclair/typebox";
1083
+ var Schema21 = Type21.Object(
1084
+ {
1085
+ vmid: Type21.Integer({ minimum: 1, description: "Container or VM ID to hard-stop." }),
1086
+ confirm: Type21.Boolean({
1087
+ description: "Must be true. Tier-3 destructive gate."
1088
+ }),
1089
+ destructive: Type21.Boolean({
1090
+ description: "Must be true. Tier-3 destructive gate."
1091
+ })
1092
+ },
1093
+ { additionalProperties: false }
1094
+ );
1095
+ var NAME11 = "proxmox_force_stop_resource";
1096
+ function createProxmoxForceStopResourceTool(getClient) {
1097
+ return {
1098
+ name: NAME11,
1099
+ label: "proxmox: force stop resource",
1100
+ 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,
1102
+ execute: async (_id, raw) => {
1103
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME11);
1104
+ assertDestructive(raw, NAME11);
1105
+ const args = raw;
1106
+ const client = getClient();
1107
+ const { node, type } = await resolveResource(client, args.vmid);
1108
+ const upid = await client.post(
1109
+ `/nodes/${node}/${type}/${args.vmid}/status/stop`,
1110
+ {}
1111
+ );
1112
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
1113
+ }
1114
+ };
1115
+ }
1116
+
598
1117
  // index.ts
599
1118
  function withRedactedErrors(tool) {
600
1119
  const orig = tool.execute.bind(tool);
@@ -637,6 +1156,15 @@ var index_default = definePluginEntry({
637
1156
  register(createProxmoxRebootResourceTool(getClient));
638
1157
  register(createProxmoxSnapshotResourceTool(getClient));
639
1158
  register(createProxmoxRunBackupTool(getClient));
1159
+ register(createProxmoxGetTaskStatusTool(getClient));
1160
+ register(createProxmoxGetTaskLogTool(getClient));
1161
+ register(createProxmoxListTemplatesTool(getClient));
1162
+ register(createProxmoxCreateContainerTool(getClient));
1163
+ register(createProxmoxCreateVmTool(getClient));
1164
+ register(createProxmoxCloneResourceTool(getClient));
1165
+ register(createProxmoxDestroyResourceTool(getClient));
1166
+ register(createProxmoxDeleteSnapshotTool(getClient));
1167
+ register(createProxmoxForceStopResourceTool(getClient));
640
1168
  }
641
1169
  });
642
1170
  export {
@@ -69,6 +69,9 @@ var ProxmoxClient = class {
69
69
  async post(path, body) {
70
70
  return this.request("POST", path, body);
71
71
  }
72
+ async delete(path) {
73
+ return this.request("DELETE", path);
74
+ }
72
75
  async request(method, path, body) {
73
76
  const url = this.cfg.url + "/api2/json" + path;
74
77
  const headers = { authorization: this.authHeader };
@@ -181,6 +184,16 @@ async function resolveResource(client, vmid) {
181
184
  }
182
185
  return { node: matches[0].node, type: matches[0].type };
183
186
  }
187
+ function parseTaskUpid(upid) {
188
+ if (typeof upid !== "string" || !upid.startsWith("UPID:")) {
189
+ throw new Error(`invalid UPID format: ${upid}`);
190
+ }
191
+ const parts = upid.split(":");
192
+ if (parts.length < 8) throw new Error(`invalid UPID format: ${upid}`);
193
+ const node = parts[1];
194
+ if (!node) throw new Error(`UPID missing node segment: ${upid}`);
195
+ return { node };
196
+ }
184
197
 
185
198
  // src/tools/proxmox_status.ts
186
199
  var Schema = Type.Object({}, { additionalProperties: false });
@@ -391,6 +404,21 @@ function assertConfirmedWrite(args, toolName) {
391
404
  throw new WriteGateError(`${toolName} is a write operation. Pass {"confirm": true} to proceed.`);
392
405
  }
393
406
  }
407
+ function assertDestructive(args, toolName) {
408
+ if (args.confirm !== true || args.destructive !== true) {
409
+ throw new WriteGateError(
410
+ `${toolName} is a destructive operation. Pass {"confirm": true, "destructive": true} to proceed.`
411
+ );
412
+ }
413
+ }
414
+ function assertEnvFlag(envKey, toolName, env = process.env) {
415
+ const value = env[envKey];
416
+ if (!value || !["true", "1", "yes"].includes(value.toLowerCase())) {
417
+ throw new WriteGateError(
418
+ `${toolName} requires env flag ${envKey}=1 to be set. This is a destructive operation gate independent of the confirm/destructive args.`
419
+ );
420
+ }
421
+ }
394
422
 
395
423
  // src/tools/proxmox_start_resource.ts
396
424
  var Schema8 = Type8.Object(
@@ -597,6 +625,497 @@ function createProxmoxRunBackupTool(getClient2) {
597
625
  };
598
626
  }
599
627
 
628
+ // src/tools/proxmox_get_task_status.ts
629
+ import { Type as Type13 } from "@sinclair/typebox";
630
+ var Schema13 = Type13.Object(
631
+ {
632
+ upid: Type13.String({
633
+ minLength: 1,
634
+ description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
635
+ })
636
+ },
637
+ { additionalProperties: false }
638
+ );
639
+ function createProxmoxGetTaskStatusTool(getClient2) {
640
+ return {
641
+ name: "proxmox_get_task_status",
642
+ label: "proxmox: get task status",
643
+ 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.",
644
+ parameters: Schema13,
645
+ execute: async (_id, raw) => {
646
+ const args = raw;
647
+ const { node } = parseTaskUpid(args.upid);
648
+ const client = getClient2();
649
+ const status = await client.get(
650
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/status`
651
+ );
652
+ return jsonToolResult(status);
653
+ }
654
+ };
655
+ }
656
+
657
+ // src/tools/proxmox_get_task_log.ts
658
+ import { Type as Type14 } from "@sinclair/typebox";
659
+ var Schema14 = Type14.Object(
660
+ {
661
+ upid: Type14.String({
662
+ minLength: 1,
663
+ description: "Task UPID returned by a prior write tool."
664
+ }),
665
+ start: Type14.Optional(
666
+ Type14.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
667
+ ),
668
+ limit: Type14.Optional(
669
+ Type14.Integer({
670
+ minimum: 1,
671
+ maximum: 500,
672
+ description: "Max lines to return (default 50, max 500)."
673
+ })
674
+ )
675
+ },
676
+ { additionalProperties: false }
677
+ );
678
+ function createProxmoxGetTaskLogTool(getClient2) {
679
+ return {
680
+ name: "proxmox_get_task_log",
681
+ label: "proxmox: get task log",
682
+ 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 }.",
683
+ parameters: Schema14,
684
+ execute: async (_id, raw) => {
685
+ const args = raw;
686
+ const { node } = parseTaskUpid(args.upid);
687
+ const start = args.start ?? 0;
688
+ const limit = args.limit ?? 50;
689
+ const client = getClient2();
690
+ const lines = await client.get(
691
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/log?start=${start}&limit=${limit}`
692
+ );
693
+ return jsonToolResult({ lines, total: lines.length });
694
+ }
695
+ };
696
+ }
697
+
698
+ // src/tools/proxmox_list_templates.ts
699
+ import { Type as Type15 } from "@sinclair/typebox";
700
+ var Schema15 = Type15.Object(
701
+ {
702
+ node: Type15.Optional(
703
+ Type15.String({ minLength: 1, description: "Node to query (defaults to first node)." })
704
+ ),
705
+ storage: Type15.Optional(
706
+ Type15.String({ minLength: 1, description: "Storage to query (defaults to 'local')." })
707
+ ),
708
+ kind: Type15.Optional(
709
+ Type15.Union(
710
+ [Type15.Literal("vztmpl"), Type15.Literal("iso"), Type15.Literal("both")],
711
+ { description: "Template kind: 'vztmpl' (CT templates), 'iso' (VM ISOs), or 'both'. Defaults to 'both'." }
712
+ )
713
+ )
714
+ },
715
+ { additionalProperties: false }
716
+ );
717
+ function createProxmoxListTemplatesTool(getClient2) {
718
+ return {
719
+ name: "proxmox_list_templates",
720
+ label: "proxmox: list templates",
721
+ 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'.",
722
+ parameters: Schema15,
723
+ execute: async (_id, raw) => {
724
+ const args = raw;
725
+ const client = getClient2();
726
+ let node = args.node;
727
+ if (!node) {
728
+ const nodes = await client.get("/cluster/resources?type=node");
729
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
730
+ node = nodes[0].node;
731
+ }
732
+ const storage = args.storage ?? "local";
733
+ const kind = args.kind ?? "both";
734
+ const out = {
735
+ node,
736
+ storage
737
+ };
738
+ if (kind === "vztmpl" || kind === "both") {
739
+ out.container_templates = await client.get(
740
+ `/nodes/${node}/storage/${storage}/content?content=vztmpl`
741
+ );
742
+ }
743
+ if (kind === "iso" || kind === "both") {
744
+ out.vm_isos = await client.get(
745
+ `/nodes/${node}/storage/${storage}/content?content=iso`
746
+ );
747
+ }
748
+ return jsonToolResult(out);
749
+ }
750
+ };
751
+ }
752
+
753
+ // src/tools/proxmox_create_container.ts
754
+ import { Type as Type16 } from "@sinclair/typebox";
755
+ var Schema16 = Type16.Object(
756
+ {
757
+ vmid: Type16.Integer({ minimum: 1, description: "VMID for the new container." }),
758
+ hostname: Type16.String({ minLength: 1, description: "Container hostname." }),
759
+ ostemplate: Type16.String({
760
+ minLength: 1,
761
+ description: "OS template volid (e.g. 'local:vztmpl/ubuntu-24.04-standard_*.tar.zst')."
762
+ }),
763
+ node: Type16.Optional(
764
+ Type16.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
765
+ ),
766
+ storage: Type16.Optional(
767
+ Type16.String({ minLength: 1, description: "Root storage (default 'local-lvm')." })
768
+ ),
769
+ memory: Type16.Optional(
770
+ Type16.Integer({ minimum: 16, description: "Memory in MiB (default 512)." })
771
+ ),
772
+ cores: Type16.Optional(
773
+ Type16.Integer({ minimum: 1, description: "CPU cores (default 1)." })
774
+ ),
775
+ rootfs_size: Type16.Optional(
776
+ Type16.String({ minLength: 1, description: "Root filesystem size in GB (default '8')." })
777
+ ),
778
+ net: Type16.Optional(
779
+ Type16.String({
780
+ minLength: 1,
781
+ description: "Network config for net0 (default 'name=eth0,bridge=vmbr0,ip=dhcp')."
782
+ })
783
+ ),
784
+ start: Type16.Optional(
785
+ Type16.Boolean({ description: "Start after create (default false)." })
786
+ ),
787
+ password: Type16.Optional(
788
+ Type16.String({ description: "Root password (optional)." })
789
+ ),
790
+ ssh_public_keys: Type16.Optional(
791
+ Type16.String({ description: "SSH public keys (optional)." })
792
+ ),
793
+ confirm: Type16.Boolean({
794
+ description: "Must be true to write. Tier-2 safe-write gate."
795
+ })
796
+ },
797
+ { additionalProperties: false }
798
+ );
799
+ var NAME6 = "proxmox_create_container";
800
+ function createProxmoxCreateContainerTool(getClient2) {
801
+ return {
802
+ name: NAME6,
803
+ label: "proxmox: create container",
804
+ 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.",
805
+ parameters: Schema16,
806
+ execute: async (_id, raw) => {
807
+ assertConfirmedWrite(raw, NAME6);
808
+ const args = raw;
809
+ const client = getClient2();
810
+ let node = args.node;
811
+ if (!node) {
812
+ const nodes = await client.get("/cluster/resources?type=node");
813
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
814
+ node = nodes[0].node;
815
+ }
816
+ const storage = args.storage ?? "local-lvm";
817
+ const rootfsSize = args.rootfs_size ?? "8";
818
+ const body = {
819
+ vmid: args.vmid,
820
+ hostname: args.hostname,
821
+ ostemplate: args.ostemplate,
822
+ storage,
823
+ memory: args.memory ?? 512,
824
+ cores: args.cores ?? 1,
825
+ rootfs: `${storage}:${rootfsSize}`,
826
+ net0: args.net ?? "name=eth0,bridge=vmbr0,ip=dhcp",
827
+ start: args.start ? 1 : 0
828
+ };
829
+ if (typeof args.password === "string" && args.password.length > 0) {
830
+ body.password = args.password;
831
+ }
832
+ if (typeof args.ssh_public_keys === "string" && args.ssh_public_keys.length > 0) {
833
+ body["ssh-public-keys"] = args.ssh_public_keys;
834
+ }
835
+ const upid = await client.post(`/nodes/${node}/lxc`, body);
836
+ return jsonToolResult({
837
+ vmid: args.vmid,
838
+ node,
839
+ hostname: args.hostname,
840
+ upid
841
+ });
842
+ }
843
+ };
844
+ }
845
+
846
+ // src/tools/proxmox_create_vm.ts
847
+ import { Type as Type17 } from "@sinclair/typebox";
848
+ var Schema17 = Type17.Object(
849
+ {
850
+ vmid: Type17.Integer({ minimum: 1, description: "VMID for the new VM." }),
851
+ name: Type17.String({ minLength: 1, description: "VM display name." }),
852
+ node: Type17.Optional(
853
+ Type17.String({ minLength: 1, description: "Node to create on (defaults to first node)." })
854
+ ),
855
+ memory: Type17.Optional(
856
+ Type17.Integer({ minimum: 16, description: "Memory in MiB (default 2048)." })
857
+ ),
858
+ cores: Type17.Optional(
859
+ Type17.Integer({ minimum: 1, description: "CPU cores (default 2)." })
860
+ ),
861
+ iso: Type17.Optional(
862
+ Type17.String({
863
+ minLength: 1,
864
+ description: "ISO volid for install media (e.g. 'local:iso/ubuntu-24.04.iso'). If set, attaches as ide2 cdrom."
865
+ })
866
+ ),
867
+ disk_size: Type17.Optional(
868
+ Type17.String({ minLength: 1, description: "Primary disk size in GB on scsi0 (default '32')." })
869
+ ),
870
+ storage: Type17.Optional(
871
+ Type17.String({ minLength: 1, description: "Disk storage (default 'local-lvm')." })
872
+ ),
873
+ net: Type17.Optional(
874
+ Type17.String({
875
+ minLength: 1,
876
+ description: "Network config for net0 (default 'model=virtio,bridge=vmbr0')."
877
+ })
878
+ ),
879
+ start: Type17.Optional(
880
+ Type17.Boolean({ description: "Start after create (default false)." })
881
+ ),
882
+ confirm: Type17.Boolean({
883
+ description: "Must be true to write. Tier-2 safe-write gate."
884
+ })
885
+ },
886
+ { additionalProperties: false }
887
+ );
888
+ var NAME7 = "proxmox_create_vm";
889
+ function createProxmoxCreateVmTool(getClient2) {
890
+ return {
891
+ name: NAME7,
892
+ label: "proxmox: create vm",
893
+ 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.",
894
+ parameters: Schema17,
895
+ execute: async (_id, raw) => {
896
+ assertConfirmedWrite(raw, NAME7);
897
+ const args = raw;
898
+ const client = getClient2();
899
+ let node = args.node;
900
+ if (!node) {
901
+ const nodes = await client.get("/cluster/resources?type=node");
902
+ if (nodes.length === 0) throw new Error("no nodes found in cluster resources");
903
+ node = nodes[0].node;
904
+ }
905
+ const storage = args.storage ?? "local-lvm";
906
+ const diskSize = args.disk_size ?? "32";
907
+ const body = {
908
+ vmid: args.vmid,
909
+ name: args.name,
910
+ memory: args.memory ?? 2048,
911
+ cores: args.cores ?? 2,
912
+ scsi0: `${storage}:${diskSize}`,
913
+ net0: args.net ?? "model=virtio,bridge=vmbr0",
914
+ start: args.start ? 1 : 0
915
+ };
916
+ if (typeof args.iso === "string" && args.iso.length > 0) {
917
+ body.ide2 = `${args.iso},media=cdrom`;
918
+ }
919
+ const upid = await client.post(`/nodes/${node}/qemu`, body);
920
+ return jsonToolResult({
921
+ vmid: args.vmid,
922
+ node,
923
+ name: args.name,
924
+ upid
925
+ });
926
+ }
927
+ };
928
+ }
929
+
930
+ // src/tools/proxmox_clone_resource.ts
931
+ import { Type as Type18 } from "@sinclair/typebox";
932
+ var Schema18 = Type18.Object(
933
+ {
934
+ source_vmid: Type18.Integer({ minimum: 1, description: "Source CT/VM ID to clone from." }),
935
+ new_vmid: Type18.Integer({ minimum: 1, description: "VMID for the cloned resource." }),
936
+ name: Type18.String({ minLength: 1, description: "Name/hostname for the new clone." }),
937
+ full: Type18.Optional(
938
+ Type18.Boolean({ description: "Full clone (default true). Set false for a linked clone." })
939
+ ),
940
+ storage: Type18.Optional(
941
+ Type18.String({ minLength: 1, description: "Target storage (default: same as source)." })
942
+ ),
943
+ snapname: Type18.Optional(
944
+ Type18.String({ minLength: 1, description: "Clone from a named snapshot (optional)." })
945
+ ),
946
+ confirm: Type18.Boolean({
947
+ description: "Must be true to write. Tier-2 safe-write gate."
948
+ })
949
+ },
950
+ { additionalProperties: false }
951
+ );
952
+ var NAME8 = "proxmox_clone_resource";
953
+ function createProxmoxCloneResourceTool(getClient2) {
954
+ return {
955
+ name: NAME8,
956
+ label: "proxmox: clone resource",
957
+ 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.",
958
+ parameters: Schema18,
959
+ execute: async (_id, raw) => {
960
+ assertConfirmedWrite(raw, NAME8);
961
+ const args = raw;
962
+ const client = getClient2();
963
+ const { node, type } = await resolveResource(client, args.source_vmid);
964
+ const body = {
965
+ newid: args.new_vmid,
966
+ name: args.name,
967
+ full: args.full !== false ? 1 : 0
968
+ };
969
+ if (typeof args.storage === "string" && args.storage.length > 0) {
970
+ body.storage = args.storage;
971
+ }
972
+ if (typeof args.snapname === "string" && args.snapname.length > 0) {
973
+ body.snapname = args.snapname;
974
+ }
975
+ const upid = await client.post(
976
+ `/nodes/${node}/${type}/${args.source_vmid}/clone`,
977
+ body
978
+ );
979
+ return jsonToolResult({
980
+ source_vmid: args.source_vmid,
981
+ new_vmid: args.new_vmid,
982
+ node,
983
+ type,
984
+ name: args.name,
985
+ upid
986
+ });
987
+ }
988
+ };
989
+ }
990
+
991
+ // src/tools/proxmox_destroy_resource.ts
992
+ import { Type as Type19 } from "@sinclair/typebox";
993
+ var Schema19 = Type19.Object(
994
+ {
995
+ vmid: Type19.Integer({ minimum: 1, description: "Container or VM ID to destroy." }),
996
+ purge: Type19.Optional(
997
+ Type19.Boolean({
998
+ description: "Remove from PVE backup/replication config too (default true)."
999
+ })
1000
+ ),
1001
+ force: Type19.Optional(
1002
+ Type19.Boolean({
1003
+ description: "Allow destroying a running VM (default false)."
1004
+ })
1005
+ ),
1006
+ confirm: Type19.Boolean({
1007
+ description: "Must be true. Tier-3 destructive gate."
1008
+ }),
1009
+ destructive: Type19.Boolean({
1010
+ description: "Must be true. Tier-3 destructive gate."
1011
+ })
1012
+ },
1013
+ { additionalProperties: false }
1014
+ );
1015
+ var NAME9 = "proxmox_destroy_resource";
1016
+ function createProxmoxDestroyResourceTool(getClient2) {
1017
+ return {
1018
+ name: NAME9,
1019
+ label: "proxmox: destroy resource",
1020
+ 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.",
1021
+ parameters: Schema19,
1022
+ execute: async (_id, raw) => {
1023
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME9);
1024
+ assertDestructive(raw, NAME9);
1025
+ const args = raw;
1026
+ const purge = args.purge !== false;
1027
+ const force = args.force === true;
1028
+ const client = getClient2();
1029
+ const { node, type } = await resolveResource(client, args.vmid);
1030
+ const params = new URLSearchParams();
1031
+ if (purge) {
1032
+ params.append("purge", "1");
1033
+ params.append("destroy-unreferenced-disks", "1");
1034
+ }
1035
+ if (force && type === "lxc") params.append("force", "1");
1036
+ const qs = params.toString();
1037
+ const path = qs.length > 0 ? `/nodes/${node}/${type}/${args.vmid}?${qs}` : `/nodes/${node}/${type}/${args.vmid}`;
1038
+ const upid = await client.delete(path);
1039
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
1040
+ }
1041
+ };
1042
+ }
1043
+
1044
+ // src/tools/proxmox_delete_snapshot.ts
1045
+ import { Type as Type20 } from "@sinclair/typebox";
1046
+ var Schema20 = Type20.Object(
1047
+ {
1048
+ vmid: Type20.Integer({ minimum: 1, description: "Container or VM ID." }),
1049
+ snapname: Type20.String({
1050
+ minLength: 1,
1051
+ description: "Snapshot name to delete."
1052
+ }),
1053
+ confirm: Type20.Boolean({
1054
+ description: "Must be true. Tier-3 destructive gate."
1055
+ }),
1056
+ destructive: Type20.Boolean({
1057
+ description: "Must be true. Tier-3 destructive gate."
1058
+ })
1059
+ },
1060
+ { additionalProperties: false }
1061
+ );
1062
+ var NAME10 = "proxmox_delete_snapshot";
1063
+ function createProxmoxDeleteSnapshotTool(getClient2) {
1064
+ return {
1065
+ name: NAME10,
1066
+ label: "proxmox: delete snapshot",
1067
+ 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.",
1068
+ parameters: Schema20,
1069
+ execute: async (_id, raw) => {
1070
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME10);
1071
+ assertDestructive(raw, NAME10);
1072
+ const args = raw;
1073
+ const client = getClient2();
1074
+ const { node, type } = await resolveResource(client, args.vmid);
1075
+ const upid = await client.delete(
1076
+ `/nodes/${node}/${type}/${args.vmid}/snapshot/${encodeURIComponent(args.snapname)}`
1077
+ );
1078
+ return jsonToolResult({ vmid: args.vmid, node, type, snapname: args.snapname, upid });
1079
+ }
1080
+ };
1081
+ }
1082
+
1083
+ // src/tools/proxmox_force_stop_resource.ts
1084
+ import { Type as Type21 } from "@sinclair/typebox";
1085
+ var Schema21 = Type21.Object(
1086
+ {
1087
+ vmid: Type21.Integer({ minimum: 1, description: "Container or VM ID to hard-stop." }),
1088
+ confirm: Type21.Boolean({
1089
+ description: "Must be true. Tier-3 destructive gate."
1090
+ }),
1091
+ destructive: Type21.Boolean({
1092
+ description: "Must be true. Tier-3 destructive gate."
1093
+ })
1094
+ },
1095
+ { additionalProperties: false }
1096
+ );
1097
+ var NAME11 = "proxmox_force_stop_resource";
1098
+ function createProxmoxForceStopResourceTool(getClient2) {
1099
+ return {
1100
+ name: NAME11,
1101
+ label: "proxmox: force stop resource",
1102
+ 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.",
1103
+ parameters: Schema21,
1104
+ execute: async (_id, raw) => {
1105
+ assertEnvFlag("PROXMOX_ENABLE_DESTRUCTIVE", NAME11);
1106
+ assertDestructive(raw, NAME11);
1107
+ const args = raw;
1108
+ const client = getClient2();
1109
+ const { node, type } = await resolveResource(client, args.vmid);
1110
+ const upid = await client.post(
1111
+ `/nodes/${node}/${type}/${args.vmid}/status/stop`,
1112
+ {}
1113
+ );
1114
+ return jsonToolResult({ vmid: args.vmid, node, type, upid });
1115
+ }
1116
+ };
1117
+ }
1118
+
600
1119
  // mcp-server.ts
601
1120
  var cfg = resolveConfig(process.env);
602
1121
  registerSecret(cfg.tokenId);
@@ -615,10 +1134,19 @@ var tools = [
615
1134
  createProxmoxStopResourceTool(getClient),
616
1135
  createProxmoxRebootResourceTool(getClient),
617
1136
  createProxmoxSnapshotResourceTool(getClient),
618
- createProxmoxRunBackupTool(getClient)
1137
+ createProxmoxRunBackupTool(getClient),
1138
+ createProxmoxGetTaskStatusTool(getClient),
1139
+ createProxmoxGetTaskLogTool(getClient),
1140
+ createProxmoxListTemplatesTool(getClient),
1141
+ createProxmoxCreateContainerTool(getClient),
1142
+ createProxmoxCreateVmTool(getClient),
1143
+ createProxmoxCloneResourceTool(getClient),
1144
+ createProxmoxDestroyResourceTool(getClient),
1145
+ createProxmoxDeleteSnapshotTool(getClient),
1146
+ createProxmoxForceStopResourceTool(getClient)
619
1147
  ];
620
1148
  var toolMap = new Map(tools.map((t) => [t.name, t]));
621
- var server = new Server({ name: "proxmox-mcp", version: "0.1.0" }, { capabilities: { tools: {} } });
1149
+ var server = new Server({ name: "proxmox-mcp", version: "0.3.0" }, { capabilities: { tools: {} } });
622
1150
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
623
1151
  tools: tools.map((t) => ({ name: t.name, description: t.description, inputSchema: t.parameters }))
624
1152
  }));
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "proxmox",
4
4
  "name": "Proxmox",
5
- "version": "0.1.0",
5
+ "version": "0.3.0",
6
6
  "description": "Proxmox VE read/write tools: status, containers, VMs, backups, lifecycle, snapshots.",
7
7
  "entry": "./dist/index.js",
8
8
  "activation": { "onStartup": true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solomonneas/proxmox-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server exposing Proxmox VE read + safe-write tools",
5
5
  "type": "module",
6
6
  "openclaw": {