@solomonneas/proxmox-mcp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -179,6 +179,16 @@ async function resolveResource(client, vmid) {
179
179
  }
180
180
  return { node: matches[0].node, type: matches[0].type };
181
181
  }
182
+ function parseTaskUpid(upid) {
183
+ if (typeof upid !== "string" || !upid.startsWith("UPID:")) {
184
+ throw new Error(`invalid UPID format: ${upid}`);
185
+ }
186
+ const parts = upid.split(":");
187
+ if (parts.length < 8) throw new Error(`invalid UPID format: ${upid}`);
188
+ const node = parts[1];
189
+ if (!node) throw new Error(`UPID missing node segment: ${upid}`);
190
+ return { node };
191
+ }
182
192
 
183
193
  // src/tools/proxmox_status.ts
184
194
  var Schema = Type.Object({}, { additionalProperties: false });
@@ -595,6 +605,76 @@ function createProxmoxRunBackupTool(getClient) {
595
605
  };
596
606
  }
597
607
 
608
+ // src/tools/proxmox_get_task_status.ts
609
+ import { Type as Type13 } from "@sinclair/typebox";
610
+ var Schema13 = Type13.Object(
611
+ {
612
+ upid: Type13.String({
613
+ minLength: 1,
614
+ description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
615
+ })
616
+ },
617
+ { additionalProperties: false }
618
+ );
619
+ function createProxmoxGetTaskStatusTool(getClient) {
620
+ return {
621
+ name: "proxmox_get_task_status",
622
+ label: "proxmox: get task status",
623
+ 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: Schema13,
625
+ execute: async (_id, raw) => {
626
+ const args = raw;
627
+ const { node } = parseTaskUpid(args.upid);
628
+ const client = getClient();
629
+ const status = await client.get(
630
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/status`
631
+ );
632
+ return jsonToolResult(status);
633
+ }
634
+ };
635
+ }
636
+
637
+ // src/tools/proxmox_get_task_log.ts
638
+ import { Type as Type14 } from "@sinclair/typebox";
639
+ var Schema14 = Type14.Object(
640
+ {
641
+ upid: Type14.String({
642
+ minLength: 1,
643
+ description: "Task UPID returned by a prior write tool."
644
+ }),
645
+ start: Type14.Optional(
646
+ Type14.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
647
+ ),
648
+ limit: Type14.Optional(
649
+ Type14.Integer({
650
+ minimum: 1,
651
+ maximum: 500,
652
+ description: "Max lines to return (default 50, max 500)."
653
+ })
654
+ )
655
+ },
656
+ { additionalProperties: false }
657
+ );
658
+ function createProxmoxGetTaskLogTool(getClient) {
659
+ return {
660
+ name: "proxmox_get_task_log",
661
+ label: "proxmox: get task log",
662
+ 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: Schema14,
664
+ execute: async (_id, raw) => {
665
+ const args = raw;
666
+ const { node } = parseTaskUpid(args.upid);
667
+ const start = args.start ?? 0;
668
+ const limit = args.limit ?? 50;
669
+ const client = getClient();
670
+ const lines = await client.get(
671
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/log?start=${start}&limit=${limit}`
672
+ );
673
+ return jsonToolResult({ lines, total: lines.length });
674
+ }
675
+ };
676
+ }
677
+
598
678
  // index.ts
599
679
  function withRedactedErrors(tool) {
600
680
  const orig = tool.execute.bind(tool);
@@ -637,6 +717,8 @@ var index_default = definePluginEntry({
637
717
  register(createProxmoxRebootResourceTool(getClient));
638
718
  register(createProxmoxSnapshotResourceTool(getClient));
639
719
  register(createProxmoxRunBackupTool(getClient));
720
+ register(createProxmoxGetTaskStatusTool(getClient));
721
+ register(createProxmoxGetTaskLogTool(getClient));
640
722
  }
641
723
  });
642
724
  export {
@@ -181,6 +181,16 @@ async function resolveResource(client, vmid) {
181
181
  }
182
182
  return { node: matches[0].node, type: matches[0].type };
183
183
  }
184
+ function parseTaskUpid(upid) {
185
+ if (typeof upid !== "string" || !upid.startsWith("UPID:")) {
186
+ throw new Error(`invalid UPID format: ${upid}`);
187
+ }
188
+ const parts = upid.split(":");
189
+ if (parts.length < 8) throw new Error(`invalid UPID format: ${upid}`);
190
+ const node = parts[1];
191
+ if (!node) throw new Error(`UPID missing node segment: ${upid}`);
192
+ return { node };
193
+ }
184
194
 
