@usex/mikrotik-mcp 4.23.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.
Files changed (81) hide show
  1. package/README.md +350 -284
  2. package/dist/cli.js +1870 -566
  3. package/dist/index.d.ts +57 -0
  4. package/dist/index.js +1 -1
  5. package/dist/shared/{library-2144zr9f.js → cli-2dj736ma.js} +33920 -22075
  6. package/dist/shared/{cli-p673815b.js → cli-vvy7yfyg.js} +1 -1
  7. package/dist/shared/{cli-tssmr7sb.js → library-13dhfdnq.js} +29455 -18578
  8. package/dist/shared/{library-8f4pbp0x.js → library-syt5fmtj.js} +1 -1
  9. package/dist/ui/aaa.html +1 -1
  10. package/dist/ui/connected-devices.html +1 -1
  11. package/dist/ui/dashboard.html +1 -1
  12. package/dist/ui/firewall-audit.html +1 -1
  13. package/dist/ui/firewall.html +1 -1
  14. package/dist/ui/interfaces.html +1 -1
  15. package/dist/ui/observability.html +70 -62
  16. package/dist/ui/records.html +1 -1
  17. package/package.json +12 -11
  18. package/policies/baseline.yaml +180 -0
  19. package/prompts/backup-and-document.md +28 -18
  20. package/prompts/build-tunnel-transactionally.md +74 -0
  21. package/prompts/fleet-rollout.md +68 -0
  22. package/prompts/setup-traffic-flow.md +68 -0
  23. package/schemas/README.md +1 -1
  24. package/schemas/config.schema.json +367 -4
  25. package/schemas/tool-catalog.json +3044 -1152
  26. package/schemas/tools/abort_rollout.json +17 -0
  27. package/schemas/tools/abort_transaction.json +17 -0
  28. package/schemas/tools/add_alert_rule.json +45 -0
  29. package/schemas/tools/add_ipv6_route.json +1 -1
  30. package/schemas/tools/add_route.json +3 -2
  31. package/schemas/tools/add_schedule.json +50 -0
  32. package/schemas/tools/add_script.json +1 -1
  33. package/schemas/tools/add_traffic_flow_target.json +36 -0
  34. package/schemas/tools/add_transaction_step.json +21 -0
  35. package/schemas/tools/analyze_flows.json +25 -0
  36. package/schemas/tools/begin_transaction.json +109 -0
  37. package/schemas/tools/block_attacker.json +22 -0
  38. package/schemas/tools/check_policy_snapshot.json +20 -0
  39. package/schemas/tools/commit_transaction.json +13 -0
  40. package/schemas/tools/configure_attack_response.json +12 -0
  41. package/schemas/tools/diff_explanations.json +24 -0
  42. package/schemas/tools/explain_device.json +22 -0
  43. package/schemas/tools/explain_policy_finding.json +17 -0
  44. package/schemas/tools/explain_rule_reachability.json +18 -0
  45. package/schemas/tools/explain_section.json +32 -0
  46. package/schemas/tools/export_policy_report.json +22 -0
  47. package/schemas/tools/flow_top_talkers.json +31 -0
  48. package/schemas/tools/get_alert_history.json +26 -0
  49. package/schemas/tools/get_attack_incident.json +13 -0
  50. package/schemas/tools/get_audit_timeline.json +24 -0
  51. package/schemas/tools/get_device_capabilities.json +7 -0
  52. package/schemas/tools/get_traffic_flow_settings.json +7 -0
  53. package/schemas/tools/list_alert_rules.json +7 -0
  54. package/schemas/tools/list_attack_incidents.json +27 -0
  55. package/schemas/tools/list_attack_responses.json +20 -0
  56. package/schemas/tools/list_policies.json +17 -0
  57. package/schemas/tools/list_schedules.json +12 -0
  58. package/schemas/tools/list_traffic_flow_targets.json +7 -0
  59. package/schemas/tools/mute_alert_rule.json +18 -0
  60. package/schemas/tools/plan_rollout.json +95 -0
  61. package/schemas/tools/refresh_device_capabilities.json +7 -0
  62. package/schemas/tools/remove_alert_rule.json +13 -0
  63. package/schemas/tools/remove_schedule.json +13 -0
  64. package/schemas/tools/remove_traffic_flow_target.json +13 -0
  65. package/schemas/tools/rollout_status.json +12 -0
  66. package/schemas/tools/run_policy_check.json +12 -0
  67. package/schemas/tools/run_schedule_now.json +13 -0
  68. package/schemas/tools/scan_for_attacks.json +21 -0
  69. package/schemas/tools/set_traffic_flow_settings.json +28 -0
  70. package/schemas/tools/simulate_change.json +72 -0
  71. package/schemas/tools/simulate_packet.json +53 -0
  72. package/schemas/tools/simulate_suite.json +71 -0
  73. package/schemas/tools/start_flow_collector.json +14 -0
  74. package/schemas/tools/start_rollout.json +98 -0
  75. package/schemas/tools/stop_flow_collector.json +7 -0
  76. package/schemas/tools/test_alert_channel.json +14 -0
  77. package/schemas/tools/unblock_attacker.json +20 -0
  78. package/schemas/tools/update_alert_rule.json +41 -0
  79. package/schemas/tools/update_route.json +3 -2
  80. package/schemas/tools/validate_policy_file.json +16 -0
  81. 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-2144zr9f.js";
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";