@usex/mikrotik-mcp 3.52.0 → 3.54.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/dist/cli.js +24 -31
- package/dist/index.js +1 -1
- package/dist/shared/{cli-ewkttc56.js → cli-njttbdf8.js} +22080 -22036
- package/dist/shared/{cli-thdzk64q.js → cli-xt3qvpz0.js} +1 -1
- package/dist/shared/{library-4npjv6jq.js → library-84y0nvhr.js} +1 -1
- package/dist/shared/{library-n3yvjpkm.js → library-hk90ad18.js} +7025 -6986
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
buildChangePlan,
|
|
26
26
|
capture,
|
|
27
27
|
closeAll,
|
|
28
|
+
closeMemoryStore,
|
|
28
29
|
commandUnsupported,
|
|
29
30
|
configureRecorder,
|
|
30
31
|
createContext,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
getConfig,
|
|
42
43
|
getConfigSource,
|
|
43
44
|
getEventStore,
|
|
45
|
+
getMemoryStore,
|
|
44
46
|
getRadiusIncoming,
|
|
45
47
|
getS3Client,
|
|
46
48
|
getUmSettings,
|
|
@@ -57,7 +59,6 @@ import {
|
|
|
57
59
|
makeDeviceStatic,
|
|
58
60
|
moduleCatalog,
|
|
59
61
|
normalizeExport,
|
|
60
|
-
openMemoryStore,
|
|
61
62
|
openSnapshotStore,
|
|
62
63
|
parseKeyValues,
|
|
63
64
|
parseLeadingNumber,
|
|
@@ -75,7 +76,7 @@ import {
|
|
|
75
76
|
removeDeviceLease,
|
|
76
77
|
renameBackup,
|
|
77
78
|
renderPlan,
|
|
78
|
-
|
|
79
|
+
reopenMemoryStore,
|
|
79
80
|
resetRadiusCounters,
|
|
80
81
|
resolveDeviceName,
|
|
81
82
|
restoreLocalBackup,
|
|
@@ -95,7 +96,7 @@ import {
|
|
|
95
96
|
toggleAaaEntity,
|
|
96
97
|
updateAaaEntity,
|
|
97
98
|
writeBackup
|
|
98
|
-
} from "./shared/cli-
|
|
99
|
+
} from "./shared/cli-njttbdf8.js";
|
|
99
100
|
|
|
100
101
|
// src/cli.ts
|
|
101
102
|
import { existsSync as existsSync2 } from "fs";
|
|
@@ -1300,20 +1301,6 @@ async function driftRoutes(req, url) {
|
|
|
1300
1301
|
}
|
|
1301
1302
|
|
|
1302
1303
|
// src/observability/memory-routes.ts
|
|
1303
|
-
var storePromise2 = null;
|
|
1304
|
-
function getStore2() {
|
|
1305
|
-
if (!storePromise2) {
|
|
1306
|
-
const cfg = getConfig();
|
|
1307
|
-
storePromise2 = openMemoryStore(cfg.memory.dbPath);
|
|
1308
|
-
}
|
|
1309
|
-
return storePromise2;
|
|
1310
|
-
}
|
|
1311
|
-
function closeMemoryStore() {
|
|
1312
|
-
if (storePromise2) {
|
|
1313
|
-
storePromise2.then((s) => s.close()).catch(() => {});
|
|
1314
|
-
storePromise2 = null;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
1304
|
var JSON_HEADERS2 = { "content-type": "application/json; charset=utf-8" };
|
|
1318
1305
|
function json2(body, status = 200) {
|
|
1319
1306
|
return new Response(JSON.stringify(body), { status, headers: JSON_HEADERS2 });
|
|
@@ -1332,7 +1319,7 @@ async function memoryRoutes(req, url) {
|
|
|
1332
1319
|
if (p === "/api/memory/config" && req.method === "GET") {
|
|
1333
1320
|
let stats = null;
|
|
1334
1321
|
try {
|
|
1335
|
-
const store2 = await
|
|
1322
|
+
const store2 = await getMemoryStore();
|
|
1336
1323
|
stats = store2.stats();
|
|
1337
1324
|
} catch {}
|
|
1338
1325
|
return json2({
|
|
@@ -1345,15 +1332,13 @@ async function memoryRoutes(req, url) {
|
|
|
1345
1332
|
const body = await bodyJson2(req);
|
|
1346
1333
|
const updates = {};
|
|
1347
1334
|
if (body.dbPath !== undefined && typeof body.dbPath === "string" && body.dbPath !== cfg.memory.dbPath) {
|
|
1348
|
-
closeMemoryStore();
|
|
1349
|
-
resetMemoryStore();
|
|
1350
1335
|
updates.dbPath = body.dbPath;
|
|
1351
|
-
storePromise2 = openMemoryStore(body.dbPath);
|
|
1352
1336
|
try {
|
|
1353
|
-
await
|
|
1337
|
+
await reopenMemoryStore(body.dbPath);
|
|
1354
1338
|
} catch (e) {
|
|
1355
|
-
|
|
1356
|
-
|
|
1339
|
+
return json2({
|
|
1340
|
+
error: `Failed to open memory DB at ${body.dbPath}: ${e instanceof Error ? e.message : String(e)}`
|
|
1341
|
+
}, 400);
|
|
1357
1342
|
}
|
|
1358
1343
|
}
|
|
1359
1344
|
if (body.enabled !== undefined && typeof body.enabled === "boolean") {
|
|
@@ -1370,7 +1355,7 @@ async function memoryRoutes(req, url) {
|
|
|
1370
1355
|
}
|
|
1371
1356
|
let stats = null;
|
|
1372
1357
|
try {
|
|
1373
|
-
const store2 = await
|
|
1358
|
+
const store2 = await getMemoryStore();
|
|
1374
1359
|
stats = store2.stats();
|
|
1375
1360
|
} catch {}
|
|
1376
1361
|
return json2({
|
|
@@ -1380,7 +1365,7 @@ async function memoryRoutes(req, url) {
|
|
|
1380
1365
|
stats
|
|
1381
1366
|
});
|
|
1382
1367
|
}
|
|
1383
|
-
const store = await
|
|
1368
|
+
const store = await getMemoryStore();
|
|
1384
1369
|
if (p === "/api/memory/graph" && req.method === "GET") {
|
|
1385
1370
|
return json2(store.readGraph());
|
|
1386
1371
|
}
|
|
@@ -3026,13 +3011,14 @@ ${entries.length} device(s) checked.
|
|
|
3026
3011
|
return ok ? 0 : 1;
|
|
3027
3012
|
}
|
|
3028
3013
|
async function main() {
|
|
3014
|
+
process.title = `MikroTik-MCP (${VERSION})`;
|
|
3029
3015
|
const argv = process.argv.slice(2);
|
|
3030
3016
|
const command = argv.find((a) => !a.startsWith("--")) ?? "serve";
|
|
3031
3017
|
if (argv.includes("--help") || argv.includes("-h") || command === "help") {
|
|
3032
3018
|
process.stdout.write(HELP);
|
|
3033
3019
|
return;
|
|
3034
3020
|
}
|
|
3035
|
-
if (argv.includes("--version") || command === "version") {
|
|
3021
|
+
if (argv.includes("--version") || argv.includes("-v") || command === "version") {
|
|
3036
3022
|
process.stdout.write(`${VERSION}
|
|
3037
3023
|
`);
|
|
3038
3024
|
return;
|
|
@@ -3054,12 +3040,19 @@ async function main() {
|
|
|
3054
3040
|
warnIfPlaintextPasswordInContainer(Object.values(cfg.devices).some((d) => !!d.password));
|
|
3055
3041
|
const deviceNames = Object.keys(cfg.devices);
|
|
3056
3042
|
logger.info(`Starting ${SERVER_NAME} v${VERSION} (transport=${cfg.mcp.transport}, ` + `devices=${deviceNames.length === 1 ? deviceNames[0] : deviceNames.join("/")}, ` + `ssh-pool=${cfg.ssh.keepAlive ? "on" : "off"})`);
|
|
3057
|
-
|
|
3043
|
+
let shuttingDown = false;
|
|
3044
|
+
const shutdown = (signal) => {
|
|
3045
|
+
if (shuttingDown)
|
|
3046
|
+
return;
|
|
3047
|
+
shuttingDown = true;
|
|
3048
|
+
logger.info(`Received ${signal}, shutting down\u2026`);
|
|
3058
3049
|
closeAll();
|
|
3050
|
+
closeMemoryStore();
|
|
3051
|
+
process.exit(0);
|
|
3059
3052
|
};
|
|
3060
|
-
process.on("SIGINT",
|
|
3061
|
-
process.on("SIGTERM",
|
|
3062
|
-
process.on("exit",
|
|
3053
|
+
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
3054
|
+
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
3055
|
+
process.on("exit", closeAll);
|
|
3063
3056
|
const startDashboard = async () => {
|
|
3064
3057
|
if (!cfg.dashboard.enabled)
|
|
3065
3058
|
return;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveDeviceName,
|
|
23
23
|
selectToolModules,
|
|
24
24
|
setConfig
|
|
25
|
-
} from "./shared/library-
|
|
25
|
+
} from "./shared/library-hk90ad18.js";
|
|
26
26
|
// src/server.ts
|
|
27
27
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
28
28
|
import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|