185
195
  // src/tools/proxmox_status.ts
186
196
  var Schema = Type.Object({}, { additionalProperties: false });
@@ -597,6 +607,76 @@ function createProxmoxRunBackupTool(getClient2) {
597
607
  };
598
608
  }
599
609
 
610
+ // src/tools/proxmox_get_task_status.ts
611
+ import { Type as Type13 } from "@sinclair/typebox";
612
+ var Schema13 = Type13.Object(
613
+ {
614
+ upid: Type13.String({
615
+ minLength: 1,
616
+ description: "Task UPID returned by a prior write tool (e.g. start, stop, snapshot, backup)."
617
+ })
618
+ },
619
+ { additionalProperties: false }
620
+ );
621
+ function createProxmoxGetTaskStatusTool(getClient2) {
622
+ return {
623
+ name: "proxmox_get_task_status",
624
+ label: "proxmox: get task status",
625
+ 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.",
626
+ parameters: Schema13,
627
+ execute: async (_id, raw) => {
628
+ const args = raw;
629
+ const { node } = parseTaskUpid(args.upid);
630
+ const client = getClient2();
631
+ const status = await client.get(
632
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/status`
633
+ );
634
+ return jsonToolResult(status);
635
+ }
636
+ };
637
+ }
638
+
639
+ // src/tools/proxmox_get_task_log.ts
640
+ import { Type as Type14 } from "@sinclair/typebox";
641
+ var Schema14 = Type14.Object(
642
+ {
643
+ upid: Type14.String({
644
+ minLength: 1,
645
+ description: "Task UPID returned by a prior write tool."
646
+ }),
647
+ start: Type14.Optional(
648
+ Type14.Integer({ minimum: 0, description: "Line offset to start from (default 0)." })
649
+ ),
650
+ limit: Type14.Optional(
651
+ Type14.Integer({
652
+ minimum: 1,
653
+ maximum: 500,
654
+ description: "Max lines to return (default 50, max 500)."
655
+ })
656
+ )
657
+ },
658
+ { additionalProperties: false }
659
+ );
660
+ function createProxmoxGetTaskLogTool(getClient2) {
661
+ return {
662
+ name: "proxmox_get_task_log",
663
+ label: "proxmox: get task log",
664
+ 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 }.",
665
+ parameters: Schema14,
666
+ execute: async (_id, raw) => {
667
+ const args = raw;
668
+ const { node } = parseTaskUpid(args.upid);
669
+ const start = args.start ?? 0;
670
+ const limit = args.limit ?? 50;
671
+ const client = getClient2();
672
+ const lines = await client.get(
673
+ `/nodes/${node}/tasks/${encodeURIComponent(args.upid)}/log?start=${start}&limit=${limit}`
674
+ );
675
+ return jsonToolResult({ lines, total: lines.length });
676
+ }
677
+ };
678
+ }
679
+
600
680
  // mcp-server.ts
601
681
  var cfg = resolveConfig(process.env);
602
682
  registerSecret(cfg.tokenId);
@@ -615,10 +695,12 @@ var tools = [
615
695
  createProxmoxStopResourceTool(getClient),
616
696
  createProxmoxRebootResourceTool(getClient),
617
697
  createProxmoxSnapshotResourceTool(getClient),
618
- createProxmoxRunBackupTool(getClient)
698
+ createProxmoxRunBackupTool(getClient),
699
+ createProxmoxGetTaskStatusTool(getClient),
700
+ createProxmoxGetTaskLogTool(getClient)
619
701
  ];
620
702
  var toolMap = new Map(tools.map((t) => [t.name, t]));
621
- var server = new Server({ name: "proxmox-mcp", version: "0.1.0" }, { capabilities: { tools: {} } });
703
+ var server = new Server({ name: "proxmox-mcp", version: "0.2.0" }, { capabilities: { tools: {} } });
622
704
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
623
705
  tools: tools.map((t) => ({ name: t.name, description: t.description, inputSchema: t.parameters }))
624
706
  }));
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "id": "proxmox",
4
4
  "name": "Proxmox",
5
- "version": "0.1.0",
5
+ "version": "0.2.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.2.0",
4
4
  "description": "MCP server exposing Proxmox VE read + safe-write tools",
5
5
  "type": "module",
6
6
  "openclaw": {