@usex/mikrotik-mcp 3.11.0 → 3.13.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 +18 -10
- package/dist/index.js +18 -10
- package/package.json +1 -1
- package/prompts/safe-change-workflow.md +47 -0
package/dist/cli.js
CHANGED
|
@@ -3686,7 +3686,7 @@ var changePlanTools = [
|
|
|
3686
3686
|
name: "plan_changes",
|
|
3687
3687
|
title: "Plan RouterOS Changes (Dry-Run Preview)",
|
|
3688
3688
|
annotations: READ,
|
|
3689
|
-
description: "Parses a set of intended RouterOS CLI commands locally \u2014 without contacting the device \u2014 " + "and returns a risk-scored, lock-out-aware execution plan. Classifies each command as " + "ADD/MODIFY/REMOVE/OTHER, calculates an overall risk score, emits warnings when commands would " + "drop input-chain traffic or remove the management IP, and reorders steps into the safest " + "sequence (additive changes before destructive ones). Use this to understand what will " + "happen before committing; to execute the plan use apply_plan. Provide commands as an " + "array via `commands`, as a newline-delimited string via `script`, or both \u2014 they are " + "merged. Returns a human-readable plan text and a structured plan object with per-step details.",
|
|
3689
|
+
description: "Parses a set of intended RouterOS CLI commands locally \u2014 without contacting the device \u2014 " + "and returns a risk-scored, lock-out-aware execution plan. Classifies each command as " + "ADD/MODIFY/REMOVE/OTHER, calculates an overall risk score, emits warnings when commands would " + "drop input-chain traffic or remove the management IP, and reorders steps into the safest " + "sequence (additive changes before destructive ones). Use this to understand what will " + "happen before committing; to execute the plan use apply_plan. Provide commands as an " + "array via `commands`, as a newline-delimited string via `script`, or both \u2014 they are " + "merged. Before planning a change, FIRST call capture_config_snapshot to take a restore " + "point \u2014 it stores a local `/export` on the MCP host (~/.mikrotik-mcp/snapshots.db) with " + "zero footprint on the device's disk (no file is written to the router). " + "Returns a human-readable plan text and a structured plan object with per-step details.",
|
|
3690
3690
|
inputSchema: {
|
|
3691
3691
|
commands: z10.array(z10.string()).optional().describe("Intended RouterOS CLI commands."),
|
|
3692
3692
|
script: z10.string().optional().describe("Newline-delimited commands (alternative to `commands`).")
|
|
@@ -3706,7 +3706,7 @@ var changePlanTools = [
|
|
|
3706
3706
|
name: "apply_plan",
|
|
3707
3707
|
title: "Apply RouterOS Change Plan in Safe Mode",
|
|
3708
3708
|
annotations: DANGEROUS,
|
|
3709
|
-
description: "Executes intended RouterOS commands inside RouterOS Safe Mode (activated by Ctrl+X over " + "an interactive SSH shell) and reports the exact unified diff of what changed, computed " + "from `/export terse` snapshots captured before and after execution. With confirm=false " + "(default) it applies all steps, captures the diff, then rolls everything back \u2014 a true " + "dry-run that shows precisely what would change without persisting anything. With " + "confirm=true it commits permanently, but ONLY after verifying the device still responds " + "to `/system identity print` \u2014 a change that would lock you out auto-reverts instead of " + "sticking. Steps execute in the same safe order that plan_changes computes (additive before " + "destructive); if any step returns a RouterOS error the entire plan rolls back immediately. " + "Safe Mode requires SSH \u2014 not available on MAC-Telnet devices. For a no-device preview " + "use plan_changes instead. Returns the plan summary, per-step execution log, unified diff,
|
|
3709
|
+
description: "Executes intended RouterOS commands inside RouterOS Safe Mode (activated by Ctrl+X over " + "an interactive SSH shell) and reports the exact unified diff of what changed, computed " + "from `/export terse` snapshots captured before and after execution. With confirm=false " + "(default) it applies all steps, captures the diff, then rolls everything back \u2014 a true " + "dry-run that shows precisely what would change without persisting anything. With " + "confirm=true it commits permanently, but ONLY after verifying the device still responds " + "to `/system identity print` \u2014 a change that would lock you out auto-reverts instead of " + "sticking. Steps execute in the same safe order that plan_changes computes (additive before " + "destructive); if any step returns a RouterOS error the entire plan rolls back immediately. " + "Safe Mode requires SSH \u2014 not available on MAC-Telnet devices. For a no-device preview " + "use plan_changes instead. ALWAYS call capture_config_snapshot BEFORE this tool to record " + "a restore point \u2014 it stores a local `/export` on the MCP host (~/.mikrotik-mcp/snapshots.db), " + "adding no load to the device's disk and leaving nothing to remove on the router; after the " + "change, diff_config_snapshots (from=latest, to=live) confirms what changed. Returns the " + "plan summary, per-step execution log, unified diff, and commit/rollback outcome.",
|
|
3710
3710
|
inputSchema: {
|
|
3711
3711
|
commands: z10.array(z10.string()).optional(),
|
|
3712
3712
|
script: z10.string().optional(),
|
|
@@ -23304,7 +23304,7 @@ function registerPrompts(server) {
|
|
|
23304
23304
|
// package.json
|
|
23305
23305
|
var package_default = {
|
|
23306
23306
|
name: "@usex/mikrotik-mcp",
|
|
23307
|
-
version: "3.
|
|
23307
|
+
version: "3.13.0",
|
|
23308
23308
|
description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
|
|
23309
23309
|
keywords: [
|
|
23310
23310
|
"ai",
|
|
@@ -23456,7 +23456,20 @@ Safety model \u2014 tools are annotated by risk:
|
|
|
23456
23456
|
Before a batch of risky changes, consider enable_safe_mode: RouterOS then holds
|
|
23457
23457
|
every change in memory and auto-reverts if the session drops, so a mistake that
|
|
23458
23458
|
locks you out is undone automatically. commit_safe_mode persists; rollback
|
|
23459
|
-
discards. Prefer specific filters on list_* tools to keep output small
|
|
23459
|
+
discards. Prefer specific filters on list_* tools to keep output small.
|
|
23460
|
+
|
|
23461
|
+
Change workflow \u2014 ALWAYS take a restore point before a plan. Before calling
|
|
23462
|
+
plan_changes or apply_plan (or any batch of write/destructive tools), first call
|
|
23463
|
+
capture_config_snapshot to record the current configuration. These snapshots are
|
|
23464
|
+
captured with \`/export\` (a read-only print \u2014 it does NOT create a file on the
|
|
23465
|
+
router) and persisted to the MCP host's local database (~/.mikrotik-mcp/
|
|
23466
|
+
snapshots.db), so they add ZERO load to the MikroTik device's disk and leave
|
|
23467
|
+
nothing to clean up on the device. They survive device reboots/resets. After a
|
|
23468
|
+
change, use diff_config_snapshots (from=latest, to=live) to confirm exactly what
|
|
23469
|
+
changed, and if something is wrong, get_config_snapshot returns the prior
|
|
23470
|
+
\`/export\` text to restore from. Do NOT use create_backup/create_export for this
|
|
23471
|
+
pre-change restore point \u2014 those write files to the device's flash; prefer the
|
|
23472
|
+
local snapshot to keep the device's disk clean.`;
|
|
23460
23473
|
var MULTI_DEVICE_INSTRUCTIONS = `
|
|
23461
23474
|
|
|
23462
23475
|
Multiple devices are configured: {{names}} (default: {{default}}). Every tool
|
|
@@ -23483,12 +23496,7 @@ function createServer(opts = {}) {
|
|
|
23483
23496
|
}
|
|
23484
23497
|
]
|
|
23485
23498
|
}, {
|
|
23486
|
-
capabilities: {
|
|
23487
|
-
tools: { listChanged: true },
|
|
23488
|
-
prompts: { listChanged: true },
|
|
23489
|
-
resources: { listChanged: true },
|
|
23490
|
-
logging: {}
|
|
23491
|
-
},
|
|
23499
|
+
capabilities: {},
|
|
23492
23500
|
instructions
|
|
23493
23501
|
});
|
|
23494
23502
|
const sendLog = opts.sendLog ?? ((level, message) => {
|
package/dist/index.js
CHANGED
|
@@ -3698,7 +3698,7 @@ var changePlanTools = [
|
|
|
3698
3698
|
name: "plan_changes",
|
|
3699
3699
|
title: "Plan RouterOS Changes (Dry-Run Preview)",
|
|
3700
3700
|
annotations: READ,
|
|
3701
|
-
description: "Parses a set of intended RouterOS CLI commands locally \u2014 without contacting the device \u2014 " + "and returns a risk-scored, lock-out-aware execution plan. Classifies each command as " + "ADD/MODIFY/REMOVE/OTHER, calculates an overall risk score, emits warnings when commands would " + "drop input-chain traffic or remove the management IP, and reorders steps into the safest " + "sequence (additive changes before destructive ones). Use this to understand what will " + "happen before committing; to execute the plan use apply_plan. Provide commands as an " + "array via `commands`, as a newline-delimited string via `script`, or both \u2014 they are " + "merged. Returns a human-readable plan text and a structured plan object with per-step details.",
|
|
3701
|
+
description: "Parses a set of intended RouterOS CLI commands locally \u2014 without contacting the device \u2014 " + "and returns a risk-scored, lock-out-aware execution plan. Classifies each command as " + "ADD/MODIFY/REMOVE/OTHER, calculates an overall risk score, emits warnings when commands would " + "drop input-chain traffic or remove the management IP, and reorders steps into the safest " + "sequence (additive changes before destructive ones). Use this to understand what will " + "happen before committing; to execute the plan use apply_plan. Provide commands as an " + "array via `commands`, as a newline-delimited string via `script`, or both \u2014 they are " + "merged. Before planning a change, FIRST call capture_config_snapshot to take a restore " + "point \u2014 it stores a local `/export` on the MCP host (~/.mikrotik-mcp/snapshots.db) with " + "zero footprint on the device's disk (no file is written to the router). " + "Returns a human-readable plan text and a structured plan object with per-step details.",
|
|
3702
3702
|
inputSchema: {
|
|
3703
3703
|
commands: z11.array(z11.string()).optional().describe("Intended RouterOS CLI commands."),
|
|
3704
3704
|
script: z11.string().optional().describe("Newline-delimited commands (alternative to `commands`).")
|
|
@@ -3718,7 +3718,7 @@ var changePlanTools = [
|
|
|
3718
3718
|
name: "apply_plan",
|
|
3719
3719
|
title: "Apply RouterOS Change Plan in Safe Mode",
|
|
3720
3720
|
annotations: DANGEROUS,
|
|
3721
|
-
description: "Executes intended RouterOS commands inside RouterOS Safe Mode (activated by Ctrl+X over " + "an interactive SSH shell) and reports the exact unified diff of what changed, computed " + "from `/export terse` snapshots captured before and after execution. With confirm=false " + "(default) it applies all steps, captures the diff, then rolls everything back \u2014 a true " + "dry-run that shows precisely what would change without persisting anything. With " + "confirm=true it commits permanently, but ONLY after verifying the device still responds " + "to `/system identity print` \u2014 a change that would lock you out auto-reverts instead of " + "sticking. Steps execute in the same safe order that plan_changes computes (additive before " + "destructive); if any step returns a RouterOS error the entire plan rolls back immediately. " + "Safe Mode requires SSH \u2014 not available on MAC-Telnet devices. For a no-device preview " + "use plan_changes instead. Returns the plan summary, per-step execution log, unified diff,
|
|
3721
|
+
description: "Executes intended RouterOS commands inside RouterOS Safe Mode (activated by Ctrl+X over " + "an interactive SSH shell) and reports the exact unified diff of what changed, computed " + "from `/export terse` snapshots captured before and after execution. With confirm=false " + "(default) it applies all steps, captures the diff, then rolls everything back \u2014 a true " + "dry-run that shows precisely what would change without persisting anything. With " + "confirm=true it commits permanently, but ONLY after verifying the device still responds " + "to `/system identity print` \u2014 a change that would lock you out auto-reverts instead of " + "sticking. Steps execute in the same safe order that plan_changes computes (additive before " + "destructive); if any step returns a RouterOS error the entire plan rolls back immediately. " + "Safe Mode requires SSH \u2014 not available on MAC-Telnet devices. For a no-device preview " + "use plan_changes instead. ALWAYS call capture_config_snapshot BEFORE this tool to record " + "a restore point \u2014 it stores a local `/export` on the MCP host (~/.mikrotik-mcp/snapshots.db), " + "adding no load to the device's disk and leaving nothing to remove on the router; after the " + "change, diff_config_snapshots (from=latest, to=live) confirms what changed. Returns the " + "plan summary, per-step execution log, unified diff, and commit/rollback outcome.",
|
|
3722
3722
|
inputSchema: {
|
|
3723
3723
|
commands: z11.array(z11.string()).optional(),
|
|
3724
3724
|
script: z11.string().optional(),
|
|
@@ -21707,7 +21707,7 @@ function selectToolModules(filter = {}, catalog = moduleCatalog) {
|
|
|
21707
21707
|
// package.json
|
|
21708
21708
|
var package_default = {
|
|
21709
21709
|
name: "@usex/mikrotik-mcp",
|
|
21710
|
-
version: "3.
|
|
21710
|
+
version: "3.13.0",
|
|
21711
21711
|
description: "MCP server for MikroTik RouterOS \u2014 660+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
|
|
21712
21712
|
keywords: [
|
|
21713
21713
|
"ai",
|
|
@@ -21859,7 +21859,20 @@ Safety model \u2014 tools are annotated by risk:
|
|
|
21859
21859
|
Before a batch of risky changes, consider enable_safe_mode: RouterOS then holds
|
|
21860
21860
|
every change in memory and auto-reverts if the session drops, so a mistake that
|
|
21861
21861
|
locks you out is undone automatically. commit_safe_mode persists; rollback
|
|
21862
|
-
discards. Prefer specific filters on list_* tools to keep output small
|
|
21862
|
+
discards. Prefer specific filters on list_* tools to keep output small.
|
|
21863
|
+
|
|
21864
|
+
Change workflow \u2014 ALWAYS take a restore point before a plan. Before calling
|
|
21865
|
+
plan_changes or apply_plan (or any batch of write/destructive tools), first call
|
|
21866
|
+
capture_config_snapshot to record the current configuration. These snapshots are
|
|
21867
|
+
captured with \`/export\` (a read-only print \u2014 it does NOT create a file on the
|
|
21868
|
+
router) and persisted to the MCP host's local database (~/.mikrotik-mcp/
|
|
21869
|
+
snapshots.db), so they add ZERO load to the MikroTik device's disk and leave
|
|
21870
|
+
nothing to clean up on the device. They survive device reboots/resets. After a
|
|
21871
|
+
change, use diff_config_snapshots (from=latest, to=live) to confirm exactly what
|
|
21872
|
+
changed, and if something is wrong, get_config_snapshot returns the prior
|
|
21873
|
+
\`/export\` text to restore from. Do NOT use create_backup/create_export for this
|
|
21874
|
+
pre-change restore point \u2014 those write files to the device's flash; prefer the
|
|
21875
|
+
local snapshot to keep the device's disk clean.`;
|
|
21863
21876
|
var MULTI_DEVICE_INSTRUCTIONS = `
|
|
21864
21877
|
|
|
21865
21878
|
Multiple devices are configured: {{names}} (default: {{default}}). Every tool
|
|
@@ -21886,12 +21899,7 @@ function createServer(opts = {}) {
|
|
|
21886
21899
|
}
|
|
21887
21900
|
]
|
|
21888
21901
|
}, {
|
|
21889
|
-
capabilities: {
|
|
21890
|
-
tools: { listChanged: true },
|
|
21891
|
-
prompts: { listChanged: true },
|
|
21892
|
-
resources: { listChanged: true },
|
|
21893
|
-
logging: {}
|
|
21894
|
-
},
|
|
21902
|
+
capabilities: {},
|
|
21895
21903
|
instructions
|
|
21896
21904
|
});
|
|
21897
21905
|
const sendLog = opts.sendLog ?? ((level, message) => {
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: safe-change-workflow
|
|
3
|
+
title: Safe change workflow (snapshot → plan → verify)
|
|
4
|
+
description: Take a local restore point, dry-run a change, apply it safely, and confirm exactly what changed — with zero footprint on the device's disk.
|
|
5
|
+
arguments:
|
|
6
|
+
- name: intent
|
|
7
|
+
description: What you want to change, in plain language (e.g. "add a drop rule for inbound WAN on ether1").
|
|
8
|
+
required: false
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Make a configuration change to this MikroTik device **safely and reversibly**.
|
|
12
|
+
Follow these steps in order — never skip the snapshot.
|
|
13
|
+
|
|
14
|
+
**Goal:** {{intent}}
|
|
15
|
+
|
|
16
|
+
1. **Take a restore point FIRST (local, no device disk).**
|
|
17
|
+
Call `capture_config_snapshot` before doing anything else. This runs a
|
|
18
|
+
read-only `/export` and stores it in the MCP host's local database
|
|
19
|
+
(`~/.mikrotik-mcp/snapshots.db`). It does **not** create a file on the
|
|
20
|
+
router — there is zero load on the MikroTik device's flash and nothing to
|
|
21
|
+
clean up on the device afterwards. Give it a descriptive `label` (e.g.
|
|
22
|
+
`pre-<change>`). Do **not** use `create_backup` / `create_export` for this —
|
|
23
|
+
those write files to the device's disk; the local snapshot keeps the router
|
|
24
|
+
clean.
|
|
25
|
+
|
|
26
|
+
2. **Dry-run the change.** Translate the intent into RouterOS CLI commands and
|
|
27
|
+
call `plan_changes` to get a risk-scored, lock-out-aware, safely-ordered plan
|
|
28
|
+
without touching the device. Review the warnings (input-chain drops, removal
|
|
29
|
+
of the management IP, etc.).
|
|
30
|
+
|
|
31
|
+
3. **Apply in Safe Mode.** Call `apply_plan` with `confirm=false` first — it
|
|
32
|
+
applies every step inside RouterOS Safe Mode, shows the exact before/after
|
|
33
|
+
diff, then rolls everything back (a true dry-run on the live device). When the
|
|
34
|
+
diff looks right, re-run with `confirm=true` to commit; it only persists if
|
|
35
|
+
the device is still reachable, so a change that would lock you out
|
|
36
|
+
auto-reverts.
|
|
37
|
+
|
|
38
|
+
4. **Verify what changed.** After committing, call `diff_config_snapshots` with
|
|
39
|
+
`from=latest` and `to=live` to confirm the live device matches your intent and
|
|
40
|
+
nothing unexpected drifted.
|
|
41
|
+
|
|
42
|
+
5. **If something is wrong**, read the pre-change snapshot body with
|
|
43
|
+
`get_config_snapshot` (it returns the full `/export` `.rsc` text) and use it to
|
|
44
|
+
reverse the change.
|
|
45
|
+
|
|
46
|
+
Report: the snapshot id you captured, the plan summary, the committed diff, and
|
|
47
|
+
the post-change verification result.
|