Skip to content

v1.18.0

Latest

Choose a tag to compare

@github-actions github-actions released this 22 Nov 12:23
17d64bb

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=true registers only read-only tools, so no client of that server can call a write tool, and tools/list drops from about 150 KB to about 55 KB of JSON. MIKROMCP_TOOLSETS (e.g. firewall,dhcp) registers only the named toolsets plus list_routers and check_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/list leaves out the tools a caller's identity may not call under its allowedToolPatterns. Calls to hidden tools are still refused by the executor, as before.
  • MikroMCP runs without a routers.yaml. With one router, set MIKROMCP_ROUTER_HOST, MIKROMCP_ROUTER_USER and MIKROMCP_ROUTER_PASS in the MCP client's env block and run npx -y mikromcp: the server builds a router with id default (or MIKROMCP_ROUTER_ID), HTTPS on port 443 with the certificate verified, and RouterOS 7. Optional MIKROMCP_ROUTER_PORT, MIKROMCP_ROUTER_TLS (false for plain HTTP, port 80), MIKROMCP_ROUTER_TLS_FINGERPRINT, MIKROMCP_ROUTER_TLS_INSECURE, MIKROMCP_ROUTER_ROS_VERSION and MIKROMCP_ROUTER_TAGS change the rest. MIKROMCP_ROUTERS takes a whole registry inline as YAML or JSON in the routers.yaml shape, validated the same way. Routers come from one source, in this order: MIKROMCP_ROUTERS, then the config file, then the MIKROMCP_ROUTER_* variables. If a lower source is also set, the server logs a warning that names it, and mikromcp doctor reports which source it used. A bad value fails at startup with an error that names the variable and never shows its value.
  • manage_firewall_rule and manage_mangle_rule take action: "move" with ruleId (a rule .id) and destination (the .id of the rule to place it before, or end), so a rule can be reordered without run_command. It runs RouterOS move, returns no_change when the first static rule after it is already destination (or, for end, none follows), refuses dynamic rules as the rule or the destination (DYNAMIC_RULE_NOT_MOVABLE), and reports the old and new position, also on a dry run. A real firewall move is guarded by the auto-revert job like every other firewall write: its new move-back revert 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_addresses and manage_ipv6_address (/ipv6/address) list and add, update or remove static IPv6 addresses, including EUI-64 addresses (eui64: true, address is the prefix) and addresses built from a DHCPv6 prefix-delegation pool (fromPool, address is the suffix such as ::1/64), with advertise and noDad. Writes are idempotent by address and interface, compared in canonical form, so 2001:DB8:0::1/64 and 2001:db8::1/64 are 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 with IPV6_ADDRESS_DYNAMIC. list_ipv6_neighbors (/ipv6/neighbor) and list_dhcpv6_clients (/ipv6/dhcp-client, including the delegated prefix and the pool it fills) are read-only. rollback_change matches /ipv6/address and /ipv6/route records by address and interface, and by destination, gateway and table.
  • list_bridge_vlans tool — lists the bridge VLAN table (/interface/bridge/vlan): bridge, vlan-ids, configured tagged/untagged ports, the current-tagged/current-untagged ports RouterOS applies, and whether an entry is dynamic. Filters by bridge and by a VLAN id, matched inside ranges and lists.
  • manage_bridge_vlan tool — adds, updates or removes a bridge VLAN entry. vlanIds takes a VLAN id, a range (100-110) or a comma list; it is idempotent by bridge + VLAN set (10,20 equals 20,10, 100-102 equals 100,101,102) with port lists compared order-insensitively. add returns already_exists for an equal entry and CONFLICT when the entry has different ports or overlaps another static entry; update returns no_change when nothing differs; update/remove return NOT_FOUND for 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_config tool and SIGHUP handler: re-read routers.yaml and identities.yaml without restarting the server, so a changed router host no 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 with readonly or operator identities is refused without MIKROMCP_CONFIRMATION_SECRET, as at startup. The tool needs an admin or superadmin identity and takes dryRun; environment variables and the HTTP port are not reloaded. Over stdio, the identity named by MIKROMCP_STDIO_IDENTITY is 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 with STDIO_IDENTITY_NOT_FOUND) (#150).

Changed

  • list_firewall_rules and manage_firewall_rule accept table: "raw" and a family parameter (ip, the default, or ipv6), 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, ...). protocol accepts icmpv6, for IPv6 only; icmp on an IPv6 rule is refused with PROTOCOL_FAMILY_MISMATCH.
  • manage_firewall_rule takes jumpTarget (jump-target, required with ruleAction: "jump" and refused otherwise) and rejectWith (reject-with, ruleAction: "reject" only, with the replies of the rule's family). Both are part of the repeated-add comparison; an omitted rejectWith and the family default count as the same. chain and ruleAction are now checked by the handler instead of the schema, so a missing one fails with PARAM_REQUIRED (still before any router call) and move can go without them.
  • list_mangle_rules, manage_mangle_rule, list_address_list_entries and manage_address_list_entry take family (ip or ipv6) for ipv6/firewall/mangle and ipv6/firewall/address-list. manage_mangle_rule's comment is required by the handler (PARAM_REQUIRED) for every action except move.
  • manage_firewall_rule snapshots, and binds confirmation tokens to, only the table and family the call touches, instead of always ip/firewall/filter and ip/firewall/nat; manage_mangle_rule and manage_address_list_entry follow family the same way. The rollback diff treats the raw and IPv6 firewall tables like their IPv4 counterparts (comment as key, order not restored).
  • list_routes and manage_route take family: "ip" | "ipv6" (default ip, unchanged behaviour); ipv6 works on /ipv6/route, and manage_route snapshots that path. With ipv6, 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 with family: ip, or an IPv4 one with ipv6) is refused with ROUTE_FAMILY_MISMATCH.
  • manage_bridge gains action update and a vlanFiltering parameter (also accepted on create). Enabling VLAN filtering is the classic management lock-out, so the dry run and the result of an update that turns it on carry warnings: 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). disabled no longer defaults to false in the schema: create still creates an enabled bridge when it is omitted, and update leaves it unchanged.
  • manage_bridge_port gains action update and the port settings pvid, frameTypes and ingressFiltering (also accepted on add). update returns no_change when nothing differs and NOT_FOUND when the interface is not a port of that bridge; add of an existing port returns CONFLICT when a given setting differs. Without the new parameters, add and remove behave as before.

