@teamnetwork-nz/sonicwall-api-mcp-server 0.9.0 → 0.9.1
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/index.js +257 -257
- package/dist/strict-tools.js +3 -3
- package/package.json +52 -52
package/dist/index.js
CHANGED
|
@@ -55,21 +55,21 @@ function parsePositiveInt(name, raw, fallback, maximum) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/config.ts
|
|
58
|
-
var
|
|
59
|
-
var DeviceProfileSchema =
|
|
60
|
-
name:
|
|
61
|
-
host:
|
|
62
|
-
username:
|
|
63
|
-
password:
|
|
64
|
-
port:
|
|
65
|
-
sslVerify:
|
|
66
|
-
readOnly:
|
|
67
|
-
requestTimeout:
|
|
58
|
+
var import_v3 = require("zod/v3");
|
|
59
|
+
var DeviceProfileSchema = import_v3.z.object({
|
|
60
|
+
name: import_v3.z.string().min(1),
|
|
61
|
+
host: import_v3.z.string().min(1),
|
|
62
|
+
username: import_v3.z.string().min(1),
|
|
63
|
+
password: import_v3.z.string().min(1),
|
|
64
|
+
port: import_v3.z.number().int().min(1).max(65535),
|
|
65
|
+
sslVerify: import_v3.z.boolean(),
|
|
66
|
+
readOnly: import_v3.z.boolean(),
|
|
67
|
+
requestTimeout: import_v3.z.number().int().min(1).max(300)
|
|
68
68
|
}).strict();
|
|
69
|
-
var ConfigSchema =
|
|
70
|
-
profiles:
|
|
71
|
-
transport:
|
|
72
|
-
ssePort:
|
|
69
|
+
var ConfigSchema = import_v3.z.object({
|
|
70
|
+
profiles: import_v3.z.array(DeviceProfileSchema).min(1),
|
|
71
|
+
transport: import_v3.z.enum(["stdio", "http"]),
|
|
72
|
+
ssePort: import_v3.z.number().int().min(1).max(65535)
|
|
73
73
|
}).strict();
|
|
74
74
|
function loadConfig() {
|
|
75
75
|
const devicesFile = process.env.SONICWALL_DEVICES_FILE;
|
|
@@ -570,7 +570,7 @@ var DeviceRegistry = class {
|
|
|
570
570
|
};
|
|
571
571
|
|
|
572
572
|
// src/tools/system.ts
|
|
573
|
-
var
|
|
573
|
+
var import_v32 = require("zod/v3");
|
|
574
574
|
function registerSystemTools(server, registry) {
|
|
575
575
|
server.tool(
|
|
576
576
|
"list_devices",
|
|
@@ -588,7 +588,7 @@ function registerSystemTools(server, registry) {
|
|
|
588
588
|
server.tool(
|
|
589
589
|
"get_system_status",
|
|
590
590
|
"Return device model, firmware version, serial number, and uptime.",
|
|
591
|
-
{ device:
|
|
591
|
+
{ device: import_v32.z.string().optional() },
|
|
592
592
|
async ({ device }) => {
|
|
593
593
|
try {
|
|
594
594
|
const client = await registry.getClient(device);
|
|
@@ -602,7 +602,7 @@ function registerSystemTools(server, registry) {
|
|
|
602
602
|
server.tool(
|
|
603
603
|
"commit_config",
|
|
604
604
|
"Commit all staged configuration changes so they take effect on the appliance. Must be called after any create/update/delete operation or changes will be lost.",
|
|
605
|
-
{ device:
|
|
605
|
+
{ device: import_v32.z.string().optional() },
|
|
606
606
|
async ({ device }) => {
|
|
607
607
|
try {
|
|
608
608
|
const client = await registry.getClient(device);
|
|
@@ -616,7 +616,7 @@ function registerSystemTools(server, registry) {
|
|
|
616
616
|
server.tool(
|
|
617
617
|
"discard_config",
|
|
618
618
|
"Discard all staged configuration changes without applying them.",
|
|
619
|
-
{ device:
|
|
619
|
+
{ device: import_v32.z.string().optional() },
|
|
620
620
|
async ({ device }) => {
|
|
621
621
|
try {
|
|
622
622
|
const client = await registry.getClient(device);
|
|
@@ -630,7 +630,7 @@ function registerSystemTools(server, registry) {
|
|
|
630
630
|
server.tool(
|
|
631
631
|
"get_pending_config",
|
|
632
632
|
"Show configuration changes that have been staged but not yet committed.",
|
|
633
|
-
{ device:
|
|
633
|
+
{ device: import_v32.z.string().optional() },
|
|
634
634
|
async ({ device }) => {
|
|
635
635
|
try {
|
|
636
636
|
const client = await registry.getClient(device);
|
|
@@ -644,15 +644,15 @@ function registerSystemTools(server, registry) {
|
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
// src/tools/address-objects.ts
|
|
647
|
-
var
|
|
647
|
+
var import_v33 = require("zod/v3");
|
|
648
648
|
var ALL_TYPES = ["ipv4", "ipv6", "fqdn", "mac"];
|
|
649
649
|
function registerAddressObjectTools(server, registry) {
|
|
650
650
|
server.tool(
|
|
651
651
|
"list_address_objects",
|
|
652
652
|
"List address objects on the appliance. type: filter by 'ipv4', 'ipv6', 'fqdn', 'mac', or 'all' (default).",
|
|
653
653
|
{
|
|
654
|
-
type:
|
|
655
|
-
device:
|
|
654
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac", "all"]).optional().default("all"),
|
|
655
|
+
device: import_v33.z.string().optional()
|
|
656
656
|
},
|
|
657
657
|
async ({ type, device }) => {
|
|
658
658
|
try {
|
|
@@ -683,9 +683,9 @@ function registerAddressObjectTools(server, registry) {
|
|
|
683
683
|
"get_address_object",
|
|
684
684
|
"Retrieve a single address object by name and type.",
|
|
685
685
|
{
|
|
686
|
-
name:
|
|
687
|
-
type:
|
|
688
|
-
device:
|
|
686
|
+
name: import_v33.z.string(),
|
|
687
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
688
|
+
device: import_v33.z.string().optional()
|
|
689
689
|
},
|
|
690
690
|
async ({ name, type, device }) => {
|
|
691
691
|
try {
|
|
@@ -701,14 +701,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
701
701
|
"create_address_object_ipv4",
|
|
702
702
|
"Create an IPv4 address object. Provide exactly one of: host (single IP or CIDR), network+subnet_mask, or range_begin+range_end. Changes are STAGED; call commit_config to apply.",
|
|
703
703
|
{
|
|
704
|
-
name:
|
|
705
|
-
zone:
|
|
706
|
-
host:
|
|
707
|
-
network:
|
|
708
|
-
subnet_mask:
|
|
709
|
-
range_begin:
|
|
710
|
-
range_end:
|
|
711
|
-
device:
|
|
704
|
+
name: import_v33.z.string(),
|
|
705
|
+
zone: import_v33.z.string(),
|
|
706
|
+
host: import_v33.z.string().optional(),
|
|
707
|
+
network: import_v33.z.string().optional(),
|
|
708
|
+
subnet_mask: import_v33.z.string().optional(),
|
|
709
|
+
range_begin: import_v33.z.string().optional(),
|
|
710
|
+
range_end: import_v33.z.string().optional(),
|
|
711
|
+
device: import_v33.z.string().optional()
|
|
712
712
|
},
|
|
713
713
|
async ({ name, zone, host, network, subnet_mask, range_begin, range_end, device }) => {
|
|
714
714
|
try {
|
|
@@ -734,12 +734,12 @@ function registerAddressObjectTools(server, registry) {
|
|
|
734
734
|
"create_address_object_ipv6",
|
|
735
735
|
"Create an IPv6 address object. Provide either address (single IPv6) or network+prefix_length. Changes are STAGED; call commit_config to apply.",
|
|
736
736
|
{
|
|
737
|
-
name:
|
|
738
|
-
zone:
|
|
739
|
-
address:
|
|
740
|
-
network:
|
|
741
|
-
prefix_length:
|
|
742
|
-
device:
|
|
737
|
+
name: import_v33.z.string(),
|
|
738
|
+
zone: import_v33.z.string(),
|
|
739
|
+
address: import_v33.z.string().optional(),
|
|
740
|
+
network: import_v33.z.string().optional(),
|
|
741
|
+
prefix_length: import_v33.z.number().optional(),
|
|
742
|
+
device: import_v33.z.string().optional()
|
|
743
743
|
},
|
|
744
744
|
async ({ name, zone, address, network, prefix_length, device }) => {
|
|
745
745
|
try {
|
|
@@ -763,10 +763,10 @@ function registerAddressObjectTools(server, registry) {
|
|
|
763
763
|
"create_address_object_fqdn",
|
|
764
764
|
"Create an FQDN address object. Changes are STAGED; call commit_config to apply.",
|
|
765
765
|
{
|
|
766
|
-
name:
|
|
767
|
-
zone:
|
|
768
|
-
domain:
|
|
769
|
-
device:
|
|
766
|
+
name: import_v33.z.string(),
|
|
767
|
+
zone: import_v33.z.string(),
|
|
768
|
+
domain: import_v33.z.string(),
|
|
769
|
+
device: import_v33.z.string().optional()
|
|
770
770
|
},
|
|
771
771
|
async ({ name, zone, domain, device }) => {
|
|
772
772
|
try {
|
|
@@ -784,14 +784,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
784
784
|
"update_address_object",
|
|
785
785
|
"Update an existing address object. Only supplied fields are changed (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
786
786
|
{
|
|
787
|
-
name:
|
|
788
|
-
type:
|
|
789
|
-
zone:
|
|
790
|
-
host:
|
|
791
|
-
network:
|
|
792
|
-
subnet_mask:
|
|
793
|
-
domain:
|
|
794
|
-
device:
|
|
787
|
+
name: import_v33.z.string(),
|
|
788
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
789
|
+
zone: import_v33.z.string().optional(),
|
|
790
|
+
host: import_v33.z.string().optional(),
|
|
791
|
+
network: import_v33.z.string().optional(),
|
|
792
|
+
subnet_mask: import_v33.z.string().optional(),
|
|
793
|
+
domain: import_v33.z.string().optional(),
|
|
794
|
+
device: import_v33.z.string().optional()
|
|
795
795
|
},
|
|
796
796
|
async ({ name, type, zone, host, network, subnet_mask, domain, device }) => {
|
|
797
797
|
try {
|
|
@@ -816,9 +816,9 @@ function registerAddressObjectTools(server, registry) {
|
|
|
816
816
|
"delete_address_object",
|
|
817
817
|
"Delete an address object by name and type. Changes are STAGED; call commit_config to apply.",
|
|
818
818
|
{
|
|
819
|
-
name:
|
|
820
|
-
type:
|
|
821
|
-
device:
|
|
819
|
+
name: import_v33.z.string(),
|
|
820
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
821
|
+
device: import_v33.z.string().optional()
|
|
822
822
|
},
|
|
823
823
|
async ({ name, type, device }) => {
|
|
824
824
|
try {
|
|
@@ -833,14 +833,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
// src/tools/address-groups.ts
|
|
836
|
-
var
|
|
836
|
+
var import_v34 = require("zod/v3");
|
|
837
837
|
function registerAddressGroupTools(server, registry) {
|
|
838
838
|
server.tool(
|
|
839
839
|
"list_address_groups",
|
|
840
840
|
"List address groups on the appliance. type: filter by 'ipv4', 'ipv6', or 'all' (default).",
|
|
841
841
|
{
|
|
842
|
-
type:
|
|
843
|
-
device:
|
|
842
|
+
type: import_v34.z.enum(["ipv4", "ipv6", "all"]).optional().default("all"),
|
|
843
|
+
device: import_v34.z.string().optional()
|
|
844
844
|
},
|
|
845
845
|
async ({ type, device }) => {
|
|
846
846
|
try {
|
|
@@ -871,9 +871,9 @@ function registerAddressGroupTools(server, registry) {
|
|
|
871
871
|
"get_address_group",
|
|
872
872
|
"Retrieve a single address group by name.",
|
|
873
873
|
{
|
|
874
|
-
name:
|
|
875
|
-
type:
|
|
876
|
-
device:
|
|
874
|
+
name: import_v34.z.string(),
|
|
875
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
876
|
+
device: import_v34.z.string().optional()
|
|
877
877
|
},
|
|
878
878
|
async ({ name, type, device }) => {
|
|
879
879
|
try {
|
|
@@ -889,10 +889,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
889
889
|
"create_address_group",
|
|
890
890
|
"Create an address group with the given member object names. members: list of address object names. Changes are STAGED; call commit_config to apply.",
|
|
891
891
|
{
|
|
892
|
-
name:
|
|
893
|
-
type:
|
|
894
|
-
members:
|
|
895
|
-
device:
|
|
892
|
+
name: import_v34.z.string(),
|
|
893
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
894
|
+
members: import_v34.z.array(import_v34.z.string()),
|
|
895
|
+
device: import_v34.z.string().optional()
|
|
896
896
|
},
|
|
897
897
|
async ({ name, type, members, device }) => {
|
|
898
898
|
try {
|
|
@@ -911,10 +911,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
911
911
|
"add_address_group_member",
|
|
912
912
|
"Add a member address object to an existing address group. Changes are STAGED; call commit_config to apply.",
|
|
913
913
|
{
|
|
914
|
-
group_name:
|
|
915
|
-
type:
|
|
916
|
-
member_name:
|
|
917
|
-
device:
|
|
914
|
+
group_name: import_v34.z.string(),
|
|
915
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
916
|
+
member_name: import_v34.z.string(),
|
|
917
|
+
device: import_v34.z.string().optional()
|
|
918
918
|
},
|
|
919
919
|
async ({ group_name, type, member_name, device }) => {
|
|
920
920
|
try {
|
|
@@ -940,10 +940,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
940
940
|
"remove_address_group_member",
|
|
941
941
|
"Remove a member address object from an address group. Changes are STAGED; call commit_config to apply.",
|
|
942
942
|
{
|
|
943
|
-
group_name:
|
|
944
|
-
type:
|
|
945
|
-
member_name:
|
|
946
|
-
device:
|
|
943
|
+
group_name: import_v34.z.string(),
|
|
944
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
945
|
+
member_name: import_v34.z.string(),
|
|
946
|
+
device: import_v34.z.string().optional()
|
|
947
947
|
},
|
|
948
948
|
async ({ group_name, type, member_name, device }) => {
|
|
949
949
|
try {
|
|
@@ -966,9 +966,9 @@ function registerAddressGroupTools(server, registry) {
|
|
|
966
966
|
"delete_address_group",
|
|
967
967
|
"Delete an address group by name. Changes are STAGED; call commit_config to apply.",
|
|
968
968
|
{
|
|
969
|
-
name:
|
|
970
|
-
type:
|
|
971
|
-
device:
|
|
969
|
+
name: import_v34.z.string(),
|
|
970
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
971
|
+
device: import_v34.z.string().optional()
|
|
972
972
|
},
|
|
973
973
|
async ({ name, type, device }) => {
|
|
974
974
|
try {
|
|
@@ -983,13 +983,13 @@ function registerAddressGroupTools(server, registry) {
|
|
|
983
983
|
}
|
|
984
984
|
|
|
985
985
|
// src/tools/service-objects.ts
|
|
986
|
-
var
|
|
986
|
+
var import_v35 = require("zod/v3");
|
|
987
987
|
var PROTOCOLS = ["TCP", "UDP", "ICMP", "ICMPv6", "IGMP", "GRE", "ESP", "AH", "OTHER"];
|
|
988
988
|
function registerServiceObjectTools(server, registry) {
|
|
989
989
|
server.tool(
|
|
990
990
|
"list_service_objects",
|
|
991
991
|
"List all service objects on the appliance.",
|
|
992
|
-
{ device:
|
|
992
|
+
{ device: import_v35.z.string().optional() },
|
|
993
993
|
async ({ device }) => {
|
|
994
994
|
try {
|
|
995
995
|
const client = await registry.getClient(device);
|
|
@@ -1003,7 +1003,7 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1003
1003
|
server.tool(
|
|
1004
1004
|
"get_service_object",
|
|
1005
1005
|
"Retrieve a service object by name.",
|
|
1006
|
-
{ name:
|
|
1006
|
+
{ name: import_v35.z.string(), device: import_v35.z.string().optional() },
|
|
1007
1007
|
async ({ name, device }) => {
|
|
1008
1008
|
try {
|
|
1009
1009
|
const client = await registry.getClient(device);
|
|
@@ -1018,13 +1018,13 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1018
1018
|
"create_service_object",
|
|
1019
1019
|
"Create a service object. For TCP/UDP: provide port_begin (and optionally port_end for a range). For ICMP/ICMPv6: provide icmp_type and optionally icmp_code. Changes are STAGED; call commit_config to apply.",
|
|
1020
1020
|
{
|
|
1021
|
-
name:
|
|
1022
|
-
protocol:
|
|
1023
|
-
port_begin:
|
|
1024
|
-
port_end:
|
|
1025
|
-
icmp_type:
|
|
1026
|
-
icmp_code:
|
|
1027
|
-
device:
|
|
1021
|
+
name: import_v35.z.string(),
|
|
1022
|
+
protocol: import_v35.z.enum(PROTOCOLS),
|
|
1023
|
+
port_begin: import_v35.z.number().optional(),
|
|
1024
|
+
port_end: import_v35.z.number().optional(),
|
|
1025
|
+
icmp_type: import_v35.z.number().optional(),
|
|
1026
|
+
icmp_code: import_v35.z.number().optional(),
|
|
1027
|
+
device: import_v35.z.string().optional()
|
|
1028
1028
|
},
|
|
1029
1029
|
async ({ name, protocol, port_begin, port_end, icmp_type, icmp_code, device }) => {
|
|
1030
1030
|
try {
|
|
@@ -1051,12 +1051,12 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1051
1051
|
"update_service_object",
|
|
1052
1052
|
"Update port or ICMP fields on an existing service object (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1053
1053
|
{
|
|
1054
|
-
name:
|
|
1055
|
-
port_begin:
|
|
1056
|
-
port_end:
|
|
1057
|
-
icmp_type:
|
|
1058
|
-
icmp_code:
|
|
1059
|
-
device:
|
|
1054
|
+
name: import_v35.z.string(),
|
|
1055
|
+
port_begin: import_v35.z.number().optional(),
|
|
1056
|
+
port_end: import_v35.z.number().optional(),
|
|
1057
|
+
icmp_type: import_v35.z.number().optional(),
|
|
1058
|
+
icmp_code: import_v35.z.number().optional(),
|
|
1059
|
+
device: import_v35.z.string().optional()
|
|
1060
1060
|
},
|
|
1061
1061
|
async ({ name, port_begin, port_end, icmp_type, icmp_code, device }) => {
|
|
1062
1062
|
try {
|
|
@@ -1093,7 +1093,7 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1093
1093
|
server.tool(
|
|
1094
1094
|
"delete_service_object",
|
|
1095
1095
|
"Delete a service object by name. Changes are STAGED; call commit_config to apply.",
|
|
1096
|
-
{ name:
|
|
1096
|
+
{ name: import_v35.z.string(), device: import_v35.z.string().optional() },
|
|
1097
1097
|
async ({ name, device }) => {
|
|
1098
1098
|
try {
|
|
1099
1099
|
const client = await registry.getClient(device);
|
|
@@ -1107,12 +1107,12 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
1109
|
// src/tools/service-groups.ts
|
|
1110
|
-
var
|
|
1110
|
+
var import_v36 = require("zod/v3");
|
|
1111
1111
|
function registerServiceGroupTools(server, registry) {
|
|
1112
1112
|
server.tool(
|
|
1113
1113
|
"list_service_groups",
|
|
1114
1114
|
"List all service groups on the appliance.",
|
|
1115
|
-
{ device:
|
|
1115
|
+
{ device: import_v36.z.string().optional() },
|
|
1116
1116
|
async ({ device }) => {
|
|
1117
1117
|
try {
|
|
1118
1118
|
const client = await registry.getClient(device);
|
|
@@ -1126,7 +1126,7 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1126
1126
|
server.tool(
|
|
1127
1127
|
"get_service_group",
|
|
1128
1128
|
"Retrieve a service group by name.",
|
|
1129
|
-
{ name:
|
|
1129
|
+
{ name: import_v36.z.string(), device: import_v36.z.string().optional() },
|
|
1130
1130
|
async ({ name, device }) => {
|
|
1131
1131
|
try {
|
|
1132
1132
|
const client = await registry.getClient(device);
|
|
@@ -1141,9 +1141,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1141
1141
|
"create_service_group",
|
|
1142
1142
|
"Create a service group containing the given service object names. Changes are STAGED; call commit_config to apply.",
|
|
1143
1143
|
{
|
|
1144
|
-
name:
|
|
1145
|
-
members:
|
|
1146
|
-
device:
|
|
1144
|
+
name: import_v36.z.string(),
|
|
1145
|
+
members: import_v36.z.array(import_v36.z.string()),
|
|
1146
|
+
device: import_v36.z.string().optional()
|
|
1147
1147
|
},
|
|
1148
1148
|
async ({ name, members, device }) => {
|
|
1149
1149
|
try {
|
|
@@ -1161,9 +1161,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1161
1161
|
"add_service_group_member",
|
|
1162
1162
|
"Add a service object to an existing service group (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1163
1163
|
{
|
|
1164
|
-
group_name:
|
|
1165
|
-
member_name:
|
|
1166
|
-
device:
|
|
1164
|
+
group_name: import_v36.z.string(),
|
|
1165
|
+
member_name: import_v36.z.string(),
|
|
1166
|
+
device: import_v36.z.string().optional()
|
|
1167
1167
|
},
|
|
1168
1168
|
async ({ group_name, member_name, device }) => {
|
|
1169
1169
|
try {
|
|
@@ -1187,9 +1187,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1187
1187
|
"remove_service_group_member",
|
|
1188
1188
|
"Remove a service object from a service group (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1189
1189
|
{
|
|
1190
|
-
group_name:
|
|
1191
|
-
member_name:
|
|
1192
|
-
device:
|
|
1190
|
+
group_name: import_v36.z.string(),
|
|
1191
|
+
member_name: import_v36.z.string(),
|
|
1192
|
+
device: import_v36.z.string().optional()
|
|
1193
1193
|
},
|
|
1194
1194
|
async ({ group_name, member_name, device }) => {
|
|
1195
1195
|
try {
|
|
@@ -1209,7 +1209,7 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1209
1209
|
server.tool(
|
|
1210
1210
|
"delete_service_group",
|
|
1211
1211
|
"Delete a service group by name. Changes are STAGED; call commit_config to apply.",
|
|
1212
|
-
{ name:
|
|
1212
|
+
{ name: import_v36.z.string(), device: import_v36.z.string().optional() },
|
|
1213
1213
|
async ({ name, device }) => {
|
|
1214
1214
|
try {
|
|
1215
1215
|
const client = await registry.getClient(device);
|
|
@@ -1223,7 +1223,7 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
1225
|
// src/tools/access-rules.ts
|
|
1226
|
-
var
|
|
1226
|
+
var import_v37 = require("zod/v3");
|
|
1227
1227
|
function zoneName(v) {
|
|
1228
1228
|
if (typeof v === "string") return v;
|
|
1229
1229
|
if (v && typeof v === "object") {
|
|
@@ -1240,10 +1240,10 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1240
1240
|
"list_access_rules",
|
|
1241
1241
|
"List firewall access rules, optionally filtered by source and/or destination zone. Filtering is applied client-side over the complete ruleset; matched is the number returned and total is the unfiltered rule count (not pagination). Use each rule's uuid value as rule_uuid for get/update/enable/disable/delete tools.",
|
|
1242
1242
|
{
|
|
1243
|
-
ip_version:
|
|
1244
|
-
from_zone:
|
|
1245
|
-
to_zone:
|
|
1246
|
-
device:
|
|
1243
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1244
|
+
from_zone: import_v37.z.string().optional(),
|
|
1245
|
+
to_zone: import_v37.z.string().optional(),
|
|
1246
|
+
device: import_v37.z.string().optional()
|
|
1247
1247
|
},
|
|
1248
1248
|
async ({ ip_version, from_zone, to_zone, device }) => {
|
|
1249
1249
|
try {
|
|
@@ -1271,9 +1271,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1271
1271
|
"get_access_rule",
|
|
1272
1272
|
"Retrieve a single access rule by UUID. Pass a rule's uuid value from list_access_rules as rule_uuid.",
|
|
1273
1273
|
{
|
|
1274
|
-
rule_uuid:
|
|
1275
|
-
ip_version:
|
|
1276
|
-
device:
|
|
1274
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1275
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1276
|
+
device: import_v37.z.string().optional()
|
|
1277
1277
|
},
|
|
1278
1278
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1279
1279
|
try {
|
|
@@ -1289,20 +1289,20 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1289
1289
|
"create_access_rule",
|
|
1290
1290
|
"Create a firewall access rule. source/destination/service: name of an existing address/service object or 'Any'. geo_ip_policy: name of a GeoIP policy that already exists on the appliance (GeoIP policies cannot be created or listed via this server \u2014 manage them in the appliance web UI). Changes are STAGED; call commit_config to apply.",
|
|
1291
1291
|
{
|
|
1292
|
-
ip_version:
|
|
1293
|
-
name:
|
|
1294
|
-
action:
|
|
1295
|
-
from_zone:
|
|
1296
|
-
to_zone:
|
|
1297
|
-
source:
|
|
1298
|
-
destination:
|
|
1299
|
-
service:
|
|
1300
|
-
enabled:
|
|
1301
|
-
log:
|
|
1302
|
-
priority:
|
|
1303
|
-
geo_ip_policy:
|
|
1304
|
-
comment:
|
|
1305
|
-
device:
|
|
1292
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]),
|
|
1293
|
+
name: import_v37.z.string(),
|
|
1294
|
+
action: import_v37.z.enum(["allow", "deny", "discard"]),
|
|
1295
|
+
from_zone: import_v37.z.string(),
|
|
1296
|
+
to_zone: import_v37.z.string(),
|
|
1297
|
+
source: import_v37.z.string(),
|
|
1298
|
+
destination: import_v37.z.string(),
|
|
1299
|
+
service: import_v37.z.string(),
|
|
1300
|
+
enabled: import_v37.z.boolean().optional().default(true),
|
|
1301
|
+
log: import_v37.z.boolean().optional().default(true),
|
|
1302
|
+
priority: import_v37.z.number().optional(),
|
|
1303
|
+
geo_ip_policy: import_v37.z.string().optional(),
|
|
1304
|
+
comment: import_v37.z.string().optional(),
|
|
1305
|
+
device: import_v37.z.string().optional()
|
|
1306
1306
|
},
|
|
1307
1307
|
async ({ ip_version, name, action, from_zone, to_zone, source, destination, service, enabled, log, priority, geo_ip_policy, comment, device }) => {
|
|
1308
1308
|
try {
|
|
@@ -1334,17 +1334,17 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1334
1334
|
"update_access_rule",
|
|
1335
1335
|
"Update an access rule selected by UUID (GET-then-PUT). Pass a rule's uuid value from list_access_rules as rule_uuid. Only provided fields are changed. geo_ip_policy: name of an existing appliance GeoIP policy, or '' to remove it. Changes are STAGED; call commit_config to apply.",
|
|
1336
1336
|
{
|
|
1337
|
-
rule_uuid:
|
|
1338
|
-
ip_version:
|
|
1339
|
-
action:
|
|
1340
|
-
source:
|
|
1341
|
-
destination:
|
|
1342
|
-
service:
|
|
1343
|
-
enabled:
|
|
1344
|
-
log:
|
|
1345
|
-
geo_ip_policy:
|
|
1346
|
-
comment:
|
|
1347
|
-
device:
|
|
1337
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1338
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1339
|
+
action: import_v37.z.enum(["allow", "deny", "discard"]).optional(),
|
|
1340
|
+
source: import_v37.z.string().optional(),
|
|
1341
|
+
destination: import_v37.z.string().optional(),
|
|
1342
|
+
service: import_v37.z.string().optional(),
|
|
1343
|
+
enabled: import_v37.z.boolean().optional(),
|
|
1344
|
+
log: import_v37.z.boolean().optional(),
|
|
1345
|
+
geo_ip_policy: import_v37.z.string().optional(),
|
|
1346
|
+
comment: import_v37.z.string().optional(),
|
|
1347
|
+
device: import_v37.z.string().optional()
|
|
1348
1348
|
},
|
|
1349
1349
|
async ({ rule_uuid, ip_version, action, source, destination, service, enabled, log, geo_ip_policy, comment, device }) => {
|
|
1350
1350
|
try {
|
|
@@ -1386,9 +1386,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1386
1386
|
"delete_access_rule",
|
|
1387
1387
|
"Delete an access rule by UUID. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1388
1388
|
{
|
|
1389
|
-
rule_uuid:
|
|
1390
|
-
ip_version:
|
|
1391
|
-
device:
|
|
1389
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1390
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1391
|
+
device: import_v37.z.string().optional()
|
|
1392
1392
|
},
|
|
1393
1393
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1394
1394
|
try {
|
|
@@ -1404,9 +1404,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1404
1404
|
"enable_access_rule",
|
|
1405
1405
|
"Enable an access rule selected by UUID without modifying other fields. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1406
1406
|
{
|
|
1407
|
-
rule_uuid:
|
|
1408
|
-
ip_version:
|
|
1409
|
-
device:
|
|
1407
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1408
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1409
|
+
device: import_v37.z.string().optional()
|
|
1410
1410
|
},
|
|
1411
1411
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1412
1412
|
try {
|
|
@@ -1429,9 +1429,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1429
1429
|
"disable_access_rule",
|
|
1430
1430
|
"Disable an access rule selected by UUID without deleting it. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1431
1431
|
{
|
|
1432
|
-
rule_uuid:
|
|
1433
|
-
ip_version:
|
|
1434
|
-
device:
|
|
1432
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1433
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1434
|
+
device: import_v37.z.string().optional()
|
|
1435
1435
|
},
|
|
1436
1436
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1437
1437
|
try {
|
|
@@ -1453,7 +1453,7 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
|
|
1455
1455
|
// src/tools/nat-policies.ts
|
|
1456
|
-
var
|
|
1456
|
+
var import_v38 = require("zod/v3");
|
|
1457
1457
|
function interfaceValue(value) {
|
|
1458
1458
|
return value.toLowerCase() === "any" ? "any" : value;
|
|
1459
1459
|
}
|
|
@@ -1470,7 +1470,7 @@ async function resolveRef(client, kind, value, ipVersion, allowOriginal) {
|
|
|
1470
1470
|
throw e;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
var prioritySchema =
|
|
1473
|
+
var prioritySchema = import_v38.z.union([import_v38.z.number().int().min(1), import_v38.z.literal("auto")]).optional().describe("Rule order: lower number = evaluated first. A positive integer sets a manual priority; 'auto' lets SonicOS assign it.");
|
|
1474
1474
|
function priorityField(priority) {
|
|
1475
1475
|
return priority === "auto" ? { auto: true } : { manual: priority };
|
|
1476
1476
|
}
|
|
@@ -1479,8 +1479,8 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1479
1479
|
"list_nat_policies",
|
|
1480
1480
|
"List all NAT policies. ip_version: 'ipv4' (default) or 'ipv6'. Use each policy's uuid value as policy_uuid for get/update/enable/disable/delete tools.",
|
|
1481
1481
|
{
|
|
1482
|
-
ip_version:
|
|
1483
|
-
device:
|
|
1482
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1483
|
+
device: import_v38.z.string().optional()
|
|
1484
1484
|
},
|
|
1485
1485
|
async ({ ip_version, device }) => {
|
|
1486
1486
|
try {
|
|
@@ -1496,9 +1496,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1496
1496
|
"get_nat_policy",
|
|
1497
1497
|
"Retrieve a NAT policy by UUID. Pass a policy's uuid value from list_nat_policies as policy_uuid.",
|
|
1498
1498
|
{
|
|
1499
|
-
policy_uuid:
|
|
1500
|
-
ip_version:
|
|
1501
|
-
device:
|
|
1499
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1500
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1501
|
+
device: import_v38.z.string().optional()
|
|
1502
1502
|
},
|
|
1503
1503
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1504
1504
|
try {
|
|
@@ -1514,21 +1514,21 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1514
1514
|
"create_nat_policy",
|
|
1515
1515
|
"Create a NAT policy. Address and service fields take an object or group name (groups are detected automatically) or 'Any'; translated fields also accept 'Original' for no translation. Interfaces take a name like 'X1' or 'Any'. Optional priority sets rule order (lower number = evaluated first). Changes are STAGED; call commit_config to apply.",
|
|
1516
1516
|
{
|
|
1517
|
-
name:
|
|
1518
|
-
original_source:
|
|
1519
|
-
translated_source:
|
|
1520
|
-
original_destination:
|
|
1521
|
-
translated_destination:
|
|
1522
|
-
original_service:
|
|
1523
|
-
translated_service:
|
|
1524
|
-
inbound_interface:
|
|
1525
|
-
outbound_interface:
|
|
1526
|
-
ip_version:
|
|
1527
|
-
enabled:
|
|
1528
|
-
dns_doctoring:
|
|
1517
|
+
name: import_v38.z.string(),
|
|
1518
|
+
original_source: import_v38.z.string(),
|
|
1519
|
+
translated_source: import_v38.z.string(),
|
|
1520
|
+
original_destination: import_v38.z.string(),
|
|
1521
|
+
translated_destination: import_v38.z.string(),
|
|
1522
|
+
original_service: import_v38.z.string(),
|
|
1523
|
+
translated_service: import_v38.z.string(),
|
|
1524
|
+
inbound_interface: import_v38.z.string().optional().default("Any"),
|
|
1525
|
+
outbound_interface: import_v38.z.string().optional().default("Any"),
|
|
1526
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1527
|
+
enabled: import_v38.z.boolean().optional().default(true),
|
|
1528
|
+
dns_doctoring: import_v38.z.boolean().optional().default(false),
|
|
1529
1529
|
priority: prioritySchema,
|
|
1530
|
-
comment:
|
|
1531
|
-
device:
|
|
1530
|
+
comment: import_v38.z.string().optional(),
|
|
1531
|
+
device: import_v38.z.string().optional()
|
|
1532
1532
|
},
|
|
1533
1533
|
async ({ name, original_source, translated_source, original_destination, translated_destination, original_service, translated_service, inbound_interface, outbound_interface, ip_version, enabled, dns_doctoring, priority, comment, device }) => {
|
|
1534
1534
|
try {
|
|
@@ -1561,21 +1561,21 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1561
1561
|
"update_nat_policy",
|
|
1562
1562
|
"Update a NAT policy selected by UUID (GET-then-PUT). Pass a policy's uuid value from list_nat_policies as policy_uuid. dns_doctoring can be changed independently. priority changes rule order (lower number = evaluated first; 'auto' lets SonicOS assign it). Position 1 is held by the built-in IKE policy, so use 2 or higher; an unavailable priority can return success yet be ignored, so confirm with get_nat_policy. Changes are STAGED; call commit_config to apply.",
|
|
1563
1563
|
{
|
|
1564
|
-
policy_uuid:
|
|
1565
|
-
ip_version:
|
|
1566
|
-
original_source:
|
|
1567
|
-
translated_source:
|
|
1568
|
-
original_destination:
|
|
1569
|
-
translated_destination:
|
|
1570
|
-
original_service:
|
|
1571
|
-
translated_service:
|
|
1572
|
-
inbound_interface:
|
|
1573
|
-
outbound_interface:
|
|
1574
|
-
enabled:
|
|
1575
|
-
dns_doctoring:
|
|
1564
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1565
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1566
|
+
original_source: import_v38.z.string().optional(),
|
|
1567
|
+
translated_source: import_v38.z.string().optional(),
|
|
1568
|
+
original_destination: import_v38.z.string().optional(),
|
|
1569
|
+
translated_destination: import_v38.z.string().optional(),
|
|
1570
|
+
original_service: import_v38.z.string().optional(),
|
|
1571
|
+
translated_service: import_v38.z.string().optional(),
|
|
1572
|
+
inbound_interface: import_v38.z.string().optional(),
|
|
1573
|
+
outbound_interface: import_v38.z.string().optional(),
|
|
1574
|
+
enabled: import_v38.z.boolean().optional(),
|
|
1575
|
+
dns_doctoring: import_v38.z.boolean().optional(),
|
|
1576
1576
|
priority: prioritySchema,
|
|
1577
|
-
comment:
|
|
1578
|
-
device:
|
|
1577
|
+
comment: import_v38.z.string().optional(),
|
|
1578
|
+
device: import_v38.z.string().optional()
|
|
1579
1579
|
},
|
|
1580
1580
|
async ({ policy_uuid, ip_version, original_source, translated_source, original_destination, translated_destination, original_service, translated_service, inbound_interface, outbound_interface, enabled, dns_doctoring, priority, comment, device }) => {
|
|
1581
1581
|
try {
|
|
@@ -1609,9 +1609,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1609
1609
|
"delete_nat_policy",
|
|
1610
1610
|
"Delete a NAT policy by UUID. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1611
1611
|
{
|
|
1612
|
-
policy_uuid:
|
|
1613
|
-
ip_version:
|
|
1614
|
-
device:
|
|
1612
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1613
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1614
|
+
device: import_v38.z.string().optional()
|
|
1615
1615
|
},
|
|
1616
1616
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1617
1617
|
try {
|
|
@@ -1636,9 +1636,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1636
1636
|
"enable_nat_policy",
|
|
1637
1637
|
"Enable a NAT policy selected by UUID without modifying other fields. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1638
1638
|
{
|
|
1639
|
-
policy_uuid:
|
|
1640
|
-
ip_version:
|
|
1641
|
-
device:
|
|
1639
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1640
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1641
|
+
device: import_v38.z.string().optional()
|
|
1642
1642
|
},
|
|
1643
1643
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1644
1644
|
try {
|
|
@@ -1653,9 +1653,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1653
1653
|
"disable_nat_policy",
|
|
1654
1654
|
"Disable a NAT policy selected by UUID without deleting it. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1655
1655
|
{
|
|
1656
|
-
policy_uuid:
|
|
1657
|
-
ip_version:
|
|
1658
|
-
device:
|
|
1656
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1657
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1658
|
+
device: import_v38.z.string().optional()
|
|
1659
1659
|
},
|
|
1660
1660
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1661
1661
|
try {
|
|
@@ -1669,7 +1669,7 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1669
1669
|
}
|
|
1670
1670
|
|
|
1671
1671
|
// src/tools/security-policies.ts
|
|
1672
|
-
var
|
|
1672
|
+
var import_v39 = require("zod/v3");
|
|
1673
1673
|
function zoneName2(v) {
|
|
1674
1674
|
if (typeof v === "string") return v;
|
|
1675
1675
|
if (v && typeof v === "object") {
|
|
@@ -1686,10 +1686,10 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1686
1686
|
"list_security_policies",
|
|
1687
1687
|
"List security policies, optionally filtered by source and/or destination zone. Filtering is applied client-side (the SonicOS endpoint returns the full ruleset), so use from_zone/to_zone to keep responses small.",
|
|
1688
1688
|
{
|
|
1689
|
-
ip_version:
|
|
1690
|
-
from_zone:
|
|
1691
|
-
to_zone:
|
|
1692
|
-
device:
|
|
1689
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1690
|
+
from_zone: import_v39.z.string().optional(),
|
|
1691
|
+
to_zone: import_v39.z.string().optional(),
|
|
1692
|
+
device: import_v39.z.string().optional()
|
|
1693
1693
|
},
|
|
1694
1694
|
async ({ ip_version, from_zone, to_zone, device }) => {
|
|
1695
1695
|
try {
|
|
@@ -1717,9 +1717,9 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1717
1717
|
"get_security_policy",
|
|
1718
1718
|
"Retrieve a security policy by its numeric ID.",
|
|
1719
1719
|
{
|
|
1720
|
-
policy_id:
|
|
1721
|
-
ip_version:
|
|
1722
|
-
device:
|
|
1720
|
+
policy_id: import_v39.z.number(),
|
|
1721
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1722
|
+
device: import_v39.z.string().optional()
|
|
1723
1723
|
},
|
|
1724
1724
|
async ({ policy_id, ip_version, device }) => {
|
|
1725
1725
|
try {
|
|
@@ -1735,20 +1735,20 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1735
1735
|
"create_security_policy",
|
|
1736
1736
|
"Create a security policy. action: typically 'allow' or 'deny'. source_address/destination_address: address object or group name, or 'Any'. service: service object or group name, or 'Any'. Changes are STAGED; call commit_config to apply.",
|
|
1737
1737
|
{
|
|
1738
|
-
name:
|
|
1739
|
-
source_zone:
|
|
1740
|
-
destination_zone:
|
|
1741
|
-
source_address:
|
|
1742
|
-
destination_address:
|
|
1743
|
-
service:
|
|
1744
|
-
action:
|
|
1745
|
-
ip_version:
|
|
1746
|
-
users:
|
|
1747
|
-
schedule:
|
|
1748
|
-
enabled:
|
|
1749
|
-
log:
|
|
1750
|
-
comment:
|
|
1751
|
-
device:
|
|
1738
|
+
name: import_v39.z.string(),
|
|
1739
|
+
source_zone: import_v39.z.string(),
|
|
1740
|
+
destination_zone: import_v39.z.string(),
|
|
1741
|
+
source_address: import_v39.z.string(),
|
|
1742
|
+
destination_address: import_v39.z.string(),
|
|
1743
|
+
service: import_v39.z.string(),
|
|
1744
|
+
action: import_v39.z.string(),
|
|
1745
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1746
|
+
users: import_v39.z.array(import_v39.z.string()).optional(),
|
|
1747
|
+
schedule: import_v39.z.string().optional(),
|
|
1748
|
+
enabled: import_v39.z.boolean().optional().default(true),
|
|
1749
|
+
log: import_v39.z.boolean().optional().default(true),
|
|
1750
|
+
comment: import_v39.z.string().optional(),
|
|
1751
|
+
device: import_v39.z.string().optional()
|
|
1752
1752
|
},
|
|
1753
1753
|
async ({ name, source_zone, destination_zone, source_address, destination_address, service, action, ip_version, users, schedule, enabled, log, comment, device }) => {
|
|
1754
1754
|
try {
|
|
@@ -1780,16 +1780,16 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1780
1780
|
"update_security_policy",
|
|
1781
1781
|
"Update fields on an existing security policy (GET-then-PUT). Only provided fields are changed. Changes are STAGED; call commit_config to apply.",
|
|
1782
1782
|
{
|
|
1783
|
-
policy_id:
|
|
1784
|
-
ip_version:
|
|
1785
|
-
action:
|
|
1786
|
-
source_address:
|
|
1787
|
-
destination_address:
|
|
1788
|
-
service:
|
|
1789
|
-
enabled:
|
|
1790
|
-
log:
|
|
1791
|
-
comment:
|
|
1792
|
-
device:
|
|
1783
|
+
policy_id: import_v39.z.number(),
|
|
1784
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1785
|
+
action: import_v39.z.string().optional(),
|
|
1786
|
+
source_address: import_v39.z.string().optional(),
|
|
1787
|
+
destination_address: import_v39.z.string().optional(),
|
|
1788
|
+
service: import_v39.z.string().optional(),
|
|
1789
|
+
enabled: import_v39.z.boolean().optional(),
|
|
1790
|
+
log: import_v39.z.boolean().optional(),
|
|
1791
|
+
comment: import_v39.z.string().optional(),
|
|
1792
|
+
device: import_v39.z.string().optional()
|
|
1793
1793
|
},
|
|
1794
1794
|
async ({ policy_id, ip_version, action, source_address, destination_address, service, enabled, log, comment, device }) => {
|
|
1795
1795
|
try {
|
|
@@ -1823,9 +1823,9 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1823
1823
|
"delete_security_policy",
|
|
1824
1824
|
"Delete a security policy by ID. Changes are STAGED; call commit_config to apply.",
|
|
1825
1825
|
{
|
|
1826
|
-
policy_id:
|
|
1827
|
-
ip_version:
|
|
1828
|
-
device:
|
|
1826
|
+
policy_id: import_v39.z.number(),
|
|
1827
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1828
|
+
device: import_v39.z.string().optional()
|
|
1829
1829
|
},
|
|
1830
1830
|
async ({ policy_id, ip_version, device }) => {
|
|
1831
1831
|
try {
|
|
@@ -1840,7 +1840,7 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
1842
|
// src/tools/geo-ip.ts
|
|
1843
|
-
var
|
|
1843
|
+
var import_v310 = require("zod/v3");
|
|
1844
1844
|
function parseGeoLookup(ip, raw) {
|
|
1845
1845
|
const parsed = {
|
|
1846
1846
|
ip,
|
|
@@ -1885,7 +1885,7 @@ function registerGeoIpTools(server, registry) {
|
|
|
1885
1885
|
server.tool(
|
|
1886
1886
|
"lookup_ip_country",
|
|
1887
1887
|
"Look up the geographic location of an IP address using the appliance's built-in GeoIP database. Returns country, city, region, and botnet classification if available. Requires an active GeoIP subscription.",
|
|
1888
|
-
{ ip:
|
|
1888
|
+
{ ip: import_v310.z.string(), device: import_v310.z.string().optional() },
|
|
1889
1889
|
async ({ ip, device }) => {
|
|
1890
1890
|
try {
|
|
1891
1891
|
const client = await registry.getClient(device);
|
|
@@ -1900,7 +1900,7 @@ function registerGeoIpTools(server, registry) {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
|
|
1902
1902
|
// src/tools/logs.ts
|
|
1903
|
-
var
|
|
1903
|
+
var import_v311 = require("zod/v3");
|
|
1904
1904
|
async function getWithFallback(client, candidates) {
|
|
1905
1905
|
let lastError;
|
|
1906
1906
|
for (const path of candidates) {
|
|
@@ -1920,7 +1920,7 @@ function registerLogTools(server, registry) {
|
|
|
1920
1920
|
server.tool(
|
|
1921
1921
|
"get_log_categories",
|
|
1922
1922
|
"List SonicOS log category configuration. This describes available event categories; it does not return recorded runtime log entries.",
|
|
1923
|
-
{ device:
|
|
1923
|
+
{ device: import_v311.z.string().optional() },
|
|
1924
1924
|
async ({ device }) => {
|
|
1925
1925
|
try {
|
|
1926
1926
|
const client = await registry.getClient(device);
|
|
@@ -1934,7 +1934,7 @@ function registerLogTools(server, registry) {
|
|
|
1934
1934
|
server.tool(
|
|
1935
1935
|
"list_log_event_definitions",
|
|
1936
1936
|
"List SonicOS event-definition configuration (event names, categories, priorities, and alert/syslog settings). This is not the appliance event history and cannot be searched by IP, message, or timestamp.",
|
|
1937
|
-
{ device:
|
|
1937
|
+
{ device: import_v311.z.string().optional() },
|
|
1938
1938
|
async ({ device }) => {
|
|
1939
1939
|
try {
|
|
1940
1940
|
const client = await registry.getClient(device);
|
|
@@ -1948,12 +1948,12 @@ function registerLogTools(server, registry) {
|
|
|
1948
1948
|
}
|
|
1949
1949
|
|
|
1950
1950
|
// src/tools/zones.ts
|
|
1951
|
-
var
|
|
1951
|
+
var import_v312 = require("zod/v3");
|
|
1952
1952
|
function registerZoneTools(server, registry) {
|
|
1953
1953
|
server.tool(
|
|
1954
1954
|
"list_zones",
|
|
1955
1955
|
"List all security zones (LAN, WAN, DMZ, etc.) with their security type and interface membership. Use this to discover valid zone names before creating access rules or security policies.",
|
|
1956
|
-
{ device:
|
|
1956
|
+
{ device: import_v312.z.string().optional() },
|
|
1957
1957
|
async ({ device }) => {
|
|
1958
1958
|
try {
|
|
1959
1959
|
const client = await registry.getClient(device);
|
|
@@ -1967,7 +1967,7 @@ function registerZoneTools(server, registry) {
|
|
|
1967
1967
|
server.tool(
|
|
1968
1968
|
"get_zone",
|
|
1969
1969
|
"Retrieve a single security zone by name.",
|
|
1970
|
-
{ name:
|
|
1970
|
+
{ name: import_v312.z.string(), device: import_v312.z.string().optional() },
|
|
1971
1971
|
async ({ name, device }) => {
|
|
1972
1972
|
try {
|
|
1973
1973
|
const client = await registry.getClient(device);
|
|
@@ -1981,7 +1981,7 @@ function registerZoneTools(server, registry) {
|
|
|
1981
1981
|
}
|
|
1982
1982
|
|
|
1983
1983
|
// src/tools/interfaces.ts
|
|
1984
|
-
var
|
|
1984
|
+
var import_v313 = require("zod/v3");
|
|
1985
1985
|
var SECRET_FIELD = /(?:password|passwd|secret|private_key|pre_shared_key|community)$/i;
|
|
1986
1986
|
function redactSecrets(value) {
|
|
1987
1987
|
if (Array.isArray(value)) return value.map(redactSecrets);
|
|
@@ -1997,7 +1997,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
1997
1997
|
server.tool(
|
|
1998
1998
|
"list_interfaces",
|
|
1999
1999
|
"List IPv4 network interfaces with their IP assignment, zone, and mode (static/DHCP). Use this to discover the appliance's addressing and which interfaces belong to which zone.",
|
|
2000
|
-
{ device:
|
|
2000
|
+
{ device: import_v313.z.string().optional() },
|
|
2001
2001
|
async ({ device }) => {
|
|
2002
2002
|
try {
|
|
2003
2003
|
const client = await registry.getClient(device);
|
|
@@ -2011,7 +2011,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
2011
2011
|
server.tool(
|
|
2012
2012
|
"get_interface",
|
|
2013
2013
|
'Retrieve a single IPv4 interface by name (e.g. "X0").',
|
|
2014
|
-
{ name:
|
|
2014
|
+
{ name: import_v313.z.string(), device: import_v313.z.string().optional() },
|
|
2015
2015
|
async ({ name, device }) => {
|
|
2016
2016
|
try {
|
|
2017
2017
|
const client = await registry.getClient(device);
|
|
@@ -2025,12 +2025,12 @@ function registerInterfaceTools(server, registry) {
|
|
|
2025
2025
|
}
|
|
2026
2026
|
|
|
2027
2027
|
// src/tools/schedules.ts
|
|
2028
|
-
var
|
|
2028
|
+
var import_v314 = require("zod/v3");
|
|
2029
2029
|
function registerScheduleTools(server, registry) {
|
|
2030
2030
|
server.tool(
|
|
2031
2031
|
"list_schedules",
|
|
2032
2032
|
'List schedule objects (recurring time windows like "Work Hours"). Security policies reference schedules by name to restrict when a rule is active \u2014 use this to discover valid schedule names.',
|
|
2033
|
-
{ device:
|
|
2033
|
+
{ device: import_v314.z.string().optional() },
|
|
2034
2034
|
async ({ device }) => {
|
|
2035
2035
|
try {
|
|
2036
2036
|
const client = await registry.getClient(device);
|
|
@@ -2044,7 +2044,7 @@ function registerScheduleTools(server, registry) {
|
|
|
2044
2044
|
server.tool(
|
|
2045
2045
|
"get_schedule",
|
|
2046
2046
|
"Retrieve a single schedule object by name.",
|
|
2047
|
-
{ name:
|
|
2047
|
+
{ name: import_v314.z.string(), device: import_v314.z.string().optional() },
|
|
2048
2048
|
async ({ name, device }) => {
|
|
2049
2049
|
try {
|
|
2050
2050
|
const client = await registry.getClient(device);
|
|
@@ -2058,14 +2058,14 @@ function registerScheduleTools(server, registry) {
|
|
|
2058
2058
|
}
|
|
2059
2059
|
|
|
2060
2060
|
// src/tools/route-policies.ts
|
|
2061
|
-
var
|
|
2061
|
+
var import_v315 = require("zod/v3");
|
|
2062
2062
|
function registerRoutePolicyTools(server, registry) {
|
|
2063
2063
|
server.tool(
|
|
2064
2064
|
"list_route_policies",
|
|
2065
2065
|
"List static/policy-based routes with their destination, gateway, interface, and metric. Useful for understanding how traffic is routed off the appliance.",
|
|
2066
2066
|
{
|
|
2067
|
-
ip_version:
|
|
2068
|
-
device:
|
|
2067
|
+
ip_version: import_v315.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
2068
|
+
device: import_v315.z.string().optional()
|
|
2069
2069
|
},
|
|
2070
2070
|
async ({ ip_version, device }) => {
|
|
2071
2071
|
try {
|
|
@@ -2080,7 +2080,7 @@ function registerRoutePolicyTools(server, registry) {
|
|
|
2080
2080
|
}
|
|
2081
2081
|
|
|
2082
2082
|
// src/tools/diagnostics.ts
|
|
2083
|
-
var
|
|
2083
|
+
var import_v316 = require("zod/v3");
|
|
2084
2084
|
function text(value) {
|
|
2085
2085
|
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
2086
2086
|
}
|
|
@@ -2121,10 +2121,10 @@ function matchingEntries(value, ip) {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
function registerDiagnosticTools(server, registry) {
|
|
2123
2123
|
const targetSchema = {
|
|
2124
|
-
host:
|
|
2125
|
-
interface:
|
|
2126
|
-
prefer_ipv6:
|
|
2127
|
-
device:
|
|
2124
|
+
host: import_v316.z.string().min(1).describe("Destination IP address or hostname"),
|
|
2125
|
+
interface: import_v316.z.string().min(1).optional().describe("Source interface, such as X1; omit to let SonicOS choose"),
|
|
2126
|
+
prefer_ipv6: import_v316.z.boolean().optional().default(false),
|
|
2127
|
+
device: import_v316.z.string().optional()
|
|
2128
2128
|
};
|
|
2129
2129
|
server.tool(
|
|
2130
2130
|
"ping_from_appliance",
|
|
@@ -2155,7 +2155,7 @@ function registerDiagnosticTools(server, registry) {
|
|
|
2155
2155
|
server.tool(
|
|
2156
2156
|
"find_network_path",
|
|
2157
2157
|
"Ask the appliance to resolve the network path for a destination, including the route/interface selected by SonicOS.",
|
|
2158
|
-
{ host:
|
|
2158
|
+
{ host: import_v316.z.string().min(1), device: import_v316.z.string().optional() },
|
|
2159
2159
|
async ({ host, device }) => {
|
|
2160
2160
|
try {
|
|
2161
2161
|
const client = await registry.getClient(device);
|
|
@@ -2168,7 +2168,7 @@ function registerDiagnosticTools(server, registry) {
|
|
|
2168
2168
|
server.tool(
|
|
2169
2169
|
"lookup_arp",
|
|
2170
2170
|
"Read the appliance ARP cache. When ip is supplied, return only entries exactly matching that address.",
|
|
2171
|
-
{ ip:
|
|
2171
|
+
{ ip: import_v316.z.string().min(1).optional(), device: import_v316.z.string().optional() },
|
|
2172
2172
|
async ({ ip, device }) => {
|
|
2173
2173
|
try {
|
|
2174
2174
|
const client = await registry.getClient(device);
|
|
@@ -2183,10 +2183,10 @@ function registerDiagnosticTools(server, registry) {
|
|
|
2183
2183
|
"diagnose_ip",
|
|
2184
2184
|
"Run a combined, read-only diagnosis for an IP from the appliance: collect network-path selection, interface configuration, route policies, matching ARP state, ping, and optionally traceroute. Individual failures are reported without aborting the remaining checks.",
|
|
2185
2185
|
{
|
|
2186
|
-
ip:
|
|
2187
|
-
interface:
|
|
2188
|
-
include_traceroute:
|
|
2189
|
-
device:
|
|
2186
|
+
ip: import_v316.z.string().ip(),
|
|
2187
|
+
interface: import_v316.z.string().min(1).optional(),
|
|
2188
|
+
include_traceroute: import_v316.z.boolean().optional().default(true),
|
|
2189
|
+
device: import_v316.z.string().optional()
|
|
2190
2190
|
},
|
|
2191
2191
|
async ({ ip, interface: iface, include_traceroute, device }) => {
|
|
2192
2192
|
try {
|
|
@@ -2302,7 +2302,7 @@ var packageName = packageJson.name ?? "sonicwall-api-mcp-server";
|
|
|
2302
2302
|
var packageVersion = packageJson.version ?? "0.0.0";
|
|
2303
2303
|
|
|
2304
2304
|
// src/strict-tools.ts
|
|
2305
|
-
var
|
|
2305
|
+
var import_v317 = require("zod/v3");
|
|
2306
2306
|
function isSchema(value) {
|
|
2307
2307
|
return typeof value === "object" && value !== null && "_def" in value;
|
|
2308
2308
|
}
|
|
@@ -2312,8 +2312,8 @@ function isRawShape(value) {
|
|
|
2312
2312
|
return values.length === 0 || values.some(isSchema);
|
|
2313
2313
|
}
|
|
2314
2314
|
function strictSchema(schema) {
|
|
2315
|
-
if (schema === void 0) return
|
|
2316
|
-
if (isRawShape(schema)) return
|
|
2315
|
+
if (schema === void 0) return import_v317.z.object({}).strict();
|
|
2316
|
+
if (isRawShape(schema)) return import_v317.z.object(schema).strict();
|
|
2317
2317
|
if (isSchema(schema) && typeof schema.strict === "function") return schema.strict();
|
|
2318
2318
|
return schema;
|
|
2319
2319
|
}
|
package/dist/strict-tools.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(strict_tools_exports, {
|
|
|
24
24
|
enforceStrictToolInputs: () => enforceStrictToolInputs
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(strict_tools_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_v3 = require("zod/v3");
|
|
28
28
|
function isSchema(value) {
|
|
29
29
|
return typeof value === "object" && value !== null && "_def" in value;
|
|
30
30
|
}
|
|
@@ -34,8 +34,8 @@ function isRawShape(value) {
|
|
|
34
34
|
return values.length === 0 || values.some(isSchema);
|
|
35
35
|
}
|
|
36
36
|
function strictSchema(schema) {
|
|
37
|
-
if (schema === void 0) return
|
|
38
|
-
if (isRawShape(schema)) return
|
|
37
|
+
if (schema === void 0) return import_v3.z.object({}).strict();
|
|
38
|
+
if (isRawShape(schema)) return import_v3.z.object(schema).strict();
|
|
39
39
|
if (isSchema(schema) && typeof schema.strict === "function") return schema.strict();
|
|
40
40
|
return schema;
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@teamnetwork-nz/sonicwall-api-mcp-server",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"description": "MCP server for SonicWall appliance configuration and diagnostics
|
|
5
|
-
"keywords": [
|
|
6
|
-
"mcp",
|
|
7
|
-
"model-context-protocol",
|
|
8
|
-
"sonicwall",
|
|
9
|
-
"firewall",
|
|
10
|
-
"sonicOS",
|
|
11
|
-
"api",
|
|
12
|
-
"network",
|
|
13
|
-
"security"
|
|
14
|
-
],
|
|
15
|
-
"homepage": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server",
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server/issues"
|
|
18
|
-
},
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"author": "Daryl",
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server.git"
|
|
24
|
-
},
|
|
25
|
-
"main": "dist/index.js",
|
|
26
|
-
"bin": {
|
|
27
|
-
"sonicwall-mcp": "./dist/index.js"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist/",
|
|
31
|
-
"README.md",
|
|
32
|
-
"LICENSE"
|
|
33
|
-
],
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "tsup",
|
|
36
|
-
"test": "npm run build && node --test tests/*.test.mjs",
|
|
37
|
-
"prepublishOnly": "npm run build",
|
|
38
|
-
"start": "node dist/index.js"
|
|
39
|
-
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=18"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
45
|
-
"zod": "^
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/node": "^20.0.0",
|
|
49
|
-
"tsup": "^8.0.0",
|
|
50
|
-
"typescript": "^5.4.0"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@teamnetwork-nz/sonicwall-api-mcp-server",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "MCP server for SonicWall appliance configuration and diagnostics \u2014 objects, rules, NAT, routing, reachability, and GeoIP lookup",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"sonicwall",
|
|
9
|
+
"firewall",
|
|
10
|
+
"sonicOS",
|
|
11
|
+
"api",
|
|
12
|
+
"network",
|
|
13
|
+
"security"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Daryl",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/teamnetwork-nz/sonicwall-api-mcp-server.git"
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"bin": {
|
|
27
|
+
"sonicwall-mcp": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsup",
|
|
36
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
38
|
+
"start": "node dist/index.js"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
45
|
+
"zod": "^4.6.7"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.0.0",
|
|
49
|
+
"tsup": "^8.0.0",
|
|
50
|
+
"typescript": "^5.4.0"
|
|
51
|
+
}
|
|
52
|
+
}
|