Repository navigation
v1.17.0
Change safety: firewall writes revert themselves if they cut the router off, confirmation tokens and plans are tied to the state that was previewed, and every write says whether it was applied and whether it can be undone. SwOS Lite VLAN decoding and a guard on management-address writes come from @f0086's CSS610 lockout report.
Upgrading from 1.16. manage_firewall_rule real writes now add a /system scheduler job, so the router user needs write access to the scheduler; without it the call fails with AUTO_REVERT_ARM_FAILED and changes nothing. Pass autoRevertSeconds: 0 to write without the job, as before. write_swos_blob now refuses a real sys.b write that changes how the switch is reached unless includeManagement: true is passed. Confirmation tokens issued by an older version are refused as expired; request a new one.
Security
- A confirmation token now approves the state that was previewed, not just the request. The signed payload carries a fingerprint of the configuration under the tool's snapshot paths (dynamic records dropped unless the call acts on them, as
manage_dhcp_leasemake-static does; counters and status fields left out; record order kept), read when the token is issued and again when it is used. If someone edits, inserts or removes a record in that section in between, the call is refused withCONFIRMATION_STATE_CHANGED(categoryCONFLICT) and nothing is written; before, the old token still validated, so approving one preview could authorize a different diff.bulk_executefleet tokens bind every targeted router's state the same way (a router whose state cannot be read is skipped withSTATE_UNREADABLE, never written unpreviewed), and anapply_plantoken binds every step's paths. SwOS switches andset_system_clockare not covered (their state changes on its own). Tokens issued before upgrading are refused as expired; request a new one. - Confirmation tokens now carry a random nonce, so two identical requests in the same millisecond get distinct single-use tokens instead of one shared token the second caller finds already used.
Added
- Every real write response now carries a
rollbackfield saying whetherrollback_changecan undo it:{ available: true, journalId, snapshotted }after a snapshotted write, or{ available: false, reason, detail }withNO_SNAPSHOT(the tool takes no snapshot, asrun_commandnever does) orSNAPSHOT_FAILED; the text adds a "Not undoable with rollback_change" line. Before, a missingjournalIdcould mean either, so there was no way to tell whether an undo existed without trying it. Dry runs,plan_changes,apply_planandrollback_changeare left out. The Available-Tools page now lists the write tools that take no snapshot (#156). list_routersrows carryrosVersionSeenandrosVersionSeenAtonceget_system_statusorcheck_router_healthhas reached a RouterOS router: the version the router itself reported to this server, shown next to therosVersionfromrouters.yaml, which can lag an upgrade and is still what picks version-dependent REST paths. The observation is kept in memory only (absent after a restart), is dropped when the router'shostchanges, and is never set for SwOS switches (#152).- Every write-tool response now carries an
appliedboolean:truewhen the call ran its write path,falseon a dry run, which also leads its text withNOT APPLIED — dry run only. Pass dryRun: false to write this change.The verdict is injected centrally in the tool executor, so it covers every write tool (RouterOS and SwOS) uniformly — includingwrite_swos_blob, whosedryRundefaults totrue(preview first) and whose dry-run output could otherwise be mistaken for a write (#140).plan_changes, which previews writes without making them, reportsapplied: falseitself. plan_changesreturns aplanFingerprint(and astateFingerprintper step), andapply_plantakes it as an optionalplanFingerprintparameter. With it,apply_planchecks before the first step that the steps are the previewed ones (PLAN_MISMATCH) and that the configuration they touch is unchanged since the preview (PLAN_STATE_CHANGED), for every role — the drift check admins get, since they skip confirmation tokens.- Auto-revert for
manage_firewall_rule, a dead-man switch that stands in for RouterOS Safe Mode, which the REST API cannot use. Before a real write, MikroMCP adds amikromcp-autorevert-<id>scheduler job that undoes the change afterautoRevertSeconds(default 60;0turns it off): it removes an added rule, re-adds a removed one at its old position, or flipsdisabledback. The job's first run is set from the router's clock, because a scheduler entry with only anintervalfirst runs as soon as it is added. After the write, MikroMCP waits 3 seconds for the change to take effect (with connection tracking onauto, a CHR only starts tracking a moment after the first rule that needs it), then opens a new REST connection to the router. If the router answers, the job is removed; if it does not, the job stays, the router reverts itself, and the call fails withAUTO_REVERT_PENDING. The job's state is reported in the result'sautoRevert, in error details, and in the write journal's outcome entry, including formanage_firewall_rulesteps inapply_plan. Dry runs,already_existsandno_changearm nothing.
Changed
- The HTTP rate limit now says what it is. Every response on
/mcp,/sseand/messagescarriesRateLimit-Limit,RateLimit-RemainingandRateLimit-Reset; a429adds aRetry-Afterheader with the seconds left in the window (it used to say "retry after 60 seconds" whatever was left), and its JSON body now names the limit (limit,retryAfterSeconds) and ahint: raiseMIKROMCP_HTTP_RATE_LIMIT_RPM(0turns it off), send one filtered query instead of many, or usebulk_readfor many routers. No headers are sent when the limit is off. The limit itself is unchanged (60 requests per 60 seconds per client IP) and is now described in the Running and Configuration pages (#148). run_commandwithdryRun: truenow says what it checked: the result carriesvalidated: "policy"andsyntaxChecked: false, and its text states that only the allow/deny policy was checked, not the syntax, the names the command refers to or what a[find ...]matches. Before, the response gave no hint, so a dry run that passed read as "this will work"; a command with an unquoted port name containing brackets passes it and may do nothing when run. ThedryRundescription and the Available-Tools entry say the same (#154).write_swos_blobrefuses a real write tosys.bthat changes how the switch is reached (ip,static_ip,addr_acq,allow_from_ip,allow_from_mask,allow_from_vlan,allow_from_ports) withSWOS_MANAGEMENT_CHANGE_REFUSEDunless the newincludeManagementparameter istrue, the gateapply_swos_configalready had. A dry run previews it without the flag. The preview and the write returnwarnings:static_ipandaddr_acqare stored configuration that left the live address unchanged on SwOS Lite 2.21 (only writingipmoved it), and anallow_from_*change cuts off any session that does not match it, the writing one included.list_swos_endpointsnow returns anotesentry per field that has one, such asip(live) versusstatic_ip(stored). Calls that write these fields for real needincludeManagement: truefrom now on (#142).manage_firewall_rulenow needs write access to/system schedulerfor real writes: if the auto-revert job cannot be added, the call fails withAUTO_REVERT_ARM_FAILEDand changes nothing. PassautoRevertSeconds: 0to write without the job, as before.
Fixed
manage_dhcp_leasewithaction: "make-static"now converts the lease. It used to patch the lease'sdynamicflag, which RouterOS treats as read-only, so every real call failed with HTTP 400 "unknown parameter dynamic" and left the lease dynamic (the dry run looked fine). It now runs RouterOS'smake-staticcommand on the lease (POST ip/dhcp-server/lease/make-staticwith its.id) (#158).get_swos_endpointnow decodesvlan.bon SwOS Lite: each row givesvid,members(one flag per port) andigmp(IGMP snooping) instead of only raw keys. The layout (i01= VLAN ID,i02= member ports,i03= IGMP snooping) was matched against the web UI on one CSS610 running SwOS Lite 2.21. Reading the table also makes the lockout analysis inapply_swos_configsee the real VLAN membership on SwOS Lite. Writing the VLAN table on SwOS Lite is still unsupported (#146).rebootwith adelayabove 0 now pins themikromcp-rebootscheduler entry's first run instead of leaving it to the router: the entry had only aninterval, and RouterOS documents a new entry'sstart-date/start-timeas defaulting to the moment it is added (RouterOS 7.23 then runs it one interval later, but that placement is not documented).start-date/start-timeare now set from the router clock plusdelay(ISO andmmm/dd/yyyydate formats) and returned asstartDate/startTime. If the clock cannot be read, the call fails withREBOOT_CLOCK_UNREADABLEand leaves any pending delayed reboot in place.