@teamnetwork-nz/sonicwall-api-mcp-server 0.7.0 → 0.8.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.
- package/README.md +4 -0
- package/dist/http-server.js +119 -0
- package/dist/index.js +129 -32
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# SonicWall NSA MCP Server
|
|
2
2
|
|
|
3
|
+
## Streamable HTTP
|
|
4
|
+
|
|
5
|
+
Set `SONICWALL_TRANSPORT=http` to serve stateless MCP at `/mcp`. It binds to `127.0.0.1` by default; remote binding requires `SONICWALL_HTTP_BEARER_TOKEN` and `SONICWALL_HTTP_ALLOWED_HOSTS`. Optional controls include `SONICWALL_HTTP_PORT`, `SONICWALL_HTTP_ALLOWED_ORIGINS`, and `SONICWALL_HTTP_MAX_BODY_BYTES`; `/health` is available for health checks.
|
|
6
|
+
|
|
3
7
|
A [Model Context Protocol](https://modelcontextprotocol.io/) server that provides full read/write access to SonicWall NSA series appliances via the SonicOS REST API.
|
|
4
8
|
|
|
5
9
|
## Features
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/http-server.ts
|
|
32
|
+
var http_server_exports = {};
|
|
33
|
+
__export(http_server_exports, {
|
|
34
|
+
createHttpServer: () => createHttpServer,
|
|
35
|
+
validateHttpOptions: () => validateHttpOptions
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(http_server_exports);
|
|
38
|
+
var import_node_crypto = require("crypto");
|
|
39
|
+
var import_node_http = __toESM(require("http"));
|
|
40
|
+
var import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
41
|
+
var loopback = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "localhost"]);
|
|
42
|
+
var send = (res, status, body) => {
|
|
43
|
+
res.writeHead(status, { "Content-Type": "application/json" }).end(JSON.stringify(body));
|
|
44
|
+
};
|
|
45
|
+
var error = (res, status, code, message) => send(res, status, { jsonrpc: "2.0", error: { code, message }, id: null });
|
|
46
|
+
var matches = (value, expected) => {
|
|
47
|
+
if (!value?.startsWith("Bearer ")) return false;
|
|
48
|
+
const supplied = Buffer.from(value.slice(7));
|
|
49
|
+
const wanted = Buffer.from(expected);
|
|
50
|
+
return supplied.length === wanted.length && (0, import_node_crypto.timingSafeEqual)(supplied, wanted);
|
|
51
|
+
};
|
|
52
|
+
var readBody = (req, limit) => new Promise((resolve, reject) => {
|
|
53
|
+
const chunks = [];
|
|
54
|
+
let size = 0;
|
|
55
|
+
let oversized = false;
|
|
56
|
+
req.on("data", (chunk) => {
|
|
57
|
+
size += chunk.length;
|
|
58
|
+
oversized ||= size > limit;
|
|
59
|
+
if (!oversized) chunks.push(chunk);
|
|
60
|
+
});
|
|
61
|
+
req.on("end", () => {
|
|
62
|
+
if (oversized) return reject(Object.assign(new Error("Request body too large"), { statusCode: 413 }));
|
|
63
|
+
try {
|
|
64
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
65
|
+
} catch {
|
|
66
|
+
reject(Object.assign(new Error("Invalid JSON body"), { statusCode: 400 }));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
req.on("error", reject);
|
|
70
|
+
});
|
|
71
|
+
function validateHttpOptions(o) {
|
|
72
|
+
if (!Number.isInteger(o.port) || o.port < 1 || o.port > 65535) throw new Error(`Invalid HTTP port: ${o.port}`);
|
|
73
|
+
if (o.maxBodyBytes !== void 0 && (!Number.isInteger(o.maxBodyBytes) || o.maxBodyBytes < 1)) throw new Error(`Invalid HTTP body limit: ${o.maxBodyBytes}`);
|
|
74
|
+
if (!loopback.has(o.host) && !o.bearerToken) throw new Error("A bearer token is required when binding beyond loopback");
|
|
75
|
+
if (!loopback.has(o.host) && !o.allowedHosts?.length) throw new Error("HTTP_ALLOWED_HOSTS is required when binding beyond loopback");
|
|
76
|
+
}
|
|
77
|
+
function createHttpServer(factory, o) {
|
|
78
|
+
validateHttpOptions(o);
|
|
79
|
+
const hosts = new Set(o.allowedHosts?.map((v) => v.toLowerCase()));
|
|
80
|
+
const origins = new Set(o.allowedOrigins?.map((v) => v.toLowerCase()));
|
|
81
|
+
return import_node_http.default.createServer(async (req, res) => {
|
|
82
|
+
const path = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
83
|
+
if (path === "/health") return send(res, 200, { status: "ok", server: o.serverName });
|
|
84
|
+
if (path !== "/mcp") return void res.writeHead(404).end();
|
|
85
|
+
if (hosts.size && !hosts.has((req.headers.host ?? "").toLowerCase())) return error(res, 403, -32e3, "Host not allowed");
|
|
86
|
+
if (req.headers.origin && !origins.has(req.headers.origin.toLowerCase())) return error(res, 403, -32e3, "Origin not allowed");
|
|
87
|
+
if (o.bearerToken && !matches(req.headers.authorization, o.bearerToken)) {
|
|
88
|
+
res.setHeader("WWW-Authenticate", "Bearer");
|
|
89
|
+
return error(res, 401, -32001, "Unauthorized");
|
|
90
|
+
}
|
|
91
|
+
if (req.method !== "POST") {
|
|
92
|
+
res.setHeader("Allow", "POST");
|
|
93
|
+
return error(res, 405, -32e3, "Method not allowed");
|
|
94
|
+
}
|
|
95
|
+
const server = factory();
|
|
96
|
+
const transport = new import_streamableHttp.StreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
|
|
97
|
+
try {
|
|
98
|
+
const body = await readBody(req, o.maxBodyBytes ?? 1048576);
|
|
99
|
+
await server.connect(transport);
|
|
100
|
+
await transport.handleRequest(req, res, body);
|
|
101
|
+
res.once("close", () => {
|
|
102
|
+
void transport.close();
|
|
103
|
+
void server.close();
|
|
104
|
+
});
|
|
105
|
+
} catch (cause) {
|
|
106
|
+
void transport.close();
|
|
107
|
+
void server.close();
|
|
108
|
+
if (!res.headersSent) {
|
|
109
|
+
const status = cause.statusCode ?? 500;
|
|
110
|
+
error(res, status, status === 400 ? -32700 : -32603, status < 500 ? cause.message : "Internal server error");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
createHttpServer,
|
|
118
|
+
validateHttpOptions
|
|
119
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -1860,12 +1860,12 @@ async function getWithFallback(client, candidates) {
|
|
|
1860
1860
|
for (const path of candidates) {
|
|
1861
1861
|
try {
|
|
1862
1862
|
return await client.get(path);
|
|
1863
|
-
} catch (
|
|
1864
|
-
if (
|
|
1865
|
-
lastError =
|
|
1863
|
+
} catch (error2) {
|
|
1864
|
+
if (error2 instanceof APIError && (error2.status === 400 || error2.status === 404)) {
|
|
1865
|
+
lastError = error2;
|
|
1866
1866
|
continue;
|
|
1867
1867
|
}
|
|
1868
|
-
throw
|
|
1868
|
+
throw error2;
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
throw lastError;
|
|
@@ -1880,8 +1880,8 @@ function registerLogTools(server, registry) {
|
|
|
1880
1880
|
const client = await registry.getClient(device);
|
|
1881
1881
|
const result = await getWithFallback(client, ["log/categories", "reporting/log/categories"]);
|
|
1882
1882
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
1883
|
-
} catch (
|
|
1884
|
-
return { content: [{ type: "text", text: `Error: ${
|
|
1883
|
+
} catch (error2) {
|
|
1884
|
+
return { content: [{ type: "text", text: `Error: ${error2.message}` }], isError: true };
|
|
1885
1885
|
}
|
|
1886
1886
|
}
|
|
1887
1887
|
);
|
|
@@ -1894,8 +1894,8 @@ function registerLogTools(server, registry) {
|
|
|
1894
1894
|
const client = await registry.getClient(device);
|
|
1895
1895
|
const result = await getWithFallback(client, ["log/events", "reporting/log/events"]);
|
|
1896
1896
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
1897
|
-
} catch (
|
|
1898
|
-
return { content: [{ type: "text", text: `Error: ${
|
|
1897
|
+
} catch (error2) {
|
|
1898
|
+
return { content: [{ type: "text", text: `Error: ${error2.message}` }], isError: true };
|
|
1899
1899
|
}
|
|
1900
1900
|
}
|
|
1901
1901
|
);
|
|
@@ -1936,6 +1936,17 @@ function registerZoneTools(server, registry) {
|
|
|
1936
1936
|
|
|
1937
1937
|
// src/tools/interfaces.ts
|
|
1938
1938
|
var import_zod12 = require("zod");
|
|
1939
|
+
var SECRET_FIELD = /(?:password|passwd|secret|private_key|pre_shared_key|community)$/i;
|
|
1940
|
+
function redactSecrets(value) {
|
|
1941
|
+
if (Array.isArray(value)) return value.map(redactSecrets);
|
|
1942
|
+
if (!value || typeof value !== "object") return value;
|
|
1943
|
+
return Object.fromEntries(
|
|
1944
|
+
Object.entries(value).map(([key, nested]) => [
|
|
1945
|
+
key,
|
|
1946
|
+
SECRET_FIELD.test(key) ? "[REDACTED]" : redactSecrets(nested)
|
|
1947
|
+
])
|
|
1948
|
+
);
|
|
1949
|
+
}
|
|
1939
1950
|
function registerInterfaceTools(server, registry) {
|
|
1940
1951
|
server.tool(
|
|
1941
1952
|
"list_interfaces",
|
|
@@ -1945,7 +1956,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
1945
1956
|
try {
|
|
1946
1957
|
const client = await registry.getClient(device);
|
|
1947
1958
|
const result = await client.get("interfaces/ipv4");
|
|
1948
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
1959
|
+
return { content: [{ type: "text", text: JSON.stringify(redactSecrets(result), null, 2) }] };
|
|
1949
1960
|
} catch (e) {
|
|
1950
1961
|
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
1951
1962
|
}
|
|
@@ -1959,7 +1970,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
1959
1970
|
try {
|
|
1960
1971
|
const client = await registry.getClient(device);
|
|
1961
1972
|
const result = await client.get(`interfaces/ipv4/name/${encodeURIComponent(name)}`);
|
|
1962
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
1973
|
+
return { content: [{ type: "text", text: JSON.stringify(redactSecrets(result), null, 2) }] };
|
|
1963
1974
|
} catch (e) {
|
|
1964
1975
|
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
1965
1976
|
}
|
|
@@ -2022,6 +2033,85 @@ function registerRoutePolicyTools(server, registry) {
|
|
|
2022
2033
|
);
|
|
2023
2034
|
}
|
|
2024
2035
|
|
|
2036
|
+
// src/http-server.ts
|
|
2037
|
+
var import_node_crypto = require("crypto");
|
|
2038
|
+
var import_node_http = __toESM(require("http"));
|
|
2039
|
+
var import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
2040
|
+
var loopback = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "localhost"]);
|
|
2041
|
+
var send = (res, status, body) => {
|
|
2042
|
+
res.writeHead(status, { "Content-Type": "application/json" }).end(JSON.stringify(body));
|
|
2043
|
+
};
|
|
2044
|
+
var error = (res, status, code, message) => send(res, status, { jsonrpc: "2.0", error: { code, message }, id: null });
|
|
2045
|
+
var matches = (value, expected) => {
|
|
2046
|
+
if (!value?.startsWith("Bearer ")) return false;
|
|
2047
|
+
const supplied = Buffer.from(value.slice(7));
|
|
2048
|
+
const wanted = Buffer.from(expected);
|
|
2049
|
+
return supplied.length === wanted.length && (0, import_node_crypto.timingSafeEqual)(supplied, wanted);
|
|
2050
|
+
};
|
|
2051
|
+
var readBody = (req, limit) => new Promise((resolve, reject) => {
|
|
2052
|
+
const chunks = [];
|
|
2053
|
+
let size = 0;
|
|
2054
|
+
let oversized = false;
|
|
2055
|
+
req.on("data", (chunk) => {
|
|
2056
|
+
size += chunk.length;
|
|
2057
|
+
oversized ||= size > limit;
|
|
2058
|
+
if (!oversized) chunks.push(chunk);
|
|
2059
|
+
});
|
|
2060
|
+
req.on("end", () => {
|
|
2061
|
+
if (oversized) return reject(Object.assign(new Error("Request body too large"), { statusCode: 413 }));
|
|
2062
|
+
try {
|
|
2063
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
2064
|
+
} catch {
|
|
2065
|
+
reject(Object.assign(new Error("Invalid JSON body"), { statusCode: 400 }));
|
|
2066
|
+
}
|
|
2067
|
+
});
|
|
2068
|
+
req.on("error", reject);
|
|
2069
|
+
});
|
|
2070
|
+
function validateHttpOptions(o) {
|
|
2071
|
+
if (!Number.isInteger(o.port) || o.port < 1 || o.port > 65535) throw new Error(`Invalid HTTP port: ${o.port}`);
|
|
2072
|
+
if (o.maxBodyBytes !== void 0 && (!Number.isInteger(o.maxBodyBytes) || o.maxBodyBytes < 1)) throw new Error(`Invalid HTTP body limit: ${o.maxBodyBytes}`);
|
|
2073
|
+
if (!loopback.has(o.host) && !o.bearerToken) throw new Error("A bearer token is required when binding beyond loopback");
|
|
2074
|
+
if (!loopback.has(o.host) && !o.allowedHosts?.length) throw new Error("HTTP_ALLOWED_HOSTS is required when binding beyond loopback");
|
|
2075
|
+
}
|
|
2076
|
+
function createHttpServer(factory, o) {
|
|
2077
|
+
validateHttpOptions(o);
|
|
2078
|
+
const hosts = new Set(o.allowedHosts?.map((v) => v.toLowerCase()));
|
|
2079
|
+
const origins = new Set(o.allowedOrigins?.map((v) => v.toLowerCase()));
|
|
2080
|
+
return import_node_http.default.createServer(async (req, res) => {
|
|
2081
|
+
const path = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
2082
|
+
if (path === "/health") return send(res, 200, { status: "ok", server: o.serverName });
|
|
2083
|
+
if (path !== "/mcp") return void res.writeHead(404).end();
|
|
2084
|
+
if (hosts.size && !hosts.has((req.headers.host ?? "").toLowerCase())) return error(res, 403, -32e3, "Host not allowed");
|
|
2085
|
+
if (req.headers.origin && !origins.has(req.headers.origin.toLowerCase())) return error(res, 403, -32e3, "Origin not allowed");
|
|
2086
|
+
if (o.bearerToken && !matches(req.headers.authorization, o.bearerToken)) {
|
|
2087
|
+
res.setHeader("WWW-Authenticate", "Bearer");
|
|
2088
|
+
return error(res, 401, -32001, "Unauthorized");
|
|
2089
|
+
}
|
|
2090
|
+
if (req.method !== "POST") {
|
|
2091
|
+
res.setHeader("Allow", "POST");
|
|
2092
|
+
return error(res, 405, -32e3, "Method not allowed");
|
|
2093
|
+
}
|
|
2094
|
+
const server = factory();
|
|
2095
|
+
const transport = new import_streamableHttp.StreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
|
|
2096
|
+
try {
|
|
2097
|
+
const body = await readBody(req, o.maxBodyBytes ?? 1048576);
|
|
2098
|
+
await server.connect(transport);
|
|
2099
|
+
await transport.handleRequest(req, res, body);
|
|
2100
|
+
res.once("close", () => {
|
|
2101
|
+
void transport.close();
|
|
2102
|
+
void server.close();
|
|
2103
|
+
});
|
|
2104
|
+
} catch (cause) {
|
|
2105
|
+
void transport.close();
|
|
2106
|
+
void server.close();
|
|
2107
|
+
if (!res.headersSent) {
|
|
2108
|
+
const status = cause.statusCode ?? 500;
|
|
2109
|
+
error(res, status, status === 400 ? -32700 : -32603, status < 500 ? cause.message : "Internal server error");
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2025
2115
|
// src/index.ts
|
|
2026
2116
|
async function main() {
|
|
2027
2117
|
let config;
|
|
@@ -2039,10 +2129,11 @@ async function main() {
|
|
|
2039
2129
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
2040
2130
|
}
|
|
2041
2131
|
const registry = new DeviceRegistry(config.profiles);
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2132
|
+
const createConfiguredServer = () => {
|
|
2133
|
+
const server = new import_mcp.McpServer({
|
|
2134
|
+
name: "sonicwall-mcp-server",
|
|
2135
|
+
version: "0.8.0",
|
|
2136
|
+
instructions: `SonicWall NSA MCP server \u2014 full read/write access to SonicWall firewalls via the SonicOS REST API.
|
|
2046
2137
|
|
|
2047
2138
|
## Device targeting
|
|
2048
2139
|
Use list_devices to discover available appliances and their names. Pass device='<name>' to target a specific appliance; omit it to use the primary/default device.
|
|
@@ -2068,28 +2159,34 @@ The SonicOS REST API is configuration-focused. Connection/flow ("traffic") logs
|
|
|
2068
2159
|
|
|
2069
2160
|
## Concurrent sessions
|
|
2070
2161
|
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.`
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2162
|
+
});
|
|
2163
|
+
registerSystemTools(server, registry);
|
|
2164
|
+
registerAddressObjectTools(server, registry);
|
|
2165
|
+
registerAddressGroupTools(server, registry);
|
|
2166
|
+
registerServiceObjectTools(server, registry);
|
|
2167
|
+
registerServiceGroupTools(server, registry);
|
|
2168
|
+
registerAccessRuleTools(server, registry);
|
|
2169
|
+
registerNatPolicyTools(server, registry);
|
|
2170
|
+
registerSecurityPolicyTools(server, registry);
|
|
2171
|
+
registerGeoIpTools(server, registry);
|
|
2172
|
+
registerLogTools(server, registry);
|
|
2173
|
+
registerZoneTools(server, registry);
|
|
2174
|
+
registerInterfaceTools(server, registry);
|
|
2175
|
+
registerScheduleTools(server, registry);
|
|
2176
|
+
registerRoutePolicyTools(server, registry);
|
|
2177
|
+
return server;
|
|
2178
|
+
};
|
|
2086
2179
|
const transport = config.transport;
|
|
2087
2180
|
if (transport === "stdio") {
|
|
2088
|
-
|
|
2089
|
-
|
|
2181
|
+
await createConfiguredServer().connect(new import_stdio.StdioServerTransport());
|
|
2182
|
+
} else if (transport === "http") {
|
|
2183
|
+
const host = process.env["SONICWALL_HTTP_HOST"] ?? "127.0.0.1";
|
|
2184
|
+
const port = Number.parseInt(process.env["SONICWALL_HTTP_PORT"] ?? "3000", 10);
|
|
2185
|
+
createHttpServer(createConfiguredServer, { host, port, serverName: "@teamnetwork-nz/sonicwall-api-mcp-server", bearerToken: process.env["SONICWALL_HTTP_BEARER_TOKEN"], allowedHosts: process.env["SONICWALL_HTTP_ALLOWED_HOSTS"]?.split(",").map((v) => v.trim()).filter(Boolean), allowedOrigins: process.env["SONICWALL_HTTP_ALLOWED_ORIGINS"]?.split(",").map((v) => v.trim()).filter(Boolean), maxBodyBytes: Number.parseInt(process.env["SONICWALL_HTTP_MAX_BODY_BYTES"] ?? "1048576", 10) }).listen(port, host, () => process.stderr.write(`sonicwall-mcp: HTTP listening on ${host}:${port}/mcp
|
|
2186
|
+
`));
|
|
2090
2187
|
} else {
|
|
2091
2188
|
process.stderr.write(
|
|
2092
|
-
`sonicwall-mcp: transport '${transport}'
|
|
2189
|
+
`sonicwall-mcp: unsupported transport '${transport}'. Use stdio or http.
|
|
2093
2190
|
`
|
|
2094
2191
|
);
|
|
2095
2192
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamnetwork-nz/sonicwall-api-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "MCP server for SonicWall NSA appliance configuration — objects, rules, NAT, routing, and GeoIP lookup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsup",
|
|
36
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
36
37
|
"prepublishOnly": "npm run build",
|
|
37
38
|
"start": "node dist/index.js"
|
|
38
39
|
},
|