@tmhs/homelab-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/LICENSE CHANGED
@@ -1,31 +1,31 @@
1
- Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
2
-
3
- Copyright (c) 2026 TM Hospitality Strategies
4
-
5
- SPDX-License-Identifier: CC-BY-NC-ND-4.0
6
-
7
- You are free to:
8
-
9
- Share - copy and redistribute the material in any medium or format.
10
-
11
- The licensor cannot revoke these freedoms as long as you follow the
12
- license terms.
13
-
14
- Under the following terms:
15
-
16
- Attribution - You must give appropriate credit, provide a link to
17
- the license, and indicate if changes were made. You may do so in
18
- any reasonable manner, but not in any way that suggests the licensor
19
- endorses you or your use.
20
-
21
- NonCommercial - You may not use the material for commercial purposes.
22
-
23
- NoDerivatives - If you remix, transform, or build upon the material,
24
- you may not distribute the modified material.
25
-
26
- No additional restrictions - You may not apply legal terms or
27
- technological measures that legally restrict others from doing
28
- anything the license permits.
29
-
30
- Full license text:
31
- https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
1
+ Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
2
+
3
+ Copyright (c) 2026 TM Hospitality Strategies
4
+
5
+ SPDX-License-Identifier: CC-BY-NC-ND-4.0
6
+
7
+ You are free to:
8
+
9
+ Share - copy and redistribute the material in any medium or format.
10
+
11
+ The licensor cannot revoke these freedoms as long as you follow the
12
+ license terms.
13
+
14
+ Under the following terms:
15
+
16
+ Attribution - You must give appropriate credit, provide a link to
17
+ the license, and indicate if changes were made. You may do so in
18
+ any reasonable manner, but not in any way that suggests the licensor
19
+ endorses you or your use.
20
+
21
+ NonCommercial - You may not use the material for commercial purposes.
22
+
23
+ NoDerivatives - If you remix, transform, or build upon the material,
24
+ you may not distribute the modified material.
25
+
26
+ No additional restrictions - You may not apply legal terms or
27
+ technological measures that legally restrict others from doing
28
+ anything the license permits.
29
+
30
+ Full license text:
31
+ https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
package/README.md CHANGED
@@ -1,71 +1,71 @@
1
- # Home Lab MCP Server
2
-
3
- MCP (Model Context Protocol) server for home lab operations. Connects to a Raspberry Pi via SSH and provides 15 tools for system management, Docker Compose stacks, service monitoring, networking, and backups.
4
-
5
- ## Tools
6
-
7
- | Category | Tool | Description |
8
- |----------|------|-------------|
9
- | System | `homelab_piStatus` | CPU temp, memory, disk, uptime, throttle state |
10
- | System | `homelab_piReboot` | Safe reboot with pre-checks |
11
- | System | `homelab_diskUsage` | Disk usage breakdown by directory |
12
- | System | `homelab_aptUpdate` | Run apt update, list upgradable packages |
13
- | Containers | `homelab_serviceHealth` | Docker container health status |
14
- | Containers | `homelab_serviceLogs` | Tail container logs |
15
- | Containers | `homelab_serviceRestart` | Restart a container |
16
- | Compose | `homelab_composeUp` | Start compose stacks |
17
- | Compose | `homelab_composeDown` | Stop compose stacks |
18
- | Compose | `homelab_composePull` | Pull latest images |
19
- | Compose | `homelab_composePs` | List running containers |
20
- | Network | `homelab_networkInfo` | IP addresses, DNS, Tailscale status |
21
- | Backup | `homelab_backupStatus` | Check latest restic snapshots |
22
- | Backup | `homelab_backupRun` | Trigger restic backup |
23
- | SSH | `homelab_sshTest` | Test SSH connectivity |
24
-
25
- ## Setup
26
-
27
- ```bash
28
- cd mcp-server
29
- npm install
30
- npm run build
31
- ```
32
-
33
- ## Configuration
34
-
35
- Set environment variables:
36
-
37
- | Variable | Default | Description |
38
- |----------|---------|-------------|
39
- | `HOMELAB_PI_HOST` | `raspi5.local` | Pi hostname or IP |
40
- | `HOMELAB_PI_USER` | `tmhs` | SSH username |
41
- | `HOMELAB_PI_KEY_PATH` | (empty) | Path to SSH private key |
42
- | `HOMELAB_COMPOSE_DIR` | `/opt/homelab/docker` | Compose project directory on Pi |
43
- | `HOMELAB_BACKUP_REPO` | `/mnt/backup/restic` | Restic backup repo path on Pi |
44
-
45
- ## Usage with Cursor
46
-
47
- Add to `.cursor/mcp.json`:
48
-
49
- ```json
50
- {
51
- "mcpServers": {
52
- "homelab": {
53
- "command": "node",
54
- "args": ["path/to/Home-Lab-Developer-Tools/mcp-server/dist/index.js"],
55
- "env": {
56
- "HOMELAB_PI_HOST": "raspi5.local",
57
- "HOMELAB_PI_USER": "tmhs",
58
- "HOMELAB_PI_KEY_PATH": "~/.ssh/id_ed25519_pi"
59
- }
60
- }
61
- }
62
- }
63
- ```
64
-
65
- ## Development
66
-
67
- ```bash
68
- npm run dev # Watch mode with tsx
69
- npm test # Run Vitest tests
70
- npm run build # Compile TypeScript
71
- ```
1
+ # Home Lab MCP Server
2
+
3
+ MCP (Model Context Protocol) server for home lab operations. Connects to a Raspberry Pi via SSH and provides 15 tools for system management, Docker Compose stacks, service monitoring, networking, and backups.
4
+
5
+ ## Tools
6
+
7
+ | Category | Tool | Description |
8
+ |----------|------|-------------|
9
+ | System | `homelab_piStatus` | CPU temp, memory, disk, uptime, throttle state |
10
+ | System | `homelab_piReboot` | Safe reboot with pre-checks |
11
+ | System | `homelab_diskUsage` | Disk usage breakdown by directory |
12
+ | System | `homelab_aptUpdate` | Run apt update, list upgradable packages |
13
+ | Containers | `homelab_serviceHealth` | Docker container health status |
14
+ | Containers | `homelab_serviceLogs` | Tail container logs |
15
+ | Containers | `homelab_serviceRestart` | Restart a container |
16
+ | Compose | `homelab_composeUp` | Start compose stacks |
17
+ | Compose | `homelab_composeDown` | Stop compose stacks |
18
+ | Compose | `homelab_composePull` | Pull latest images |
19
+ | Compose | `homelab_composePs` | List running containers |
20
+ | Network | `homelab_networkInfo` | IP addresses, DNS, Tailscale status |
21
+ | Backup | `homelab_backupStatus` | Check latest restic snapshots |
22
+ | Backup | `homelab_backupRun` | Trigger restic backup |
23
+ | SSH | `homelab_sshTest` | Test SSH connectivity |
24
+
25
+ ## Setup
26
+
27
+ ```bash
28
+ cd mcp-server
29
+ npm install
30
+ npm run build
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ Set environment variables:
36
+
37
+ | Variable | Default | Description |
38
+ |----------|---------|-------------|
39
+ | `HOMELAB_PI_HOST` | `raspi5.local` | Pi hostname or IP |
40
+ | `HOMELAB_PI_USER` | `tmhs` | SSH username |
41
+ | `HOMELAB_PI_KEY_PATH` | (empty) | Path to SSH private key |
42
+ | `HOMELAB_COMPOSE_DIR` | `/opt/homelab/docker` | Compose project directory on Pi |
43
+ | `HOMELAB_BACKUP_REPO` | `/mnt/backup/restic` | Restic backup repo path on Pi |
44
+
45
+ ## Usage with Cursor
46
+
47
+ Add to `.cursor/mcp.json`:
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "homelab": {
53
+ "command": "node",
54
+ "args": ["path/to/Home-Lab-Developer-Tools/mcp-server/dist/index.js"],
55
+ "env": {
56
+ "HOMELAB_PI_HOST": "raspi5.local",
57
+ "HOMELAB_PI_USER": "tmhs",
58
+ "HOMELAB_PI_KEY_PATH": "~/.ssh/id_ed25519_pi"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Development
66
+
67
+ ```bash
68
+ npm run dev # Watch mode with tsx
69
+ npm test # Run Vitest tests
70
+ npm run build # Compile TypeScript
71
+ ```
package/dist/index.js CHANGED
@@ -16,9 +16,14 @@ import { register as registerBackupStatus } from "./tools/backupStatus.js";
16
16
  import { register as registerBackupRun } from "./tools/backupRun.js";
17
17
  import { register as registerAptUpdate } from "./tools/aptUpdate.js";
18
18
  import { register as registerSshTest } from "./tools/sshTest.js";
19
+ import { register as registerPrometheusQuery } from "./tools/prometheusQuery.js";
20
+ import { register as registerGrafanaSnapshot } from "./tools/grafanaSnapshot.js";
21
+ import { register as registerUptimeKumaStatus } from "./tools/uptimeKumaStatus.js";
22
+ import { register as registerAlertList } from "./tools/alertList.js";
23
+ import { register as registerSpeedtestResults } from "./tools/speedtestResults.js";
19
24
  const server = new McpServer({
20
25
  name: "homelab-mcp",
21
- version: "0.1.0",
26
+ version: "0.2.0",
22
27
  });
23
28
  registerPiStatus(server);
24
29
  registerPiReboot(server);
@@ -35,6 +40,11 @@ registerBackupStatus(server);
35
40
  registerBackupRun(server);
36
41
  registerAptUpdate(server);
37
42
  registerSshTest(server);
43
+ registerPrometheusQuery(server);
44
+ registerGrafanaSnapshot(server);
45
+ registerUptimeKumaStatus(server);
46
+ registerAlertList(server);
47
+ registerSpeedtestResults(server);
38
48
  async function main() {
39
49
  const transport = new StdioServerTransport();
40
50
  await server.connect(transport);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,QAAQ,IAAI,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,QAAQ,I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AAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
3
+ //# sourceMappingURL=alertList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alertList.d.ts","sourceRoot":"","sources":["../../src/tools/alertList.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAkBhD"}
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ import { execSSH, errorResponse } from "../utils/ssh-api.js";
3
+ const inputSchema = {
4
+ state: z
5
+ .enum(["active", "suppressed", "unprocessed"])
6
+ .optional()
7
+ .describe("Filter alerts by state. Returns all states if omitted"),
8
+ };
9
+ export function register(server) {
10
+ server.tool("homelab_alertList", "List alerts from Alertmanager, optionally filtered by state", inputSchema, async (args) => {
11
+ try {
12
+ const stateParam = args.state ? `?state=${args.state}` : "";
13
+ const output = await execSSH(`curl -sf 'http://localhost:9093/api/v2/alerts${stateParam}'`);
14
+ return { content: [{ type: "text", text: output }] };
15
+ }
16
+ catch (error) {
17
+ return errorResponse(error);
18
+ }
19
+ });
20
+ }
21
+ //# sourceMappingURL=alertList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alertList.js","sourceRoot":"","sources":["../../src/tools/alertList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC;SACL,IAAI,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;SAC7C,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,6DAA6D,EAC7D,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,gDAAgD,UAAU,GAAG,CAC9D,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
3
+ //# sourceMappingURL=grafanaSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grafanaSnapshot.d.ts","sourceRoot":"","sources":["../../src/tools/grafanaSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ import { execSSH, errorResponse } from "../utils/ssh-api.js";
3
+ const inputSchema = {
4
+ dashboard: z.string().min(1).describe("Dashboard UID to export"),
5
+ };
6
+ export function register(server) {
7
+ server.tool("homelab_grafanaSnapshot", "Export a Grafana dashboard configuration by UID", inputSchema, async (args) => {
8
+ try {
9
+ const output = await execSSH(`curl -sf 'http://localhost:3000/api/dashboards/uid/${args.dashboard}'`);
10
+ return { content: [{ type: "text", text: output }] };
11
+ }
12
+ catch (error) {
13
+ return errorResponse(error);
14
+ }
15
+ });
16
+ }
17
+ //# sourceMappingURL=grafanaSnapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grafanaSnapshot.js","sourceRoot":"","sources":["../../src/tools/grafanaSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,GAAG;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CACjE,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,iDAAiD,EACjD,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,sDAAsD,IAAI,CAAC,SAAS,GAAG,CACxE,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
3
+ //# sourceMappingURL=prometheusQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prometheusQuery.d.ts","sourceRoot":"","sources":["../../src/tools/prometheusQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmBhD"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { execSSH, errorResponse } from "../utils/ssh-api.js";
3
+ const inputSchema = {
4
+ query: z.string().min(1).describe("PromQL expression to evaluate"),
5
+ time: z
6
+ .string()
7
+ .optional()
8
+ .describe("Evaluation timestamp (RFC3339 or Unix). Defaults to current time"),
9
+ };
10
+ export function register(server) {
11
+ server.tool("homelab_prometheusQuery", "Run a PromQL query against Prometheus and return the result", inputSchema, async (args) => {
12
+ try {
13
+ const encoded = encodeURIComponent(args.query);
14
+ const timeParam = args.time ? `&time=${encodeURIComponent(args.time)}` : "";
15
+ const output = await execSSH(`curl -sf 'http://localhost:9090/api/v1/query?query=${encoded}${timeParam}'`);
16
+ return { content: [{ type: "text", text: output }] };
17
+ }
18
+ catch (error) {
19
+ return errorResponse(error);
20
+ }
21
+ });
22
+ }
23
+ //# sourceMappingURL=prometheusQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prometheusQuery.js","sourceRoot":"","sources":["../../src/tools/prometheusQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAClE,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kEAAkE,CAAC;CAChF,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,6DAA6D,EAC7D,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5E,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,sDAAsD,OAAO,GAAG,SAAS,GAAG,CAC7E,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
3
+ //# sourceMappingURL=speedtestResults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speedtestResults.d.ts","sourceRoot":"","sources":["../../src/tools/speedtestResults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAazE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { execSSH, errorResponse } from "../utils/ssh-api.js";
3
+ const inputSchema = {
4
+ count: z
5
+ .number()
6
+ .int()
7
+ .positive()
8
+ .optional()
9
+ .default(5)
10
+ .describe("Number of recent speedtest results to return"),
11
+ };
12
+ export function register(server) {
13
+ server.tool("homelab_speedtestResults", "Get recent speedtest results from Speedtest Tracker", inputSchema, async (args) => {
14
+ try {
15
+ const output = await execSSH(`curl -sf 'http://localhost:8765/api/speedtest/latest?limit=${args.count}'`);
16
+ return { content: [{ type: "text", text: output }] };
17
+ }
18
+ catch (error) {
19
+ return errorResponse(error);
20
+ }
21
+ });
22
+ }
23
+ //# sourceMappingURL=speedtestResults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speedtestResults.js","sourceRoot":"","sources":["../../src/tools/speedtestResults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,8CAA8C,CAAC;CAC5D,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,qDAAqD,EACrD,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,8DAA8D,IAAI,CAAC,KAAK,GAAG,CAC5E,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
3
+ //# sourceMappingURL=uptimeKumaStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uptimeKumaStatus.d.ts","sourceRoot":"","sources":["../../src/tools/uptimeKumaStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiBhD"}
@@ -0,0 +1,13 @@
1
+ import { execSSH, errorResponse } from "../utils/ssh-api.js";
2
+ export function register(server) {
3
+ server.tool("homelab_uptimeKumaStatus", "Get the status of all Uptime Kuma monitors", {}, async () => {
4
+ try {
5
+ const output = await execSSH(`curl -sf 'http://localhost:3001/api/status-page/heartbeat/default'`);
6
+ return { content: [{ type: "text", text: output }] };
7
+ }
8
+ catch (error) {
9
+ return errorResponse(error);
10
+ }
11
+ });
12
+ }
13
+ //# sourceMappingURL=uptimeKumaStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uptimeKumaStatus.js","sourceRoot":"","sources":["../../src/tools/uptimeKumaStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,4CAA4C,EAC5C,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,oEAAoE,CACrE,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "name": "@tmhs/homelab-mcp",
3
- "version": "0.1.0",
4
- "description": "MCP server for home lab operations via SSH - 15 tools for system status, Docker Compose management, service health, networking, backups, and administration on a Raspberry Pi.",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "bin": {
8
- "homelab-mcp": "dist/index.js"
9
- },
10
- "files": [
11
- "dist",
12
- "README.md",
13
- "LICENSE"
14
- ],
15
- "engines": {
16
- "node": ">= 20.0.0"
17
- },
18
- "scripts": {
19
- "build": "tsc",
20
- "dev": "tsx watch src/index.ts",
21
- "start": "node dist/index.js",
22
- "test": "vitest run",
23
- "test:watch": "vitest",
24
- "prepublishOnly": "npm run build"
25
- },
26
- "dependencies": {
27
- "@modelcontextprotocol/sdk": "^1.12.1",
28
- "ssh2": "^1.16.0",
29
- "zod": "^3.23.0"
30
- },
31
- "devDependencies": {
32
- "@types/node": "^25.5.2",
33
- "@types/ssh2": "^1.15.0",
34
- "tsx": "^4.19.0",
35
- "typescript": "^5.7.0",
36
- "vitest": "^4.1.2"
37
- },
38
- "license": "CC-BY-NC-ND-4.0",
39
- "repository": {
40
- "type": "git",
41
- "url": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools.git",
42
- "directory": "mcp-server"
43
- },
44
- "homepage": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools",
45
- "bugs": {
46
- "url": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools/issues"
47
- },
48
- "author": "TMHSDigital"
49
- }
1
+ {
2
+ "name": "@tmhs/homelab-mcp",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for home lab operations via SSH - 20 tools for system status, Docker Compose management, service health, monitoring, networking, backups, and administration on a Raspberry Pi.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "homelab-mcp": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "engines": {
16
+ "node": ">= 20.0.0"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsx watch src/index.ts",
21
+ "start": "node dist/index.js",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "dependencies": {
27
+ "@modelcontextprotocol/sdk": "^1.12.1",
28
+ "ssh2": "^1.16.0",
29
+ "zod": "^3.23.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^25.5.2",
33
+ "@types/ssh2": "^1.15.0",
34
+ "tsx": "^4.19.0",
35
+ "typescript": "^5.7.0",
36
+ "vitest": "^4.1.2"
37
+ },
38
+ "license": "CC-BY-NC-ND-4.0",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools.git",
42
+ "directory": "mcp-server"
43
+ },
44
+ "homepage": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools",
45
+ "bugs": {
46
+ "url": "https://github.com/TMHSDigital/Home-Lab-Developer-Tools/issues"
47
+ },
48
+ "author": "TMHSDigital"
49
+ }