Fixed

  • docker-compose.example.yml now sets MIKROMCP_BIND_HOST: 0.0.0.0. Without it the server inside the container listened on 127.0.0.1, which the published port cannot reach, so the example compose file never answered.
  • write_swos_blob no longer fails with ROUTER_TIMEOUT when a sys.b write 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 is written; if the switch does not answer, the result is the new written_unverified (probably applied, not confirmed; update the router's host in routers.yaml and check with get_swos_status); if the switch answers with the old values, the result is the new error SWOS_WRITE_NOT_APPLIED (the write did not land, retrying is safe). Only a timeout or ROUTER_UNREACHABLE on 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 Host and Origin headers before authentication, so a DNS-rebinding page in the user's browser can no longer reach a server bound to localhost. Bound to loopback, only localhost names are answered; for other binds, MIKROMCP_HTTP_ALLOWED_HOSTS and MIKROMCP_HTTP_ALLOWED_ORIGINS set the lists, and without a host list the server logs that the check is off. New MIKROMCP_HTTP_ALLOWED_IPS restricts client addresses (IPs and CIDRs). Refusals are 403 with HOST_NOT_ALLOWED, ORIGIN_NOT_ALLOWED or CLIENT_IP_NOT_ALLOWED and a hint naming the variable; /healthz is not checked. mikromcp doctor reports the lists.