@samik081/mcp-pve 0.1.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +368 -0
  3. package/dist/core/client.d.ts +43 -0
  4. package/dist/core/client.js +143 -0
  5. package/dist/core/config.d.ts +15 -0
  6. package/dist/core/config.js +68 -0
  7. package/dist/core/errors.d.ts +24 -0
  8. package/dist/core/errors.js +43 -0
  9. package/dist/core/logger.d.ts +15 -0
  10. package/dist/core/logger.js +26 -0
  11. package/dist/core/server.d.ts +15 -0
  12. package/dist/core/server.js +30 -0
  13. package/dist/core/tools.d.ts +29 -0
  14. package/dist/core/tools.js +64 -0
  15. package/dist/index.d.ts +11 -0
  16. package/dist/index.js +51 -0
  17. package/dist/tools/access.d.ts +7 -0
  18. package/dist/tools/access.js +234 -0
  19. package/dist/tools/backup.d.ts +7 -0
  20. package/dist/tools/backup.js +176 -0
  21. package/dist/tools/cluster.d.ts +7 -0
  22. package/dist/tools/cluster.js +150 -0
  23. package/dist/tools/firewall.d.ts +7 -0
  24. package/dist/tools/firewall.js +215 -0
  25. package/dist/tools/ha.d.ts +9 -0
  26. package/dist/tools/ha.js +138 -0
  27. package/dist/tools/index.d.ts +10 -0
  28. package/dist/tools/index.js +32 -0
  29. package/dist/tools/lxc.d.ts +7 -0
  30. package/dist/tools/lxc.js +371 -0
  31. package/dist/tools/network.d.ts +7 -0
  32. package/dist/tools/network.js +157 -0
  33. package/dist/tools/nodes.d.ts +7 -0
  34. package/dist/tools/nodes.js +131 -0
  35. package/dist/tools/pools.d.ts +7 -0
  36. package/dist/tools/pools.js +98 -0
  37. package/dist/tools/qemu.d.ts +7 -0
  38. package/dist/tools/qemu.js +394 -0
  39. package/dist/tools/storage.d.ts +7 -0
  40. package/dist/tools/storage.js +216 -0
  41. package/dist/tools/tasks.d.ts +7 -0
  42. package/dist/tools/tasks.js +106 -0
  43. package/dist/types/index.d.ts +25 -0
  44. package/dist/types/index.js +17 -0
  45. package/package.json +55 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Task tools: list, status, log, and management of PVE background tasks.
