@owine/unifi-network-mcp 2.14.2 → 3.0.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -80
  3. package/dist/client.d.ts +13 -1
  4. package/dist/client.js +142 -16
  5. package/dist/config.d.ts +11 -0
  6. package/dist/config.js +102 -3
  7. package/dist/guard.d.ts +46 -0
  8. package/dist/guard.js +171 -0
  9. package/dist/index.js +15 -4
  10. package/dist/instructions.d.ts +9 -0
  11. package/dist/instructions.js +32 -0
  12. package/dist/tls.d.ts +14 -0
  13. package/dist/tls.js +58 -0
  14. package/dist/tools/acl.js +126 -53
  15. package/dist/tools/client-history.js +20 -10
  16. package/dist/tools/clients.js +14 -13
  17. package/dist/tools/devices.js +30 -29
  18. package/dist/tools/dns-policies.js +116 -69
  19. package/dist/tools/firewall.d.ts +2 -1
  20. package/dist/tools/firewall.js +245 -80
  21. package/dist/tools/hotspot.js +35 -28
  22. package/dist/tools/index.d.ts +13 -1
  23. package/dist/tools/index.js +63 -4
  24. package/dist/tools/networks.d.ts +2 -1
  25. package/dist/tools/networks.js +152 -58
  26. package/dist/tools/sites.js +3 -3
  27. package/dist/tools/supporting.js +31 -30
  28. package/dist/tools/switching.js +22 -21
  29. package/dist/tools/system.js +1 -1
  30. package/dist/tools/traffic-matching.d.ts +2 -1
  31. package/dist/tools/traffic-matching.js +31 -28
  32. package/dist/tools/wifi.js +228 -311
  33. package/dist/utils/full-put.d.ts +32 -0
  34. package/dist/utils/full-put.js +74 -0
  35. package/dist/utils/output-schemas.d.ts +77 -9
  36. package/dist/utils/output-schemas.js +106 -54
  37. package/dist/utils/params.d.ts +7 -0
  38. package/dist/utils/params.js +12 -0
  39. package/dist/utils/responses.d.ts +2 -0
  40. package/dist/utils/responses.js +28 -2
  41. package/dist/utils/safety.d.ts +35 -1
  42. package/dist/utils/safety.js +53 -3
  43. package/dist/utils/secrets.d.ts +24 -0
  44. package/dist/utils/secrets.js +92 -0
  45. package/dist/utils/wan-exposure.d.ts +69 -0
  46. package/dist/utils/wan-exposure.js +245 -0
  47. package/dist/write-log.d.ts +52 -0
  48. package/dist/write-log.js +178 -0
  49. package/dist/write-tools.d.ts +27 -0
  50. package/dist/write-tools.js +50 -0
  51. package/package.json +19 -15
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITE_TOOLS = exports.WRITE_TOOL_GROUPS = void 0;
4
+ exports.parseWriteTools = parseWriteTools;
5
+ /**
6
+ * Every write tool, grouped by the module in src/tools/ that registers it.
7
+ * UNIFI_NETWORK_WRITE_TOOLS names tools or groups from here, and
8
+ * registerAllTools() refuses to register a write tool that is missing, so the
9
+ * list cannot fall behind the code.
10
+ */
11
+ exports.WRITE_TOOL_GROUPS = {
12
+ devices: ["unifi_adopt_device", "unifi_remove_device", "unifi_restart_device", "unifi_power_cycle_port"],
13
+ clients: ["unifi_authorize_guest", "unifi_unauthorize_guest"],
14
+ networks: ["unifi_create_network", "unifi_update_network", "unifi_delete_network"],
15
+ wifi: ["unifi_create_wifi", "unifi_update_wifi", "unifi_delete_wifi"],
16
+ hotspot: ["unifi_create_voucher", "unifi_delete_voucher", "unifi_bulk_delete_vouchers"],
17
+ firewall: [
18
+ "unifi_create_firewall_zone", "unifi_update_firewall_zone", "unifi_delete_firewall_zone",
19
+ "unifi_create_firewall_policy", "unifi_update_firewall_policy", "unifi_patch_firewall_policy",
20
+ "unifi_delete_firewall_policy", "unifi_reorder_firewall_policies",
21
+ ],
22
+ acl: ["unifi_create_acl_rule", "unifi_update_acl_rule", "unifi_delete_acl_rule", "unifi_reorder_acl_rules"],
23
+ "dns-policies": ["unifi_create_dns_policy", "unifi_update_dns_policy", "unifi_delete_dns_policy"],
24
+ "traffic-matching": [
25
+ "unifi_create_traffic_matching_list", "unifi_update_traffic_matching_list", "unifi_delete_traffic_matching_list",
26
+ ],
27
+ };
28
+ exports.WRITE_TOOLS = Object.values(exports.WRITE_TOOL_GROUPS).flat();
29
+ const GROUPS = exports.WRITE_TOOL_GROUPS;
30
+ /**
31
+ * The write tools a UNIFI_NETWORK_WRITE_TOOLS value enables, in catalog
32
+ * order: a comma-separated list of tool and group names, or "" / "none" for
33
+ * none. Names that are neither come back in unknown.
34
+ */
35
+ function parseWriteTools(value) {
36
+ const names = value.split(",").map((name) => name.trim()).filter((name) => name !== "");
37
+ if (names.length === 1 && names[0].toLowerCase() === "none")
38
+ return { tools: [], unknown: [] };
39
+ const enabled = new Set();
40
+ const unknown = [];
41
+ for (const name of names) {
42
+ const tools = Object.hasOwn(GROUPS, name) ? GROUPS[name] : exports.WRITE_TOOLS.includes(name) ? [name] : undefined;
43
+ if (tools === undefined)
44
+ unknown.push(name);
45
+ else
46
+ for (const tool of tools)
47
+ enabled.add(tool);
48
+ }
49
+ return { tools: exports.WRITE_TOOLS.filter((tool) => enabled.has(tool)), unknown };
50
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@owine/unifi-network-mcp",
3
- "version": "2.14.2",
4
- "description": "MCP server for the UniFi Network API",
3
+ "version": "3.0.0",
4
+ "description": "MCP server exposing the UniFi Network Integration API as tools for Claude and other MCP clients",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
7
  "unifi-network-mcp": "dist/index.js"
@@ -12,17 +12,18 @@
12
12
  "scripts": {
13
13
  "build": "tsc",
14
14
  "start": "node dist/index.js",
15
- "typecheck": "tsc --noEmit",
15
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
16
16
  "test": "vitest run",
17
17
  "test:watch": "vitest",
18
18
  "test:coverage": "vitest run --coverage",
19
19
  "lint": "eslint .",
20
- "lint:fix": "eslint . --fix"
20
+ "lint:fix": "eslint . --fix",
21
+ "test:package": "pnpm run build && sh scripts/smoke-package.sh"
21
22
  },
22
23
  "engines": {
23
- "node": "^22.13.0 || ^24.0.0"
24
+ "node": "^22.19.0 || ^24.0.0"
24
25
  },
25
- "packageManager": "pnpm@12.8.2",
26
+ "packageManager": "pnpm@12.14.0",
26
27
  "repository": {
27
28
  "type": "git",
28
29
  "url": "git+https://github.com/owine/unifi-network-mcp.git"
@@ -32,23 +33,26 @@
32
33
  "network",
33
34
  "mcp",
34
35
  "model-context-protocol",
35
- "ubiquiti"
36
+ "ubiquiti",
37
+ "unifi-network",
38
+ "mcp-server"
36
39
  ],
37
40
  "author": "owine",
38
41
  "license": "MIT",
39
42
  "dependencies": {
40
- "@modelcontextprotocol/sdk": "1.32.0",
41
- "zod": "4.6.5"
43
+ "@modelcontextprotocol/sdk": "1.32.1",
44
+ "undici": "8.12.2",
45
+ "zod": "4.6.7"
42
46
  },
43
47
  "devDependencies": {
44
48
  "@eslint/js": "10.0.1",
45
- "@types/node": "24.19.1",
49
+ "@types/node": "24.19.2",
46
50
  "@typescript/native": "npm:typescript@7.0.2",
47
- "@vitest/coverage-v8": "5.0.3",
48
- "eslint": "10.12.0",
49
- "lefthook": "2.1.16",
51
+ "@vitest/coverage-v8": "5.0.5",
52
+ "eslint": "10.13.0",
53
+ "lefthook": "2.2.2",
50
54
  "typescript": "npm:@typescript/typescript6@6.0.2",
51
- "typescript-eslint": "8.71.0",
52
- "vitest": "5.0.3"
55
+ "typescript-eslint": "8.71.2",
56
+ "vitest": "5.0.5"
53
57
  }
54
58
  }