@usex/mikrotik-mcp 3.0.0 → 3.2.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 +25 -15
- package/dist/index.js +14 -4
- package/dist/ui/observability.html +6 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3328,7 +3328,7 @@ function snapshots() {
|
|
|
3328
3328
|
}
|
|
3329
3329
|
function exportCommand(opts) {
|
|
3330
3330
|
const base = opts.section ? `/${opts.section} export` : "/export";
|
|
3331
|
-
return new Cmd(base).
|
|
3331
|
+
return new Cmd(base).raw(opts.terse ? "terse" : undefined).raw(opts.showSensitive ? "show-sensitive" : undefined).build();
|
|
3332
3332
|
}
|
|
3333
3333
|
async function liveExport(ctx, opts) {
|
|
3334
3334
|
const body = await executeMikrotikCommand(exportCommand(opts), ctx);
|
|
@@ -19573,16 +19573,6 @@ function usedPct(total, free) {
|
|
|
19573
19573
|
return Math.max(0, Math.min(100, (total - free) / total * 100));
|
|
19574
19574
|
}
|
|
19575
19575
|
async function probeDevice(name, dc) {
|
|
19576
|
-
if (dc.mac) {
|
|
19577
|
-
const status2 = {
|
|
19578
|
-
reachable: null,
|
|
19579
|
-
checkedAt: Date.now(),
|
|
19580
|
-
latencyMs: null,
|
|
19581
|
-
error: "MAC-Telnet device \u2014 reachability is verified on tool use, not background-probed."
|
|
19582
|
-
};
|
|
19583
|
-
statuses.set(name, status2);
|
|
19584
|
-
return status2;
|
|
19585
|
-
}
|
|
19586
19576
|
const client = createDeviceClient({
|
|
19587
19577
|
...dc,
|
|
19588
19578
|
timeoutMs: Math.min(dc.timeoutMs ?? 1e4, 8000)
|
|
@@ -19653,13 +19643,23 @@ async function probeDevice(name, dc) {
|
|
|
19653
19643
|
statuses.set(name, status);
|
|
19654
19644
|
return status;
|
|
19655
19645
|
}
|
|
19646
|
+
var MAC_PROBE_INTERVAL_MS = 5 * 60000;
|
|
19647
|
+
var lastMacProbe = new Map;
|
|
19656
19648
|
async function probeAll() {
|
|
19657
19649
|
if (inFlight)
|
|
19658
19650
|
return;
|
|
19659
19651
|
inFlight = true;
|
|
19660
19652
|
try {
|
|
19661
19653
|
const cfg = getConfig();
|
|
19662
|
-
|
|
19654
|
+
const now = Date.now();
|
|
19655
|
+
await Promise.all(Object.entries(cfg.devices).map(([name, dc]) => {
|
|
19656
|
+
if (dc.mac) {
|
|
19657
|
+
if (now - (lastMacProbe.get(name) ?? 0) < MAC_PROBE_INTERVAL_MS)
|
|
19658
|
+
return Promise.resolve();
|
|
19659
|
+
lastMacProbe.set(name, now);
|
|
19660
|
+
}
|
|
19661
|
+
return probeDevice(name, dc).catch(() => {});
|
|
19662
|
+
}));
|
|
19663
19663
|
} finally {
|
|
19664
19664
|
inFlight = false;
|
|
19665
19665
|
}
|
|
@@ -20509,7 +20509,7 @@ function registerPrompts(server) {
|
|
|
20509
20509
|
// package.json
|
|
20510
20510
|
var package_default = {
|
|
20511
20511
|
name: "@usex/mikrotik-mcp",
|
|
20512
|
-
version: "3.
|
|
20512
|
+
version: "3.2.0",
|
|
20513
20513
|
description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
|
|
20514
20514
|
keywords: [
|
|
20515
20515
|
"ai",
|
|
@@ -20682,11 +20682,21 @@ function createServer(opts = {}) {
|
|
|
20682
20682
|
}
|
|
20683
20683
|
]
|
|
20684
20684
|
}, {
|
|
20685
|
-
capabilities: {
|
|
20685
|
+
capabilities: {
|
|
20686
|
+
tools: { listChanged: true },
|
|
20687
|
+
prompts: { listChanged: true },
|
|
20688
|
+
resources: { listChanged: true },
|
|
20689
|
+
logging: {}
|
|
20690
|
+
},
|
|
20686
20691
|
instructions
|
|
20687
20692
|
});
|
|
20693
|
+
const sendLog = opts.sendLog ?? ((level, message) => {
|
|
20694
|
+
try {
|
|
20695
|
+
server.server.sendLoggingMessage({ level, data: message }).catch(() => {});
|
|
20696
|
+
} catch {}
|
|
20697
|
+
});
|
|
20688
20698
|
const toolCount = registerTools(server, allToolModules, {
|
|
20689
|
-
sendLog
|
|
20699
|
+
sendLog,
|
|
20690
20700
|
deviceNames: names,
|
|
20691
20701
|
readOnly
|
|
20692
20702
|
});
|
package/dist/index.js
CHANGED
|
@@ -3401,7 +3401,7 @@ function snapshots() {
|
|
|
3401
3401
|
}
|
|
3402
3402
|
function exportCommand(opts) {
|
|
3403
3403
|
const base = opts.section ? `/${opts.section} export` : "/export";
|
|
3404
|
-
return new Cmd(base).
|
|
3404
|
+
return new Cmd(base).raw(opts.terse ? "terse" : undefined).raw(opts.showSensitive ? "show-sensitive" : undefined).build();
|
|
3405
3405
|
}
|
|
3406
3406
|
async function liveExport(ctx, opts) {
|
|
3407
3407
|
const body = await executeMikrotikCommand(exportCommand(opts), ctx);
|
|
@@ -19337,7 +19337,7 @@ var allToolModules = moduleCatalog.map((m) => m.tools);
|
|
|
19337
19337
|
// package.json
|
|
19338
19338
|
var package_default = {
|
|
19339
19339
|
name: "@usex/mikrotik-mcp",
|
|
19340
|
-
version: "3.
|
|
19340
|
+
version: "3.2.0",
|
|
19341
19341
|
description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
|
|
19342
19342
|
keywords: [
|
|
19343
19343
|
"ai",
|
|
@@ -19510,11 +19510,21 @@ function createServer(opts = {}) {
|
|
|
19510
19510
|
}
|
|
19511
19511
|
]
|
|
19512
19512
|
}, {
|
|
19513
|
-
capabilities: {
|
|
19513
|
+
capabilities: {
|
|
19514
|
+
tools: { listChanged: true },
|
|
19515
|
+
prompts: { listChanged: true },
|
|
19516
|
+
resources: { listChanged: true },
|
|
19517
|
+
logging: {}
|
|
19518
|
+
},
|
|
19514
19519
|
instructions
|
|
19515
19520
|
});
|
|
19521
|
+
const sendLog = opts.sendLog ?? ((level, message) => {
|
|
19522
|
+
try {
|
|
19523
|
+
server.server.sendLoggingMessage({ level, data: message }).catch(() => {});
|
|
19524
|
+
} catch {}
|
|
19525
|
+
});
|
|
19516
19526
|
const toolCount = registerTools(server, allToolModules, {
|
|
19517
|
-
sendLog
|
|
19527
|
+
sendLog,
|
|
19518
19528
|
deviceNames: names,
|
|
19519
19529
|
readOnly
|
|
19520
19530
|
});
|