@usex/mikrotik-mcp 4.24.0 → 5.0.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 +108 -51
- package/dist/cli.js +1839 -554
- package/dist/index.d.ts +57 -0
- package/dist/index.js +1 -1
- package/dist/shared/{library-2f8ty72a.js → cli-2dj736ma.js} +34321 -22476
- package/dist/shared/{cli-ps0h2mxx.js → cli-vvy7yfyg.js} +1 -1
- package/dist/shared/{cli-10wtq3xb.js → library-13dhfdnq.js} +29451 -18574
- package/dist/shared/{library-phwm9kqe.js → library-syt5fmtj.js} +1 -1
- package/dist/ui/observability.html +70 -62
- package/package.json +3 -2
- package/policies/baseline.yaml +180 -0
- package/prompts/backup-and-document.md +28 -18
- package/prompts/build-tunnel-transactionally.md +74 -0
- package/prompts/fleet-rollout.md +68 -0
- package/prompts/setup-traffic-flow.md +68 -0
- package/schemas/README.md +1 -1
- package/schemas/config.schema.json +367 -4
- package/schemas/tool-catalog.json +3044 -1152
- package/schemas/tools/abort_rollout.json +17 -0
- package/schemas/tools/abort_transaction.json +17 -0
- package/schemas/tools/add_alert_rule.json +45 -0
- package/schemas/tools/add_ipv6_route.json +1 -1
- package/schemas/tools/add_route.json +3 -2
- package/schemas/tools/add_schedule.json +50 -0
- package/schemas/tools/add_script.json +1 -1
- package/schemas/tools/add_traffic_flow_target.json +36 -0
- package/schemas/tools/add_transaction_step.json +21 -0
- package/schemas/tools/analyze_flows.json +25 -0
- package/schemas/tools/begin_transaction.json +109 -0
- package/schemas/tools/block_attacker.json +22 -0
- package/schemas/tools/check_policy_snapshot.json +20 -0
- package/schemas/tools/commit_transaction.json +13 -0
- package/schemas/tools/configure_attack_response.json +12 -0
- package/schemas/tools/diff_explanations.json +24 -0
- package/schemas/tools/explain_device.json +22 -0
- package/schemas/tools/explain_policy_finding.json +17 -0
- package/schemas/tools/explain_rule_reachability.json +18 -0
- package/schemas/tools/explain_section.json +32 -0
- package/schemas/tools/export_policy_report.json +22 -0
- package/schemas/tools/flow_top_talkers.json +31 -0
- package/schemas/tools/get_alert_history.json +26 -0
- package/schemas/tools/get_attack_incident.json +13 -0
- package/schemas/tools/get_audit_timeline.json +24 -0
- package/schemas/tools/get_device_capabilities.json +7 -0
- package/schemas/tools/get_traffic_flow_settings.json +7 -0
- package/schemas/tools/list_alert_rules.json +7 -0
- package/schemas/tools/list_attack_incidents.json +27 -0
- package/schemas/tools/list_attack_responses.json +20 -0
- package/schemas/tools/list_policies.json +17 -0
- package/schemas/tools/list_schedules.json +12 -0
- package/schemas/tools/list_traffic_flow_targets.json +7 -0
- package/schemas/tools/mute_alert_rule.json +18 -0
- package/schemas/tools/plan_rollout.json +95 -0
- package/schemas/tools/refresh_device_capabilities.json +7 -0
- package/schemas/tools/remove_alert_rule.json +13 -0
- package/schemas/tools/remove_schedule.json +13 -0
- package/schemas/tools/remove_traffic_flow_target.json +13 -0
- package/schemas/tools/rollout_status.json +12 -0
- package/schemas/tools/run_policy_check.json +12 -0
- package/schemas/tools/run_schedule_now.json +13 -0
- package/schemas/tools/scan_for_attacks.json +21 -0
- package/schemas/tools/set_traffic_flow_settings.json +28 -0
- package/schemas/tools/simulate_change.json +72 -0
- package/schemas/tools/simulate_packet.json +53 -0
- package/schemas/tools/simulate_suite.json +71 -0
- package/schemas/tools/start_flow_collector.json +14 -0
- package/schemas/tools/start_rollout.json +98 -0
- package/schemas/tools/stop_flow_collector.json +7 -0
- package/schemas/tools/test_alert_channel.json +14 -0
- package/schemas/tools/unblock_attacker.json +20 -0
- package/schemas/tools/update_alert_rule.json +41 -0
- package/schemas/tools/update_route.json +3 -2
- package/schemas/tools/validate_policy_file.json +16 -0
- package/schemas/tools/verify_transaction.json +13 -0
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,28 @@ interface ToolContext {
|
|
|
14
14
|
* `undefined` means "use the configured default device".
|
|
15
15
|
*/
|
|
16
16
|
device?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Which transport actually carried the last device command of this call.
|
|
19
|
+
*
|
|
20
|
+
* Recorded here rather than in a module-level global because tool calls run
|
|
21
|
+
* concurrently — a shared "last transport used" would be overwritten by
|
|
22
|
+
* whichever device answered most recently. One context per call makes this
|
|
23
|
+
* safe for free.
|
|
24
|
+
*
|
|
25
|
+
* A tool that issues several commands reports the LAST one; that is exact for
|
|
26
|
+
* the single-command majority and representative otherwise.
|
|
27
|
+
*/
|
|
28
|
+
transport?: DeviceTransport;
|
|
29
|
+
/**
|
|
30
|
+
* Why REST fell back to SSH on the last command, when it did. Present only
|
|
31
|
+
* for a device with `api: true` that could not use REST — the reason is the
|
|
32
|
+
* whole diagnostic value, since a silent fallback otherwise looks like REST
|
|
33
|
+
* simply never being enabled.
|
|
34
|
+
*/
|
|
35
|
+
restFallback?: string;
|
|
17
36
|
}
|
|
37
|
+
/** How a device command was actually carried. */
|
|
38
|
+
type DeviceTransport = "ssh" | "rest" | "mac-telnet";
|
|
18
39
|
type SendLog = (level: "info" | "error", message: string) => void;
|
|
19
40
|
/**
|
|
20
41
|
* Execute a RouterOS command and return its raw text output.
|
|
@@ -75,6 +96,29 @@ interface DeviceDirectoryEntry {
|
|
|
75
96
|
* label, or if the device is disabled.
|
|
76
97
|
*/
|
|
77
98
|
declare function getDevice(name?: string): DeviceConfig;
|
|
99
|
+
/** Which wireless stack a device actually answers on. */
|
|
100
|
+
type WirelessStack = "wifi" | "wireless" | "capsman-legacy" | "none";
|
|
101
|
+
/**
|
|
102
|
+
* What a tool needs from the device. Every field is optional and ANDed; an
|
|
103
|
+
* absent `requires` means universally available, which is true of the large
|
|
104
|
+
* majority of the catalog.
|
|
105
|
+
*/
|
|
106
|
+
interface ToolRequires {
|
|
107
|
+
/** Inclusive lower bound, e.g. `"7.13"`. */
|
|
108
|
+
minVersion?: string;
|
|
109
|
+
/** Exclusive upper bound, for menus removed in a later release. */
|
|
110
|
+
maxVersion?: string;
|
|
111
|
+
/** Every named package must be installed AND enabled. */
|
|
112
|
+
packages?: string[];
|
|
113
|
+
/** The device must answer on one of these wireless stacks. */
|
|
114
|
+
wirelessStack?: WirelessStack | WirelessStack[];
|
|
115
|
+
/** Board-name test, e.g. `/^CRS3/` for a switch-chip-only menu. */
|
|
116
|
+
board?: RegExp;
|
|
117
|
+
/** A device-mode permission that must be granted. */
|
|
118
|
+
deviceMode?: "container" | "scheduler" | "fetch";
|
|
119
|
+
/** The device must be a RouterBOARD (excludes CHR and x86). */
|
|
120
|
+
routerBoard?: boolean;
|
|
121
|
+
}
|
|
78
122
|
/** Options threaded into every tool registration. */
|
|
79
123
|
interface RegisterOptions {
|
|
80
124
|
sendLog?: SendLog;
|
|
@@ -141,6 +185,17 @@ interface ToolDef<Shape extends ZodRawShape> {
|
|
|
141
185
|
* Use for server-introspection tools that never contact a RouterOS device.
|
|
142
186
|
*/
|
|
143
187
|
noDevice?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* What this tool needs from the device — a RouterOS version floor, a package,
|
|
190
|
+
* a wireless stack, a board, a device-mode permission.
|
|
191
|
+
*
|
|
192
|
+
* Omit it unless the tool genuinely cannot run everywhere; the large majority
|
|
193
|
+
* of the catalog is universal, and a spurious requirement hides a working tool.
|
|
194
|
+
* Declaring it does two things: the description is annotated when the device is
|
|
195
|
+
* known to be unsupported, and the call is guarded so an unsupported invocation
|
|
196
|
+
* returns a clear reason instead of a RouterOS parser error.
|
|
197
|
+
*/
|
|
198
|
+
requires?: ToolRequires;
|
|
144
199
|
/** Handler returning the result shown to the model (text, or text + structured data). */
|
|
145
200
|
handler: (args: any, ctx: ToolContext) => Promise<HandlerOutput> | HandlerOutput;
|
|
146
201
|
}
|
|
@@ -152,6 +207,8 @@ interface RegisterableTool {
|
|
|
152
207
|
description: string;
|
|
153
208
|
/** Present when the tool renders an MCP App view. */
|
|
154
209
|
ui?: UiLink;
|
|
210
|
+
/** Device requirements, if the tool declared any. */
|
|
211
|
+
requires?: ToolRequires;
|
|
155
212
|
/**
|
|
156
213
|
* The raw handler (pre-`device`-injection, pre-validation). Exposed so the
|
|
157
214
|
* tool-gateway dispatcher (`invoke_tool`) can run any tool by name through its
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
selectToolModules,
|
|
30
30
|
setConfig,
|
|
31
31
|
updateSummaryLine
|
|
32
|
-
} from "./shared/library-
|
|
32
|
+
} from "./shared/library-13dhfdnq.js";
|
|
33
33
|
// src/server.ts
|
|
34
34
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
35
35
|
import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|