@teamnetwork-nz/sonicwall-api-mcp-server 0.4.1 → 0.5.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 (3) hide show
  1. package/README.md +5 -2
  2. package/dist/index.js +173 -213
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,15 +4,18 @@ A [Model Context Protocol](https://modelcontextprotocol.io/) server that provide
4
4
 
5
5
  ## Features
6
6
 
7
- - **Log analysis** — retrieve, filter, and search event logs, traffic logs, and threat/IPS events
7
+ - **Log analysis** — retrieve, filter, and search event logs and threat/IPS events
8
8
  - **Address objects & groups** — CRUD for IPv4, IPv6, FQDN, and MAC address objects and their groups
9
9
  - **Service objects & groups** — CRUD for protocol/port service definitions
10
10
  - **Access rules** — create, update, enable/disable, and delete firewall access rules (IPv4 & IPv6)
11
11
  - **NAT policies** — full CRUD for inbound/outbound NAT rules
12
12
  - **Security policies** — CRUD for zone-based security policies
13
- - **GeoIP filtering** — manage GeoIP country-block policies and assign them to access rules
13
+ - **Network discovery** — list zones, interfaces, schedules, and route policies (read-only)
14
+ - **GeoIP lookup** — identify the country/botnet classification of an IP address
14
15
  - **Config management** — view and commit (or discard) staged changes
15
16
 
17
+ > The SonicOS REST API is configuration-focused. Connection/flow ("traffic") logs and GeoIP *policy* objects are not exposed as REST endpoints and therefore have no tools.
18
+
16
19
  Supports SonicOS 6.5.x, 7.x, and 8.x with automatic version detection.
17
20
 
18
21
  ## Quick Start
package/dist/index.js CHANGED
@@ -338,6 +338,23 @@ var SonicWallClient = class {
338
338
  [`https://${host}:${port}/api/sonicos/v8`, 8],
339
339
  [`https://${host}:${port}/api/sonicos`, 7]
340
340
  ];
341
+ for (const [base, version] of candidates) {
342
+ try {
343
+ const resp = await fetch(`${base}/auth`, {
344
+ method: "POST",
345
+ headers: { "Accept": "application/json", "Content-Type": "application/json" },
346
+ body: "{}",
347
+ signal: AbortSignal.timeout(this.profile.requestTimeout * 1e3)
348
+ });
349
+ if (resp.status < 400 || resp.headers.get("WWW-Authenticate")) {
350
+ this.baseUrl = base;
351
+ this.version = version;
352
+ return;
353
+ }
354
+ } catch {
355
+ continue;
356
+ }
357
+ }
341
358
  for (const [base, version] of candidates) {
342
359
  try {
343
360
  const resp = await fetch(`${base}/system/status`, {
@@ -353,10 +370,8 @@ var SonicWallClient = class {
353
370
  continue;
354
371
  }
355
372
  }
356
- if (!this.baseUrl) {
357
- this.baseUrl = `https://${host}:${port}/api/sonicos`;
358
- this.version = 7;
359
- }
373
+ this.baseUrl = `https://${host}:${port}/api/sonicos`;
374
+ this.version = 7;
360
375
  }
361
376
  async close() {
362
377
  await this.auth.logout(this.baseUrl);
@@ -519,7 +534,7 @@ function registerSystemTools(server, registry) {
519
534
  async ({ device }) => {
520
535
  try {
521
536
  const client = await registry.getClient(device);
522
- const result = await client.get("system/status");
537
+ const result = await client.get("version");
523
538
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
524
539
  } catch (e) {
525
540
  return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
@@ -1692,159 +1707,6 @@ function parseGeoLookup(ip, raw) {
1692
1707
  return parsed;
1693
1708
  }
1694
1709
  function registerGeoIpTools(server, registry) {
1695
- server.tool(
1696
- "list_geo_ip_policies",
1697
- "List all GeoIP filtering policies configured on the appliance.",
1698
- { device: import_zod9.z.string().optional() },
1699
- async ({ device }) => {
1700
- try {
1701
- const client = await registry.getClient(device);
1702
- const result = await client.get("geo-ip/policies");
1703
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1704
- } catch (e) {
1705
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1706
- }
1707
- }
1708
- );
1709
- server.tool(
1710
- "get_geo_ip_policy",
1711
- "Retrieve a GeoIP policy by name.",
1712
- { name: import_zod9.z.string(), device: import_zod9.z.string().optional() },
1713
- async ({ name, device }) => {
1714
- try {
1715
- const client = await registry.getClient(device);
1716
- const result = await client.get(`geo-ip/policies/name/${name}`);
1717
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1718
- } catch (e) {
1719
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1720
- }
1721
- }
1722
- );
1723
- server.tool(
1724
- "create_geo_ip_policy",
1725
- "Create a GeoIP filtering policy. block_countries/allow_countries: lists of ISO 3166-1 alpha-2 country codes (e.g. ['CN', 'RU', 'KP']). Changes are STAGED; call commit_config to apply.",
1726
- {
1727
- name: import_zod9.z.string(),
1728
- block_countries: import_zod9.z.array(import_zod9.z.string()).optional(),
1729
- allow_countries: import_zod9.z.array(import_zod9.z.string()).optional(),
1730
- log: import_zod9.z.boolean().optional().default(true),
1731
- device: import_zod9.z.string().optional()
1732
- },
1733
- async ({ name, block_countries, allow_countries, log, device }) => {
1734
- try {
1735
- const client = await registry.getClient(device);
1736
- const policy = { name, log };
1737
- if (block_countries && block_countries.length > 0) {
1738
- policy.block_countries = block_countries.map((c) => ({ country: c.toUpperCase() }));
1739
- }
1740
- if (allow_countries && allow_countries.length > 0) {
1741
- policy.allow_countries = allow_countries.map((c) => ({ country: c.toUpperCase() }));
1742
- }
1743
- const result = await client.post("geo-ip/policies", { geo_ip_policies: [policy] });
1744
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1745
- } catch (e) {
1746
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1747
- }
1748
- }
1749
- );
1750
- server.tool(
1751
- "update_geo_ip_policy",
1752
- "Update a GeoIP policy (GET-then-PUT). Only supplied fields are changed. Providing an empty list clears that list. Changes are STAGED; call commit_config to apply.",
1753
- {
1754
- name: import_zod9.z.string(),
1755
- block_countries: import_zod9.z.array(import_zod9.z.string()).optional(),
1756
- allow_countries: import_zod9.z.array(import_zod9.z.string()).optional(),
1757
- log: import_zod9.z.boolean().optional(),
1758
- device: import_zod9.z.string().optional()
1759
- },
1760
- async ({ name, block_countries, allow_countries, log, device }) => {
1761
- try {
1762
- const client = await registry.getClient(device);
1763
- const current = await client.get(`geo-ip/policies/name/${name}`);
1764
- const policies = current.geo_ip_policies;
1765
- const policy = policies?.[0] ?? {};
1766
- if (block_countries !== void 0) {
1767
- policy.block_countries = block_countries.map((c) => ({ country: c.toUpperCase() }));
1768
- }
1769
- if (allow_countries !== void 0) {
1770
- policy.allow_countries = allow_countries.map((c) => ({ country: c.toUpperCase() }));
1771
- }
1772
- if (log !== void 0) policy.log = log;
1773
- const result = await client.put(`geo-ip/policies/name/${name}`, { geo_ip_policies: [policy] });
1774
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1775
- } catch (e) {
1776
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1777
- }
1778
- }
1779
- );
1780
- server.tool(
1781
- "delete_geo_ip_policy",
1782
- "Delete a GeoIP policy by name. Changes are STAGED; call commit_config to apply.",
1783
- { name: import_zod9.z.string(), device: import_zod9.z.string().optional() },
1784
- async ({ name, device }) => {
1785
- try {
1786
- const client = await registry.getClient(device);
1787
- const result = await client.delete(`geo-ip/policies/name/${name}`);
1788
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1789
- } catch (e) {
1790
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1791
- }
1792
- }
1793
- );
1794
- server.tool(
1795
- "list_geo_ip_countries",
1796
- "Return all country codes and names available for GeoIP filtering.",
1797
- { device: import_zod9.z.string().optional() },
1798
- async ({ device }) => {
1799
- try {
1800
- const client = await registry.getClient(device);
1801
- const result = await client.get("geo-ip/countries");
1802
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1803
- } catch (e) {
1804
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1805
- }
1806
- }
1807
- );
1808
- server.tool(
1809
- "get_geo_ip_stats",
1810
- "Return GeoIP statistics \u2014 connection counts blocked/allowed by country.",
1811
- { device: import_zod9.z.string().optional() },
1812
- async ({ device }) => {
1813
- try {
1814
- const client = await registry.getClient(device);
1815
- const result = await client.get("geo-ip/statistics");
1816
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1817
- } catch (e) {
1818
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1819
- }
1820
- }
1821
- );
1822
- server.tool(
1823
- "assign_geo_ip_to_rule",
1824
- "Attach a GeoIP policy to an existing access rule without changing any other rule fields. Changes are STAGED; call commit_config to apply.",
1825
- {
1826
- rule_id: import_zod9.z.number(),
1827
- geo_ip_policy_name: import_zod9.z.string(),
1828
- ip_version: import_zod9.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
1829
- device: import_zod9.z.string().optional()
1830
- },
1831
- async ({ rule_id, geo_ip_policy_name, ip_version, device }) => {
1832
- try {
1833
- const client = await registry.getClient(device);
1834
- const current = await client.get(`access-rules/${ip_version}/${rule_id}`);
1835
- const rules = current.access_rules;
1836
- const rule = rules?.[0]?.[ip_version] ?? {};
1837
- if (!rule.security_profile) rule.security_profile = {};
1838
- rule.security_profile.geo_ip_policy = { name: geo_ip_policy_name };
1839
- const result = await client.put(`access-rules/${ip_version}/${rule_id}`, {
1840
- access_rules: [{ [ip_version]: rule }]
1841
- });
1842
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1843
- } catch (e) {
1844
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1845
- }
1846
- }
1847
- );
1848
1710
  server.tool(
1849
1711
  "lookup_ip_country",
1850
1712
  "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.",
@@ -1864,23 +1726,22 @@ function registerGeoIpTools(server, registry) {
1864
1726
 
1865
1727
  // src/tools/logs.ts
1866
1728
  var import_zod10 = require("zod");
1867
- function logPath(version, subpath) {
1868
- return version >= 8 ? `log/${subpath}` : `reporting/${subpath}`;
1869
- }
1870
- async function getLogsWithFallback(client, subpathV7, subpathV8, params) {
1871
- const isPrimary = client.version >= 8;
1872
- const primary = logPath(client.version, isPrimary ? subpathV8 : subpathV7);
1873
- const fallbackVersion = isPrimary ? 7 : 8;
1874
- const fallback = logPath(fallbackVersion, isPrimary ? subpathV7 : subpathV8);
1875
- try {
1876
- return await client.get(primary, params);
1877
- } catch (e) {
1878
- if (e instanceof APIError && e.status === 404) {
1879
- return await client.get(fallback, params);
1729
+ async function getLogsWithFallback(client, candidates, params) {
1730
+ let lastErr;
1731
+ for (const path of candidates) {
1732
+ try {
1733
+ return await client.get(path, params);
1734
+ } catch (e) {
1735
+ if (e instanceof APIError && (e.status === 404 || e.status === 400)) {
1736
+ lastErr = e;
1737
+ continue;
1738
+ }
1739
+ throw e;
1880
1740
  }
1881
- throw e;
1882
1741
  }
1742
+ throw lastErr;
1883
1743
  }
1744
+ var EVENT_LOG_PATHS = ["log/events", "reporting/log/events"];
1884
1745
  function registerLogTools(server, registry) {
1885
1746
  server.tool(
1886
1747
  "get_log_categories",
@@ -1889,12 +1750,15 @@ function registerLogTools(server, registry) {
1889
1750
  async ({ device }) => {
1890
1751
  try {
1891
1752
  const client = await registry.getClient(device);
1892
- const path = client.version >= 8 ? "log/categories" : "reporting/log/categories";
1893
1753
  try {
1894
- const result = await client.get(path);
1754
+ const result = await getLogsWithFallback(
1755
+ client,
1756
+ ["log/categories", "reporting/log/categories"],
1757
+ {}
1758
+ );
1895
1759
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1896
1760
  } catch (e) {
1897
- if (e instanceof APIError && e.status === 404) {
1761
+ if (e instanceof APIError && (e.status === 404 || e.status === 400)) {
1898
1762
  const fallback = {
1899
1763
  categories: [
1900
1764
  "network access",
@@ -1944,39 +1808,7 @@ function registerLogTools(server, registry) {
1944
1808
  if (end_time) params.end_time = end_time;
1945
1809
  if (source_ip) params.src_ip = source_ip;
1946
1810
  if (keyword) params.keyword = keyword;
1947
- const result = await getLogsWithFallback(client, "log", "events", params);
1948
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1949
- } catch (e) {
1950
- return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1951
- }
1952
- }
1953
- );
1954
- server.tool(
1955
- "get_traffic_logs",
1956
- "Retrieve traffic/connection logs. count: max entries. source_ip/destination_ip: filter by IP. destination_port: TCP/UDP port. protocol: e.g. 'TCP', 'UDP', 'ICMP'. action: 'allow' or 'deny'.",
1957
- {
1958
- count: import_zod10.z.number().optional().default(100),
1959
- source_ip: import_zod10.z.string().optional(),
1960
- destination_ip: import_zod10.z.string().optional(),
1961
- destination_port: import_zod10.z.number().optional(),
1962
- protocol: import_zod10.z.string().optional(),
1963
- action: import_zod10.z.enum(["allow", "deny"]).optional(),
1964
- start_time: import_zod10.z.string().optional(),
1965
- end_time: import_zod10.z.string().optional(),
1966
- device: import_zod10.z.string().optional()
1967
- },
1968
- async ({ count, source_ip, destination_ip, destination_port, protocol, action, start_time, end_time, device }) => {
1969
- try {
1970
- const client = await registry.getClient(device);
1971
- const params = { count };
1972
- if (source_ip) params.src_ip = source_ip;
1973
- if (destination_ip) params.dst_ip = destination_ip;
1974
- if (destination_port !== void 0) params.dst_port = destination_port;
1975
- if (protocol) params.protocol = protocol;
1976
- if (action) params.action = action;
1977
- if (start_time) params.start_time = start_time;
1978
- if (end_time) params.end_time = end_time;
1979
- const result = await getLogsWithFallback(client, "appflow/connections", "traffic", params);
1811
+ const result = await getLogsWithFallback(client, EVENT_LOG_PATHS, params);
1980
1812
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1981
1813
  } catch (e) {
1982
1814
  return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
@@ -1999,7 +1831,7 @@ function registerLogTools(server, registry) {
1999
1831
  const params = { count, keyword: query };
2000
1832
  if (start_time) params.start_time = start_time;
2001
1833
  if (end_time) params.end_time = end_time;
2002
- const result = await getLogsWithFallback(client, "log", "events", params);
1834
+ const result = await getLogsWithFallback(client, EVENT_LOG_PATHS, params);
2003
1835
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2004
1836
  } catch (e) {
2005
1837
  return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
@@ -2023,7 +1855,128 @@ function registerLogTools(server, registry) {
2023
1855
  if (severity) params.severity = severity;
2024
1856
  if (start_time) params.start_time = start_time;
2025
1857
  if (end_time) params.end_time = end_time;
2026
- const result = await getLogsWithFallback(client, "log", "events", params);
1858
+ const result = await getLogsWithFallback(client, EVENT_LOG_PATHS, params);
1859
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1860
+ } catch (e) {
1861
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1862
+ }
1863
+ }
1864
+ );
1865
+ }
1866
+
1867
+ // src/tools/zones.ts
1868
+ var import_zod11 = require("zod");
1869
+ function registerZoneTools(server, registry) {
1870
+ server.tool(
1871
+ "list_zones",
1872
+ "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.",
1873
+ { device: import_zod11.z.string().optional() },
1874
+ async ({ device }) => {
1875
+ try {
1876
+ const client = await registry.getClient(device);
1877
+ const result = await client.get("zones");
1878
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1879
+ } catch (e) {
1880
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1881
+ }
1882
+ }
1883
+ );
1884
+ server.tool(
1885
+ "get_zone",
1886
+ "Retrieve a single security zone by name.",
1887
+ { name: import_zod11.z.string(), device: import_zod11.z.string().optional() },
1888
+ async ({ name, device }) => {
1889
+ try {
1890
+ const client = await registry.getClient(device);
1891
+ const result = await client.get(`zones/name/${encodeURIComponent(name)}`);
1892
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1893
+ } catch (e) {
1894
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1895
+ }
1896
+ }
1897
+ );
1898
+ }
1899
+
1900
+ // src/tools/interfaces.ts
1901
+ var import_zod12 = require("zod");
1902
+ function registerInterfaceTools(server, registry) {
1903
+ server.tool(
1904
+ "list_interfaces",
1905
+ "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.",
1906
+ { device: import_zod12.z.string().optional() },
1907
+ async ({ device }) => {
1908
+ try {
1909
+ const client = await registry.getClient(device);
1910
+ const result = await client.get("interfaces/ipv4");
1911
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1912
+ } catch (e) {
1913
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1914
+ }
1915
+ }
1916
+ );
1917
+ server.tool(
1918
+ "get_interface",
1919
+ 'Retrieve a single IPv4 interface by name (e.g. "X0").',
1920
+ { name: import_zod12.z.string(), device: import_zod12.z.string().optional() },
1921
+ async ({ name, device }) => {
1922
+ try {
1923
+ const client = await registry.getClient(device);
1924
+ const result = await client.get(`interfaces/ipv4/name/${encodeURIComponent(name)}`);
1925
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1926
+ } catch (e) {
1927
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1928
+ }
1929
+ }
1930
+ );
1931
+ }
1932
+
1933
+ // src/tools/schedules.ts
1934
+ var import_zod13 = require("zod");
1935
+ function registerScheduleTools(server, registry) {
1936
+ server.tool(
1937
+ "list_schedules",
1938
+ '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.',
1939
+ { device: import_zod13.z.string().optional() },
1940
+ async ({ device }) => {
1941
+ try {
1942
+ const client = await registry.getClient(device);
1943
+ const result = await client.get("schedules");
1944
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1945
+ } catch (e) {
1946
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1947
+ }
1948
+ }
1949
+ );
1950
+ server.tool(
1951
+ "get_schedule",
1952
+ "Retrieve a single schedule object by name.",
1953
+ { name: import_zod13.z.string(), device: import_zod13.z.string().optional() },
1954
+ async ({ name, device }) => {
1955
+ try {
1956
+ const client = await registry.getClient(device);
1957
+ const result = await client.get(`schedules/name/${encodeURIComponent(name)}`);
1958
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1959
+ } catch (e) {
1960
+ return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
1961
+ }
1962
+ }
1963
+ );
1964
+ }
1965
+
1966
+ // src/tools/route-policies.ts
1967
+ var import_zod14 = require("zod");
1968
+ function registerRoutePolicyTools(server, registry) {
1969
+ server.tool(
1970
+ "list_route_policies",
1971
+ "List static/policy-based routes with their destination, gateway, interface, and metric. Useful for understanding how traffic is routed off the appliance.",
1972
+ {
1973
+ ip_version: import_zod14.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
1974
+ device: import_zod14.z.string().optional()
1975
+ },
1976
+ async ({ ip_version, device }) => {
1977
+ try {
1978
+ const client = await registry.getClient(device);
1979
+ const result = await client.get(`route-policies/${ip_version}`);
2027
1980
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2028
1981
  } catch (e) {
2029
1982
  return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
@@ -2051,7 +2004,7 @@ async function main() {
2051
2004
  const registry = new DeviceRegistry(config.profiles);
2052
2005
  const server = new import_mcp.McpServer({
2053
2006
  name: "sonicwall-mcp-server",
2054
- version: "0.4.1",
2007
+ version: "0.5.0",
2055
2008
  instructions: `SonicWall NSA MCP server \u2014 full read/write access to SonicWall firewalls via the SonicOS REST API.
2056
2009
 
2057
2010
  ## Device targeting
@@ -2066,7 +2019,6 @@ All timestamp parameters (start_time, end_time in log tools) are in the applianc
2066
2019
  ## Log querying
2067
2020
  - Call get_log_categories first to discover valid category names for get_event_logs.
2068
2021
  - get_event_logs: general system/security events. Filter by category, priority, source_ip, or keyword.
2069
- - get_traffic_logs: connection/flow logs. Filter by source_ip, destination_ip, port, protocol, or action.
2070
2022
  - get_threat_logs: IPS and AV detections. Filter by severity.
2071
2023
  - search_logs: full-text keyword search across event logs \u2014 use when you have a specific IP, hostname, or error string.
2072
2024
  - Default count is 100. Increase for broader searches, but keep it reasonable to avoid large payloads.
@@ -2077,7 +2029,11 @@ All timestamp parameters (start_time, end_time in log tools) are in the applianc
2077
2029
  - Typical workflow for a new firewall rule: list_address_objects \u2192 create_address_object_ipv4/fqdn/etc if needed \u2192 list_service_objects \u2192 create_service_object if needed \u2192 create_access_rule \u2192 commit_config.
2078
2030
  - Access rules (create_access_rule / list_access_rules) control traffic flow between zones with allow/deny/discard actions. Security policies (create_security_policy / list_security_policies) are zone-based and additionally support user and schedule filtering \u2014 use them when you need user-aware or time-restricted policies.
2079
2031
  - Always call list_access_rules, list_nat_policies, or list_security_policies before modifying, to confirm current state and avoid duplicates.
2080
- - GeoIP policies block or allow traffic by country code (ISO 3166-1 alpha-2). Use list_geo_ip_policies to see current policies, list_geo_ip_countries for all available codes, and lookup_ip_country to identify which country an IP address belongs to.
2032
+ - Rules and policies reference zones and schedules by name: use list_zones and list_schedules to discover valid names. list_interfaces shows interface IP/zone assignments and list_route_policies shows static routing \u2014 both are read-only discovery aids.
2033
+ - lookup_ip_country identifies which country an IP address belongs to (uses the appliance GeoIP database). Note: GeoIP *policy* management is not available via the SonicOS REST API.
2034
+
2035
+ ## Read-only API note
2036
+ The SonicOS REST API is configuration-focused. Connection/flow ("traffic") logs and GeoIP policy objects are not exposed as REST endpoints, so there are no tools for them.
2081
2037
 
2082
2038
  ## Concurrent sessions
2083
2039
  SonicOS allows only ONE concurrent API session per appliance. If a session error occurs, an existing admin or API session may need to be ended first.`
@@ -2092,6 +2048,10 @@ SonicOS allows only ONE concurrent API session per appliance. If a session error
2092
2048
  registerSecurityPolicyTools(server, registry);
2093
2049
  registerGeoIpTools(server, registry);
2094
2050
  registerLogTools(server, registry);
2051
+ registerZoneTools(server, registry);
2052
+ registerInterfaceTools(server, registry);
2053
+ registerScheduleTools(server, registry);
2054
+ registerRoutePolicyTools(server, registry);
2095
2055
  const transport = config.transport;
2096
2056
  if (transport === "stdio") {
2097
2057
  const t = new import_stdio.StdioServerTransport();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnetwork-nz/sonicwall-api-mcp-server",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "MCP server for SonicWall NSA appliance API — logs, CRUD objects, rules, NAT, GeoIP",
5
5
  "keywords": [
6
6
  "mcp",