3
+ */
4
+ import { z } from "zod";
5
+ import { registerTool } from "../core/tools.js";
6
+ export function registerTaskTools(server, client, config) {
7
+ // --- Read-only tools ---
8
+ registerTool(server, config, {
9
+ name: "pve_list_tasks",
10
+ description: "List recent tasks on a node with optional filters for status, source, and VMID",
11
+ category: "tasks",
12
+ accessTier: "read-only",
13
+ inputSchema: {
14
+ node: z.string().describe("The node name"),
15
+ start: z
16
+ .number()
17
+ .optional()
18
+ .describe("Start index (default: 0)"),
19
+ limit: z
20
+ .number()
21
+ .optional()
22
+ .describe("Max number of tasks to return (default: 50)"),
23
+ vmid: z
24
+ .number()
25
+ .optional()
26
+ .describe("Filter by VMID"),
27
+ typefilter: z
28
+ .string()
29
+ .optional()
30
+ .describe("Filter by task type (e.g. qmstart, vzdump)"),
31
+ },
32
+ handler: async (args) => {
33
+ const params = new URLSearchParams();
34
+ if (args.start !== undefined)
35
+ params.set("start", String(args.start));
36
+ if (args.limit !== undefined)
37
+ params.set("limit", String(args.limit));
38
+ if (args.vmid !== undefined)
39
+ params.set("vmid", String(args.vmid));
40
+ if (args.typefilter !== undefined)
41
+ params.set("typefilter", String(args.typefilter));
42
+ const qs = params.toString();
43
+ const path = `/nodes/${args.node}/tasks${qs ? `?${qs}` : ""}`;
44
+ const data = await client.get(path);
45
+ return JSON.stringify(data, null, 2);
46
+ },
47
+ });
48
+ registerTool(server, config, {
49
+ name: "pve_get_task_status",
50
+ description: "Get the status of a specific task by its UPID",
51
+ category: "tasks",
52
+ accessTier: "read-only",
53
+ inputSchema: {
54
+ node: z.string().describe("The node name"),
55
+ upid: z.string().describe("The task UPID"),
56
+ },
57
+ handler: async (args) => {
58
+ const data = await client.get(`/nodes/${args.node}/tasks/${encodeURIComponent(String(args.upid))}/status`);
59
+ return JSON.stringify(data, null, 2);
60
+ },
61
+ });
62
+ registerTool(server, config, {
63
+ name: "pve_get_task_log",
64
+ description: "Get the log output of a specific task by its UPID",
65
+ category: "tasks",
66
+ accessTier: "read-only",
67
+ inputSchema: {
68
+ node: z.string().describe("The node name"),
69
+ upid: z.string().describe("The task UPID"),
70
+ start: z
71
+ .number()
72
+ .optional()
73
+ .describe("Start line number (default: 0)"),
74
+ limit: z
75
+ .number()
76
+ .optional()
77
+ .describe("Max number of log lines to return (default: 50)"),
78
+ },
79
+ handler: async (args) => {
80
+ const params = new URLSearchParams();
81
+ if (args.start !== undefined)
82
+ params.set("start", String(args.start));
83
+ if (args.limit !== undefined)
84
+ params.set("limit", String(args.limit));
85
+ const qs = params.toString();
86
+ const path = `/nodes/${args.node}/tasks/${encodeURIComponent(String(args.upid))}/log${qs ? `?${qs}` : ""}`;
87
+ const data = await client.get(path);
88
+ return JSON.stringify(data, null, 2);
89
+ },
90
+ });
91
+ // --- Read-execute tools ---
92
+ registerTool(server, config, {
93
+ name: "pve_stop_task",
94
+ description: "Stop a running task by its UPID",
95
+ category: "tasks",
96
+ accessTier: "read-execute",
97
+ inputSchema: {
98
+ node: z.string().describe("The node name"),
99
+ upid: z.string().describe("The task UPID to stop"),
100
+ },
101
+ handler: async (args) => {
102
+ await client.delete(`/nodes/${args.node}/tasks/${encodeURIComponent(String(args.upid))}`);
103
+ return `Task ${args.upid} stop requested on node ${args.node}.`;
104
+ },
105
+ });
106
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Shared types for the Proxmox VE MCP server.
3
+ */
4
+ /**
5
+ * Access tier controlling which tools are registered at startup.
6
+ *
7
+ * - "read-only": Only read tools (51 tools)
8
+ * - "read-execute": Read + execute tools (68 tools)
9
+ * - "full": All tools including write/delete (105 tools)
10
+ */
11
+ export type AccessTier = "read-only" | "read-execute" | "full";
12
+ /**
13
+ * Tool categories corresponding to PVE API namespaces.
14
+ */
15
+ export type ToolCategory = "nodes" | "qemu" | "lxc" | "storage" | "cluster" | "access" | "pools" | "network" | "firewall" | "backup" | "tasks" | "ha";
16
+ export declare const VALID_CATEGORIES: ToolCategory[];
17
+ export interface AppConfig {
18
+ baseUrl: string;
19
+ tokenId: string;
20
+ tokenSecret: string;
21
+ accessTier: AccessTier;
22
+ categories: string[] | null;
23
+ verifySsl: boolean;
24
+ debug: boolean;
25
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared types for the Proxmox VE MCP server.
3
+ */
4
+ export const VALID_CATEGORIES = [
5
+ "nodes",
6
+ "qemu",
7
+ "lxc",
8
+ "storage",
9
+ "cluster",
10
+ "access",
11
+ "pools",
12
+ "network",
13
+ "firewall",
14
+ "backup",
15
+ "tasks",
16
+ "ha",
17
+ ];
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@samik081/mcp-pve",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Proxmox VE — manage virtual machines, containers, storage, networking, and clusters through AI coding tools",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "mcp-pve": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "dev": "node --watch --experimental-strip-types src/index.ts",
19
+ "inspect": "npm run build && npx @modelcontextprotocol/inspector node dist/index.js",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "engines": {
23
+ "node": ">=18.0.0"
24
+ },
25
+ "keywords": [
26
+ "proxmox",
27
+ "pve",
28
+ "mcp",
29
+ "model-context-protocol",
30
+ "virtualization",
31
+ "ai",
32
+ "llm",
33
+ "claude"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Samik081/mcp-pve.git"
38
+ },
39
+ "homepage": "https://github.com/Samik081/mcp-pve#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/Samik081/mcp-pve/issues"
42
+ },
43
+ "license": "MIT",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "dependencies": {
48
+ "@modelcontextprotocol/sdk": "^1.26.0",
49
+ "zod": "^3.25.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.0.0",
53
+ "typescript": "~5.9.3"
54
+ }
55
+ }