@owine/unifi-network-mcp 2.0.1 → 2.0.2

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.
@@ -6,26 +6,30 @@ const responses_js_1 = require("../utils/responses.js");
6
6
  const query_js_1 = require("../utils/query.js");
7
7
  const safety_js_1 = require("../utils/safety.js");
8
8
  function registerWifiTools(server, client, readOnly = false) {
9
- server.tool("unifi_list_wifi", "List all WiFi broadcasts (SSIDs) at a site", {
10
- siteId: zod_1.z.string().describe("Site ID"),
11
- offset: zod_1.z
12
- .number()
13
- .int()
14
- .nonnegative()
15
- .optional()
16
- .describe("Number of records to skip (default: 0)"),
17
- limit: zod_1.z
18
- .number()
19
- .int()
20
- .min(1)
21
- .max(200)
22
- .optional()
23
- .describe("Number of records to return (default: 25, max: 200)"),
24
- filter: zod_1.z
25
- .string()
26
- .optional()
27
- .describe("Filter expression"),
28
- }, safety_js_1.READ_ONLY, async ({ siteId, offset, limit, filter }) => {
9
+ server.registerTool("unifi_list_wifi", {
10
+ description: "List all WiFi broadcasts (SSIDs) at a site",
11
+ inputSchema: {
12
+ siteId: zod_1.z.string().describe("Site ID"),
13
+ offset: zod_1.z
14
+ .number()
15
+ .int()
16
+ .nonnegative()
17
+ .optional()
18
+ .describe("Number of records to skip (default: 0)"),
19
+ limit: zod_1.z
20
+ .number()
21
+ .int()
22
+ .min(1)
23
+ .max(200)
24
+ .optional()
25
+ .describe("Number of records to return (default: 25, max: 200)"),
26
+ filter: zod_1.z
27
+ .string()
28
+ .optional()
29
+ .describe("Filter expression"),
30
+ },
31
+ annotations: safety_js_1.READ_ONLY,
32
+ }, async ({ siteId, offset, limit, filter }) => {
29
33
  try {
30
34
  const query = (0, query_js_1.buildQuery)({ offset, limit, filter });
31
35
  const data = await client.get(`/sites/${siteId}/wifi/broadcasts${query}`);
@@ -35,10 +39,14 @@ function registerWifiTools(server, client, readOnly = false) {
35
39
  return (0, responses_js_1.formatError)(err);
36
40
  }
37
41
  });
38
- server.tool("unifi_get_wifi", "Get a specific WiFi network by ID", {
39
- siteId: zod_1.z.string().describe("Site ID"),
40
- wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
41
- }, safety_js_1.READ_ONLY, async ({ siteId, wifiBroadcastId }) => {
42
+ server.registerTool("unifi_get_wifi", {
43
+ description: "Get a specific WiFi network by ID",
44
+ inputSchema: {
45
+ siteId: zod_1.z.string().describe("Site ID"),
46
+ wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
47
+ },
48
+ annotations: safety_js_1.READ_ONLY,
49
+ }, async ({ siteId, wifiBroadcastId }) => {
42
50
  try {
43
51
  const data = await client.get(`/sites/${siteId}/wifi/broadcasts/${wifiBroadcastId}`);
44
52
  return (0, responses_js_1.formatSuccess)(data);
@@ -49,19 +57,23 @@ function registerWifiTools(server, client, readOnly = false) {
49
57
  });
50
58
  if (readOnly)
51
59
  return;
52
- server.tool("unifi_create_wifi", "Create a new WiFi network (SSID)", {
53
- siteId: zod_1.z.string().describe("Site ID"),
54
- name: zod_1.z.string().describe("SSID name"),
55
- enabled: zod_1.z.boolean().describe("Enable the WiFi network"),
56
- type: zod_1.z.enum(["STANDARD"]).describe("WiFi type"),
57
- broadcastingFrequenciesGHz: zod_1.z
58
- .array(zod_1.z.string())
59
- .describe("Frequencies: 2.4, 5, 6"),
60
- dryRun: zod_1.z
61
- .boolean()
62
- .optional()
63
- .describe("Preview this action without executing it"),
64
- }, safety_js_1.WRITE_NOT_IDEMPOTENT, async ({ siteId, name, enabled, type, broadcastingFrequenciesGHz, dryRun, }) => {
60
+ server.registerTool("unifi_create_wifi", {
61
+ description: "Create a new WiFi network (SSID)",
62
+ inputSchema: {
63
+ siteId: zod_1.z.string().describe("Site ID"),
64
+ name: zod_1.z.string().describe("SSID name"),
65
+ enabled: zod_1.z.boolean().describe("Enable the WiFi network"),
66
+ type: zod_1.z.enum(["STANDARD"]).describe("WiFi type"),
67
+ broadcastingFrequenciesGHz: zod_1.z
68
+ .array(zod_1.z.string())
69
+ .describe("Frequencies: 2.4, 5, 6"),
70
+ dryRun: zod_1.z
71
+ .boolean()
72
+ .optional()
73
+ .describe("Preview this action without executing it"),
74
+ },
75
+ annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
76
+ }, async ({ siteId, name, enabled, type, broadcastingFrequenciesGHz, dryRun, }) => {
65
77
  try {
66
78
  const body = {
67
79
  name,
@@ -78,16 +90,20 @@ function registerWifiTools(server, client, readOnly = false) {
78
90
  return (0, responses_js_1.formatError)(err);
79
91
  }
80
92
  });
81
- server.tool("unifi_update_wifi", "Update an existing WiFi network", {
82
- siteId: zod_1.z.string().describe("Site ID"),
83
- wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
84
- name: zod_1.z.string().optional().describe("SSID name"),
85
- enabled: zod_1.z.boolean().optional().describe("Enable the WiFi network"),
86
- dryRun: zod_1.z
87
- .boolean()
88
- .optional()
89
- .describe("Preview this action without executing it"),
90
- }, safety_js_1.WRITE, async ({ siteId, wifiBroadcastId, name, enabled, dryRun }) => {
93
+ server.registerTool("unifi_update_wifi", {
94
+ description: "Update an existing WiFi network",
95
+ inputSchema: {
96
+ siteId: zod_1.z.string().describe("Site ID"),
97
+ wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
98
+ name: zod_1.z.string().optional().describe("SSID name"),
99
+ enabled: zod_1.z.boolean().optional().describe("Enable the WiFi network"),
100
+ dryRun: zod_1.z
101
+ .boolean()
102
+ .optional()
103
+ .describe("Preview this action without executing it"),
104
+ },
105
+ annotations: safety_js_1.WRITE,
106
+ }, async ({ siteId, wifiBroadcastId, name, enabled, dryRun }) => {
91
107
  try {
92
108
  const body = {};
93
109
  if (name !== undefined)
@@ -103,23 +119,27 @@ function registerWifiTools(server, client, readOnly = false) {
103
119
  return (0, responses_js_1.formatError)(err);
104
120
  }
105
121
  });
106
- server.tool("unifi_delete_wifi", "DESTRUCTIVE: Delete a WiFi network — all clients on this SSID will be disconnected", {
107
- siteId: zod_1.z.string().describe("Site ID"),
108
- wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
109
- force: zod_1.z
110
- .boolean()
111
- .optional()
112
- .default(false)
113
- .describe("Force delete (default: false)"),
114
- confirm: zod_1.z
115
- .boolean()
116
- .optional()
117
- .describe("Must be true to execute this destructive action"),
118
- dryRun: zod_1.z
119
- .boolean()
120
- .optional()
121
- .describe("Preview this action without executing it"),
122
- }, safety_js_1.DESTRUCTIVE, async ({ siteId, wifiBroadcastId, force, confirm, dryRun }) => {
122
+ server.registerTool("unifi_delete_wifi", {
123
+ description: "DESTRUCTIVE: Delete a WiFi network — all clients on this SSID will be disconnected",
124
+ inputSchema: {
125
+ siteId: zod_1.z.string().describe("Site ID"),
126
+ wifiBroadcastId: zod_1.z.string().describe("WiFi Broadcast ID"),
127
+ force: zod_1.z
128
+ .boolean()
129
+ .optional()
130
+ .default(false)
131
+ .describe("Force delete (default: false)"),
132
+ confirm: zod_1.z
133
+ .boolean()
134
+ .optional()
135
+ .describe("Must be true to execute this destructive action"),
136
+ dryRun: zod_1.z
137
+ .boolean()
138
+ .optional()
139
+ .describe("Preview this action without executing it"),
140
+ },
141
+ annotations: safety_js_1.DESTRUCTIVE,
142
+ }, async ({ siteId, wifiBroadcastId, force, confirm, dryRun }) => {
123
143
  const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the WiFi network and disconnect all clients on this SSID");
124
144
  if (guard)
125
145
  return guard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owine/unifi-network-mcp",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "MCP server for the UniFi Network API",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@eslint/js": "10.0.1",
44
- "@types/node": "24.10.13",
44
+ "@types/node": "24.12.0",
45
45
  "@vitest/coverage-v8": "4.0.18",
46
- "eslint": "10.0.0",
46
+ "eslint": "10.0.3",
47
47
  "typescript": "5.9.3",
48
- "typescript-eslint": "8.56.0",
48
+ "typescript-eslint": "8.56.1",
49
49
  "vitest": "4.0.18"
50
50
  }
51
51
  }