Repository navigation
IPv6, the IPv4 and IPv6 raw and firewall tables, rule reordering, and bridge VLAN filtering close the largest gaps in RouterOS coverage (133 → 140 tools). MikroMCP can now run from three environment variables without a routers.yaml, reload routers.yaml and identities.yaml without a restart, and register a read-only or per-area tool catalogue that fits small context windows. The HTTP transport checks Host, Origin and client IP before authentication. reload_config and the SwOS read-back after a management-address change come from @f0086.
Upgrading from 1.17. HTTP: An HTTP server bound to a loopback address (the default 127.0.0.1) now answers only the Host names localhost, 127.0.0.1 and [::1], and refuses browser requests from other origins. A client that reaches a loopback-bound server under another name (an SSH tunnel with a custom host alias, for example) needs that name in MIKROMCP_HTTP_ALLOWED_HOSTS. Servers bound elsewhere behave as before unless the new lists are set. Tools: manage_firewall_rule without chain or ruleAction (and manage_mangle_rule without comment) now fails with PARAM_REQUIRED rather than a schema error, and manage_firewall_rule snapshots and binds confirmation tokens only to the table and family it touches. manage_bridge create on an existing bridge whose vlan-filtering differs from a passed vlanFiltering returns CONFLICT, and manage_bridge_port add of an existing port with different PVID or frame settings does the same. Over stdio, the MIKROMCP_STDIO_IDENTITY identity is looked up on every call, so a removed identity fails calls with STDIO_IDENTITY_NOT_FOUND.
Added
MIKROMCP_READ_ONLY=trueregisters only read-only tools, so no client of that server can call a write tool, andtools/listdrops from about 150 KB to about 55 KB of JSON.MIKROMCP_TOOLSETS(e.g.firewall,dhcp) registers only the named toolsets pluslist_routersandcheck_router_health. A single toolset is around 13 KB, small enough for local models with short context windows. An unknown toolset name stops the server at startup with the valid names. The server instructions say when the catalogue is reduced. Toolset names are on the Configuration page.- In HTTP mode,
tools/listleaves out the tools a caller's identity may not call under itsallowedToolPatterns. Calls to hidden tools are still refused by the executor, as before. - MikroMCP runs without a
routers.yaml. With one router, setMIKROMCP_ROUTER_HOST,MIKROMCP_ROUTER_USERandMIKROMCP_ROUTER_PASSin the MCP client'senvblock and runnpx -y mikromcp: the server builds a router with iddefault(orMIKROMCP_ROUTER_ID), HTTPS on port 443 with the certificate verified, and RouterOS 7. OptionalMIKROMCP_ROUTER_PORT,MIKROMCP_ROUTER_TLS(falsefor plain HTTP, port 80),MIKROMCP_ROUTER_TLS_FINGERPRINT,MIKROMCP_ROUTER_TLS_INSECURE,MIKROMCP_ROUTER_ROS_VERSIONandMIKROMCP_ROUTER_TAGSchange the rest.MIKROMCP_ROUTERStakes a whole registry inline as YAML or JSON in therouters.yamlshape, validated the same way. Routers come from one source, in this order:MIKROMCP_ROUTERS, then the config file, then theMIKROMCP_ROUTER_*variables. If a lower source is also set, the server logs a warning that names it, andmikromcp doctorreports which source it used. A bad value fails at startup with an error that names the variable and never shows its value. manage_firewall_ruleandmanage_mangle_ruletakeaction: "move"withruleId(a rule.id) anddestination(the.idof the rule to place it before, orend), so a rule can be reordered withoutrun_command. It runs RouterOSmove, returnsno_changewhen the first static rule after it is alreadydestination(or, forend, none follows), refuses dynamic rules as the rule or the destination (DYNAMIC_RULE_NOT_MOVABLE), and reports the old and newposition, also on a dry run. A real firewall move is guarded by the auto-revert job like every other firewall write: its newmove-backrevert moves the rule back before the static rule that followed it, or to the end if it was last.- IPv6 core: four tools.
list_ipv6_addressesandmanage_ipv6_address(/ipv6/address) list and add, update or remove static IPv6 addresses, including EUI-64 addresses (eui64: true,addressis the prefix) and addresses built from a DHCPv6 prefix-delegation pool (fromPool,addressis the suffix such as::1/64), withadvertiseandnoDad. Writes are idempotent by address and interface, compared in canonical form, so2001:DB8:0::1/64and2001:db8::1/64are the same address; an EUI-64 address is matched by its prefix and a pool address by its suffix, and an address read back from the list can be updated or removed as printed. Dynamic (link-local, SLAAC, DHCPv6) addresses are refused withIPV6_ADDRESS_DYNAMIC.list_ipv6_neighbors(/ipv6/neighbor) andlist_dhcpv6_clients(/ipv6/dhcp-client, including the delegated prefix and the pool it fills) are read-only.rollback_changematches/ipv6/addressand/ipv6/routerecords by address and interface, and by destination, gateway and table. list_bridge_vlanstool — lists the bridge VLAN table (/interface/bridge/vlan): bridge,vlan-ids, configuredtagged/untaggedports, thecurrent-tagged/current-untaggedports RouterOS applies, and whether an entry is dynamic. Filters by bridge and by a VLAN id, matched inside ranges and lists.manage_bridge_vlantool — adds, updates or removes a bridge VLAN entry.vlanIdstakes a VLAN id, a range (100-110) or a comma list; it is idempotent by bridge + VLAN set (10,20equals20,10,100-102equals100,101,102) with port lists compared order-insensitively.addreturnsalready_existsfor an equal entry andCONFLICTwhen the entry has different ports or overlaps another static entry;updatereturnsno_changewhen nothing differs;update/removereturnNOT_FOUNDfor a missing entry. Dynamic entries are refused, a port both tagged and untagged is rejected, and results warn when the bridge has vlan-filtering off (no effect yet) or a change drops the bridge itself from a VLAN while filtering is on.reload_configtool andSIGHUPhandler: re-readrouters.yamlandidentities.yamlwithout restarting the server, so a changed routerhostno longer drops the MCP connection. The result lists the router and identity ids that were added, removed or changed, with the changed field names but never values. Both files are validated first; if either is invalid, or one that was loaded at startup has been deleted, nothing changes and the error names the problem. Pooled connections and circuit breakers of changed or removed routers are dropped, and cached identity tokens are cleared so a revoked or rotated token stops working at once. In HTTP mode a file withreadonlyoroperatoridentities is refused withoutMIKROMCP_CONFIRMATION_SECRET, as at startup. The tool needs anadminorsuperadminidentity and takesdryRun; environment variables and the HTTP port are not reloaded. Over stdio, the identity named byMIKROMCP_STDIO_IDENTITYis looked up on every call, so a reload that demotes or removes it takes effect in the running session (a removed one fails every call withSTDIO_IDENTITY_NOT_FOUND) (#150).
Changed
list_firewall_rulesandmanage_firewall_ruleaccepttable: "raw"and afamilyparameter (ip, the default, oripv6), so the IPv4 and IPv6 filter, nat and raw tables are all reachable (ip/firewall/raw,ipv6/firewall/{filter,nat,raw}). The auto-revert job runs in the menu of the table the call used (/ipv6 firewall raw, ...).protocolacceptsicmpv6, for IPv6 only;icmpon an IPv6 rule is refused withPROTOCOL_FAMILY_MISMATCH.manage_firewall_ruletakesjumpTarget(jump-target, required withruleAction: "jump"and refused otherwise) andrejectWith(reject-with,ruleAction: "reject"only, with the replies of the rule's family). Both are part of the repeated-add comparison; an omittedrejectWithand the family default count as the same.chainandruleActionare now checked by the handler instead of the schema, so a missing one fails withPARAM_REQUIRED(still before any router call) andmovecan go without them.list_mangle_rules,manage_mangle_rule,list_address_list_entriesandmanage_address_list_entrytakefamily(iporipv6) foripv6/firewall/mangleandipv6/firewall/address-list.manage_mangle_rule'scommentis required by the handler (PARAM_REQUIRED) for every action exceptmove.manage_firewall_rulesnapshots, and binds confirmation tokens to, only the table and family the call touches, instead of alwaysip/firewall/filterandip/firewall/nat;manage_mangle_ruleandmanage_address_list_entryfollowfamilythe same way. The rollback diff treats the raw and IPv6 firewall tables like their IPv4 counterparts (comment as key, order not restored).list_routesandmanage_routetakefamily: "ip" | "ipv6"(defaultip, unchanged behaviour);ipv6works on/ipv6/route, andmanage_routesnapshots that path. Withipv6, the destination must be IPv6 (a plain address becomes/128) and is compared in canonical form; the gateway may be a global address, a link-local address with its interface (fe80::1%ether1; a bare link-local gateway is refused) or an interface name. Mixing families (an IPv6 destination or gateway withfamily: ip, or an IPv4 one withipv6) is refused withROUTE_FAMILY_MISMATCH.manage_bridgegains actionupdateand avlanFilteringparameter (also accepted oncreate). Enabling VLAN filtering is the classic management lock-out, so the dry run and the result of anupdatethat turns it on carrywarnings: a general lock-out warning, plus gaps found in the current setup (no static bridge VLAN entries, a VLAN interface on the bridge whose VLAN does not list the bridge as tagged, ports whose PVID does not reach an address on the bridge).disabledno longer defaults tofalsein the schema:createstill creates an enabled bridge when it is omitted, andupdateleaves it unchanged.manage_bridge_portgains actionupdateand the port settingspvid,frameTypesandingressFiltering(also accepted onadd).updatereturnsno_changewhen nothing differs andNOT_FOUNDwhen the interface is not a port of that bridge;addof an existing port returnsCONFLICTwhen a given setting differs. Without the new parameters,addandremovebehave as before.
Fixed
docker-compose.example.ymlnow setsMIKROMCP_BIND_HOST: 0.0.0.0. Without it the server inside the container listened on127.0.0.1, which the published port cannot reach, so the example compose file never answered.write_swos_blobno longer fails withROUTER_TIMEOUTwhen asys.bwrite that changes how the switch is reached (ip,static_ip,addr_acq,allow_from_*) leaves the switch not answering this client, which is the expected outcome of moving its address. It reads the endpoint back first: if the new values are there the result iswritten; if the switch does not answer, the result is the newwritten_unverified(probably applied, not confirmed; update the router's host inrouters.yamland check withget_swos_status); if the switch answers with the old values, the result is the new errorSWOS_WRITE_NOT_APPLIED(the write did not land, retrying is safe). Only a timeout orROUTER_UNREACHABLEon the read-back counts as the switch not answering; any other read-back failure keeps the original timeout error. Writes that do not change how the switch is reached still fail on a timeout (#144).
Security
- The HTTP transport checks the
HostandOriginheaders before authentication, so a DNS-rebinding page in the user's browser can no longer reach a server bound tolocalhost. Bound to loopback, onlylocalhostnames are answered; for other binds,MIKROMCP_HTTP_ALLOWED_HOSTSandMIKROMCP_HTTP_ALLOWED_ORIGINSset the lists, and without a host list the server logs that the check is off. NewMIKROMCP_HTTP_ALLOWED_IPSrestricts client addresses (IPs and CIDRs). Refusals are403withHOST_NOT_ALLOWED,ORIGIN_NOT_ALLOWEDorCLIENT_IP_NOT_ALLOWEDand a hint naming the variable;/healthzis not checked.mikromcp doctorreports the lists.