@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.
- package/dist/tools/acl.js +107 -79
- package/dist/tools/clients.js +75 -59
- package/dist/tools/devices.js +95 -63
- package/dist/tools/dns-policies.js +77 -57
- package/dist/tools/firewall.js +200 -148
- package/dist/tools/hotspot.js +123 -103
- package/dist/tools/networks.js +106 -82
- package/dist/tools/sites.js +23 -19
- package/dist/tools/supporting.js +185 -153
- package/dist/tools/system.js +5 -1
- package/dist/tools/traffic-matching.js +83 -63
- package/dist/tools/wifi.js +84 -64
- package/package.json +4 -4
|
@@ -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 registerDnsPolicyTools(server, client, readOnly = false) {
|
|
9
|
-
server.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
server.registerTool("unifi_list_dns_policies", {
|
|
10
|
+
description: "List all DNS policies 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}/dns/policies${query}`);
|
|
@@ -35,10 +39,14 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
|
|
|
35
39
|
return (0, responses_js_1.formatError)(err);
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
|
-
server.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
server.registerTool("unifi_get_dns_policy", {
|
|
43
|
+
description: "Get a specific DNS policy by ID",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
46
|
+
dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
|
|
47
|
+
},
|
|
48
|
+
annotations: safety_js_1.READ_ONLY,
|
|
49
|
+
}, async ({ siteId, dnsPolicyId }) => {
|
|
42
50
|
try {
|
|
43
51
|
const data = await client.get(`/sites/${siteId}/dns/policies/${dnsPolicyId}`);
|
|
44
52
|
return (0, responses_js_1.formatSuccess)(data);
|
|
@@ -49,16 +57,20 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
|
|
|
49
57
|
});
|
|
50
58
|
if (readOnly)
|
|
51
59
|
return;
|
|
52
|
-
server.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
server.registerTool("unifi_create_dns_policy", {
|
|
61
|
+
description: "Create a new DNS policy",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
64
|
+
policy: zod_1.z
|
|
65
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
66
|
+
.describe("DNS policy configuration (JSON object)"),
|
|
67
|
+
dryRun: zod_1.z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Preview this action without executing it"),
|
|
71
|
+
},
|
|
72
|
+
annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
|
|
73
|
+
}, async ({ siteId, policy, dryRun }) => {
|
|
62
74
|
try {
|
|
63
75
|
if (dryRun)
|
|
64
76
|
return (0, safety_js_1.formatDryRun)("POST", `/sites/${siteId}/dns/policies`, policy);
|
|
@@ -69,17 +81,21 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
|
|
|
69
81
|
return (0, responses_js_1.formatError)(err);
|
|
70
82
|
}
|
|
71
83
|
});
|
|
72
|
-
server.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
server.registerTool("unifi_update_dns_policy", {
|
|
85
|
+
description: "Update a DNS policy",
|
|
86
|
+
inputSchema: {
|
|
87
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
88
|
+
dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
|
|
89
|
+
policy: zod_1.z
|
|
90
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
91
|
+
.describe("DNS policy configuration (JSON object)"),
|
|
92
|
+
dryRun: zod_1.z
|
|
93
|
+
.boolean()
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("Preview this action without executing it"),
|
|
96
|
+
},
|
|
97
|
+
annotations: safety_js_1.WRITE,
|
|
98
|
+
}, async ({ siteId, dnsPolicyId, policy, dryRun }) => {
|
|
83
99
|
try {
|
|
84
100
|
if (dryRun)
|
|
85
101
|
return (0, safety_js_1.formatDryRun)("PUT", `/sites/${siteId}/dns/policies/${dnsPolicyId}`, policy);
|
|
@@ -90,18 +106,22 @@ function registerDnsPolicyTools(server, client, readOnly = false) {
|
|
|
90
106
|
return (0, responses_js_1.formatError)(err);
|
|
91
107
|
}
|
|
92
108
|
});
|
|
93
|
-
server.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
server.registerTool("unifi_delete_dns_policy", {
|
|
110
|
+
description: "DESTRUCTIVE: Delete a DNS policy",
|
|
111
|
+
inputSchema: {
|
|
112
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
113
|
+
dnsPolicyId: zod_1.z.string().describe("DNS policy ID"),
|
|
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
|
+
},
|
|
123
|
+
annotations: safety_js_1.DESTRUCTIVE,
|
|
124
|
+
}, async ({ siteId, dnsPolicyId, confirm, dryRun }) => {
|
|
105
125
|
const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the DNS policy");
|
|
106
126
|
if (guard)
|
|
107
127
|
return guard;
|
package/dist/tools/firewall.js
CHANGED
|
@@ -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 registerFirewallTools(server, client, readOnly = false) {
|
|
9
|
-
server.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
server.registerTool("unifi_list_firewall_zones", {
|
|
10
|
+
description: "List all firewall zones 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}/firewall/zones${query}`);
|
|
@@ -35,10 +39,14 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
35
39
|
return (0, responses_js_1.formatError)(err);
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
|
-
server.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
server.registerTool("unifi_get_firewall_zone", {
|
|
43
|
+
description: "Get a specific firewall zone by ID",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
46
|
+
firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
|
|
47
|
+
},
|
|
48
|
+
annotations: safety_js_1.READ_ONLY,
|
|
49
|
+
}, async ({ siteId, firewallZoneId }) => {
|
|
42
50
|
try {
|
|
43
51
|
const data = await client.get(`/sites/${siteId}/firewall/zones/${firewallZoneId}`);
|
|
44
52
|
return (0, responses_js_1.formatSuccess)(data);
|
|
@@ -47,26 +55,30 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
47
55
|
return (0, responses_js_1.formatError)(err);
|
|
48
56
|
}
|
|
49
57
|
});
|
|
50
|
-
server.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
server.registerTool("unifi_list_firewall_policies", {
|
|
59
|
+
description: "List all firewall policies at a site",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
62
|
+
offset: zod_1.z
|
|
63
|
+
.number()
|
|
64
|
+
.int()
|
|
65
|
+
.nonnegative()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe("Number of records to skip (default: 0)"),
|
|
68
|
+
limit: zod_1.z
|
|
69
|
+
.number()
|
|
70
|
+
.int()
|
|
71
|
+
.min(1)
|
|
72
|
+
.max(200)
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Number of records to return (default: 25, max: 200)"),
|
|
75
|
+
filter: zod_1.z
|
|
76
|
+
.string()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe("Filter expression"),
|
|
79
|
+
},
|
|
80
|
+
annotations: safety_js_1.READ_ONLY,
|
|
81
|
+
}, async ({ siteId, offset, limit, filter }) => {
|
|
70
82
|
try {
|
|
71
83
|
const query = (0, query_js_1.buildQuery)({ offset, limit, filter });
|
|
72
84
|
const data = await client.get(`/sites/${siteId}/firewall/policies${query}`);
|
|
@@ -76,10 +88,14 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
76
88
|
return (0, responses_js_1.formatError)(err);
|
|
77
89
|
}
|
|
78
90
|
});
|
|
79
|
-
server.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
server.registerTool("unifi_get_firewall_policy", {
|
|
92
|
+
description: "Get a specific firewall policy by ID",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
95
|
+
firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
|
|
96
|
+
},
|
|
97
|
+
annotations: safety_js_1.READ_ONLY,
|
|
98
|
+
}, async ({ siteId, firewallPolicyId }) => {
|
|
83
99
|
try {
|
|
84
100
|
const data = await client.get(`/sites/${siteId}/firewall/policies/${firewallPolicyId}`);
|
|
85
101
|
return (0, responses_js_1.formatSuccess)(data);
|
|
@@ -88,13 +104,17 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
88
104
|
return (0, responses_js_1.formatError)(err);
|
|
89
105
|
}
|
|
90
106
|
});
|
|
91
|
-
server.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.string()
|
|
96
|
-
.
|
|
97
|
-
|
|
107
|
+
server.registerTool("unifi_get_firewall_policy_ordering", {
|
|
108
|
+
description: "Get user-defined firewall policy ordering for a zone pair",
|
|
109
|
+
inputSchema: {
|
|
110
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
111
|
+
sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
|
|
112
|
+
destinationFirewallZoneId: zod_1.z
|
|
113
|
+
.string()
|
|
114
|
+
.describe("Destination firewall zone ID"),
|
|
115
|
+
},
|
|
116
|
+
annotations: safety_js_1.READ_ONLY,
|
|
117
|
+
}, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId }) => {
|
|
98
118
|
try {
|
|
99
119
|
const query = `?sourceFirewallZoneId=${encodeURIComponent(sourceFirewallZoneId)}&destinationFirewallZoneId=${encodeURIComponent(destinationFirewallZoneId)}`;
|
|
100
120
|
const data = await client.get(`/sites/${siteId}/firewall/policies/ordering${query}`);
|
|
@@ -106,17 +126,21 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
106
126
|
});
|
|
107
127
|
if (readOnly)
|
|
108
128
|
return;
|
|
109
|
-
server.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
|
|
129
|
+
server.registerTool("unifi_create_firewall_zone", {
|
|
130
|
+
description: "Create a new custom firewall zone",
|
|
131
|
+
inputSchema: {
|
|
132
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
133
|
+
name: zod_1.z.string().describe("Zone name"),
|
|
134
|
+
networkIds: zod_1.z
|
|
135
|
+
.array(zod_1.z.string())
|
|
136
|
+
.describe("Network IDs to include in this zone"),
|
|
137
|
+
dryRun: zod_1.z
|
|
138
|
+
.boolean()
|
|
139
|
+
.optional()
|
|
140
|
+
.describe("Preview this action without executing it"),
|
|
141
|
+
},
|
|
142
|
+
annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
|
|
143
|
+
}, async ({ siteId, name, networkIds, dryRun }) => {
|
|
120
144
|
try {
|
|
121
145
|
const body = { name, networkIds };
|
|
122
146
|
if (dryRun)
|
|
@@ -128,18 +152,22 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
128
152
|
return (0, responses_js_1.formatError)(err);
|
|
129
153
|
}
|
|
130
154
|
});
|
|
131
|
-
server.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.
|
|
141
|
-
|
|
142
|
-
|
|
155
|
+
server.registerTool("unifi_update_firewall_zone", {
|
|
156
|
+
description: "Update a firewall zone",
|
|
157
|
+
inputSchema: {
|
|
158
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
159
|
+
firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
|
|
160
|
+
name: zod_1.z.string().describe("Zone name"),
|
|
161
|
+
networkIds: zod_1.z
|
|
162
|
+
.array(zod_1.z.string())
|
|
163
|
+
.describe("Network IDs to include in this zone"),
|
|
164
|
+
dryRun: zod_1.z
|
|
165
|
+
.boolean()
|
|
166
|
+
.optional()
|
|
167
|
+
.describe("Preview this action without executing it"),
|
|
168
|
+
},
|
|
169
|
+
annotations: safety_js_1.WRITE,
|
|
170
|
+
}, async ({ siteId, firewallZoneId, name, networkIds, dryRun }) => {
|
|
143
171
|
try {
|
|
144
172
|
const body = { name, networkIds };
|
|
145
173
|
if (dryRun)
|
|
@@ -151,18 +179,22 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
151
179
|
return (0, responses_js_1.formatError)(err);
|
|
152
180
|
}
|
|
153
181
|
});
|
|
154
|
-
server.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
.
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.
|
|
164
|
-
|
|
165
|
-
|
|
182
|
+
server.registerTool("unifi_delete_firewall_zone", {
|
|
183
|
+
description: "DESTRUCTIVE: Delete a custom firewall zone",
|
|
184
|
+
inputSchema: {
|
|
185
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
186
|
+
firewallZoneId: zod_1.z.string().describe("Firewall zone ID"),
|
|
187
|
+
confirm: zod_1.z
|
|
188
|
+
.boolean()
|
|
189
|
+
.optional()
|
|
190
|
+
.describe("Must be true to execute this destructive action"),
|
|
191
|
+
dryRun: zod_1.z
|
|
192
|
+
.boolean()
|
|
193
|
+
.optional()
|
|
194
|
+
.describe("Preview this action without executing it"),
|
|
195
|
+
},
|
|
196
|
+
annotations: safety_js_1.DESTRUCTIVE,
|
|
197
|
+
}, async ({ siteId, firewallZoneId, confirm, dryRun }) => {
|
|
166
198
|
const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the firewall zone");
|
|
167
199
|
if (guard)
|
|
168
200
|
return guard;
|
|
@@ -176,16 +208,20 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
176
208
|
return (0, responses_js_1.formatError)(err);
|
|
177
209
|
}
|
|
178
210
|
});
|
|
179
|
-
server.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
.
|
|
187
|
-
|
|
188
|
-
|
|
211
|
+
server.registerTool("unifi_create_firewall_policy", {
|
|
212
|
+
description: "Create a new firewall policy",
|
|
213
|
+
inputSchema: {
|
|
214
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
215
|
+
policy: zod_1.z
|
|
216
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
217
|
+
.describe("Firewall policy configuration (JSON object)"),
|
|
218
|
+
dryRun: zod_1.z
|
|
219
|
+
.boolean()
|
|
220
|
+
.optional()
|
|
221
|
+
.describe("Preview this action without executing it"),
|
|
222
|
+
},
|
|
223
|
+
annotations: safety_js_1.WRITE_NOT_IDEMPOTENT,
|
|
224
|
+
}, async ({ siteId, policy, dryRun }) => {
|
|
189
225
|
try {
|
|
190
226
|
if (dryRun)
|
|
191
227
|
return (0, safety_js_1.formatDryRun)("POST", `/sites/${siteId}/firewall/policies`, policy);
|
|
@@ -196,17 +232,21 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
196
232
|
return (0, responses_js_1.formatError)(err);
|
|
197
233
|
}
|
|
198
234
|
});
|
|
199
|
-
server.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.
|
|
208
|
-
|
|
209
|
-
|
|
235
|
+
server.registerTool("unifi_update_firewall_policy", {
|
|
236
|
+
description: "Update a firewall policy",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
239
|
+
firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
|
|
240
|
+
policy: zod_1.z
|
|
241
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
242
|
+
.describe("Firewall policy configuration (JSON object)"),
|
|
243
|
+
dryRun: zod_1.z
|
|
244
|
+
.boolean()
|
|
245
|
+
.optional()
|
|
246
|
+
.describe("Preview this action without executing it"),
|
|
247
|
+
},
|
|
248
|
+
annotations: safety_js_1.WRITE,
|
|
249
|
+
}, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
|
|
210
250
|
try {
|
|
211
251
|
if (dryRun)
|
|
212
252
|
return (0, safety_js_1.formatDryRun)("PUT", `/sites/${siteId}/firewall/policies/${firewallPolicyId}`, policy);
|
|
@@ -217,17 +257,21 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
217
257
|
return (0, responses_js_1.formatError)(err);
|
|
218
258
|
}
|
|
219
259
|
});
|
|
220
|
-
server.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
.
|
|
229
|
-
|
|
230
|
-
|
|
260
|
+
server.registerTool("unifi_patch_firewall_policy", {
|
|
261
|
+
description: "Partially update a firewall policy (e.g. toggle logging)",
|
|
262
|
+
inputSchema: {
|
|
263
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
264
|
+
firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
|
|
265
|
+
policy: zod_1.z
|
|
266
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
267
|
+
.describe("Partial firewall policy fields to update (e.g. { loggingEnabled: true })"),
|
|
268
|
+
dryRun: zod_1.z
|
|
269
|
+
.boolean()
|
|
270
|
+
.optional()
|
|
271
|
+
.describe("Preview this action without executing it"),
|
|
272
|
+
},
|
|
273
|
+
annotations: safety_js_1.WRITE,
|
|
274
|
+
}, async ({ siteId, firewallPolicyId, policy, dryRun }) => {
|
|
231
275
|
try {
|
|
232
276
|
if (dryRun)
|
|
233
277
|
return (0, safety_js_1.formatDryRun)("PATCH", `/sites/${siteId}/firewall/policies/${firewallPolicyId}`, policy);
|
|
@@ -238,18 +282,22 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
238
282
|
return (0, responses_js_1.formatError)(err);
|
|
239
283
|
}
|
|
240
284
|
});
|
|
241
|
-
server.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
.
|
|
246
|
-
.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
.
|
|
251
|
-
|
|
252
|
-
|
|
285
|
+
server.registerTool("unifi_delete_firewall_policy", {
|
|
286
|
+
description: "DESTRUCTIVE: Delete a firewall policy",
|
|
287
|
+
inputSchema: {
|
|
288
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
289
|
+
firewallPolicyId: zod_1.z.string().describe("Firewall policy ID"),
|
|
290
|
+
confirm: zod_1.z
|
|
291
|
+
.boolean()
|
|
292
|
+
.optional()
|
|
293
|
+
.describe("Must be true to execute this destructive action"),
|
|
294
|
+
dryRun: zod_1.z
|
|
295
|
+
.boolean()
|
|
296
|
+
.optional()
|
|
297
|
+
.describe("Preview this action without executing it"),
|
|
298
|
+
},
|
|
299
|
+
annotations: safety_js_1.DESTRUCTIVE,
|
|
300
|
+
}, async ({ siteId, firewallPolicyId, confirm, dryRun }) => {
|
|
253
301
|
const guard = (0, safety_js_1.requireConfirmation)(confirm, "This will delete the firewall policy");
|
|
254
302
|
if (guard)
|
|
255
303
|
return guard;
|
|
@@ -263,20 +311,24 @@ function registerFirewallTools(server, client, readOnly = false) {
|
|
|
263
311
|
return (0, responses_js_1.formatError)(err);
|
|
264
312
|
}
|
|
265
313
|
});
|
|
266
|
-
server.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
.string()
|
|
271
|
-
.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
.
|
|
278
|
-
|
|
279
|
-
|
|
314
|
+
server.registerTool("unifi_reorder_firewall_policies", {
|
|
315
|
+
description: "Reorder user-defined firewall policies for a zone pair",
|
|
316
|
+
inputSchema: {
|
|
317
|
+
siteId: zod_1.z.string().describe("Site ID"),
|
|
318
|
+
sourceFirewallZoneId: zod_1.z.string().describe("Source firewall zone ID"),
|
|
319
|
+
destinationFirewallZoneId: zod_1.z
|
|
320
|
+
.string()
|
|
321
|
+
.describe("Destination firewall zone ID"),
|
|
322
|
+
orderedFirewallPolicyIds: zod_1.z
|
|
323
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
324
|
+
.describe("Ordered policy IDs object with beforeSystemDefined and afterSystemDefined arrays"),
|
|
325
|
+
dryRun: zod_1.z
|
|
326
|
+
.boolean()
|
|
327
|
+
.optional()
|
|
328
|
+
.describe("Preview this action without executing it"),
|
|
329
|
+
},
|
|
330
|
+
annotations: safety_js_1.WRITE,
|
|
331
|
+
}, async ({ siteId, sourceFirewallZoneId, destinationFirewallZoneId, orderedFirewallPolicyIds, dryRun, }) => {
|
|
280
332
|
try {
|
|
281
333
|
const query = `?sourceFirewallZoneId=${encodeURIComponent(sourceFirewallZoneId)}&destinationFirewallZoneId=${encodeURIComponent(destinationFirewallZoneId)}`;
|
|
282
334
|
const body = { orderedFirewallPolicyIds };
|