Skip to main content
Glama

MikroTik MCP Server: manage RouterOS routers with Claude and AI assistants

CI License: MIT MCP RouterOS

MikroTik MCP is an open-source Model Context Protocol (MCP) server that connects Claude, and any other MCP-compatible AI assistant, to MikroTik RouterOS routers and switches. In plain language you can check router status, list interfaces, routes, firewall rules, DHCP leases and Wi-Fi clients, read logs, ping and traceroute, block IP addresses, back up the configuration, and change any RouterOS setting.

Quick facts

  • What it is: an MCP server (stdio) written in TypeScript for Node.js 20+.

  • Works with: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf and any MCP client.

  • Supports: RouterOS v7 through the REST API, and RouterOS v6 and v7 through the binary API (ports 8728/8729).

  • Hardware: any MikroTik device running RouterOS, including hAP, hEX, RB, CCR, CRS, cAP, wAP and Cloud Hosted Router (CHR).

  • Safety: read-only mode, per-device permissions, and confirmation hints on destructive tools.

  • No WinBox needed: it uses MikroTik's documented APIs, which expose the same configuration as WinBox and the terminal.

  • License: MIT.

It talks to the router over RouterOS's own documented interfaces:

Transport

RouterOS

Port

Service to enable

rest (default)

v7.1+

443 (HTTPS) / 80

www-ssl (or www)

api

v6 and v7

8728 / 8729 (TLS)

api / api-ssl

Both expose the full configuration tree that WinBox and the terminal use, so every menu (/ip/..., /interface/..., /routing/..., /queue/..., ...) is reachable.

Tools

Generic (any menu path)

Tool

What it does

mikrotik_print

Read any menu, with filters and property selection

mikrotik_add

Add an item to any menu

mikrotik_set

Change an item (by .id or filter) or a singleton setting such as /system/identity

mikrotik_remove

Remove an item

mikrotik_set_enabled

Enable or disable an item

mikrotik_run_command

Run any command (/system/script/run, /interface/monitor-traffic once=yes, ...)

Curated

Tool

What it does

mikrotik_list_devices

Configured routers

mikrotik_system_overview

Identity, version, board, CPU/RAM/disk, uptime, clock, health, packages

mikrotik_interfaces

Interfaces with state and counters

mikrotik_ip_addresses

IPv4/IPv6 addresses

mikrotik_routes

Routing table

mikrotik_firewall_rules

filter / nat / mangle / raw rules with counters

mikrotik_dhcp_leases

DHCP leases

mikrotik_wireless_clients

Wi-Fi registration table (wifi, wifiwave2, wireless, CAPsMAN)

mikrotik_arp_table

ARP entries and discovered neighbors

mikrotik_logs

Recent log entries, filterable by topic or text

mikrotik_ping, mikrotik_traceroute

Diagnostics from the router

mikrotik_firewall_add_rule

Add a firewall rule, optionally above an existing one

mikrotik_address_list

Add/remove addresses in firewall address lists (block/allow hosts)

mikrotik_backup

Save a .backup and .rsc export on the router

mikrotik_reboot

Reboot (requires confirm: true)

Write tools carry MCP readOnlyHint: false / destructiveHint annotations so clients can ask before running them.

Related MCP server: MikroCLAW

Install

Requires Node.js 20+.

git clone https://github.com/RexGuard/MikroTik-MCP.git
cd mikrotik-mcp
npm install        # also builds into dist/

Prepare the router

Create a dedicated user rather than using admin. For a read-only assistant use the built-in read group; for changes use full (or a custom group).

/user group add name=mcp policy=read,write,api,rest-api,test,ping,reboot,policy,sensitive
/user add name=mcp group=mcp password=CHANGE-ME

# RouterOS v7 REST API (HTTPS needs a certificate on www-ssl)
/certificate add name=self common-name=router
/certificate sign self
/ip service set www-ssl certificate=self disabled=no

# or the binary API (v6/v7)
/ip service set api disabled=no address=192.168.88.0/24

Restrict the service address= to the network the MCP server runs on.

Configure

One router (environment variables)

Variable

Default

Meaning

MIKROTIK_HOST

—

Router IP or hostname

MIKROTIK_USERNAME

admin

User name

MIKROTIK_PASSWORD

empty

Password

MIKROTIK_TRANSPORT

rest

rest or api

MIKROTIK_PORT

443 / 80 / 8728 / 8729

Override the port

MIKROTIK_TLS

true for rest, false for api

Use HTTPS / API-SSL

MIKROTIK_INSECURE

false

Accept self-signed certificates

MIKROTIK_READ_ONLY

false

Block every write tool

MIKROTIK_TIMEOUT_MS

30000

Request timeout

Several routers

Point MIKROTIK_CONFIG at a JSON file (see examples/devices.example.json) or put the same array in MIKROTIK_DEVICES. Every tool then takes an optional device argument; the first device is the default. Each device can set "readOnly": true.

Use with Claude

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "mikrotik": {
      "command": "node",
      "args": ["/path/to/mikrotik-mcp/dist/src/index.js"],
      "env": {
        "MIKROTIK_HOST": "192.168.88.1",
        "MIKROTIK_USERNAME": "mcp",
        "MIKROTIK_PASSWORD": "CHANGE-ME",
        "MIKROTIK_INSECURE": "true"
      }
    }
  }
}

Claude Code

claude mcp add mikrotik \
  -e MIKROTIK_HOST=192.168.88.1 -e MIKROTIK_USERNAME=mcp -e MIKROTIK_PASSWORD=CHANGE-ME -e MIKROTIK_INSECURE=true \
  -- node /path/to/mikrotik-mcp/dist/src/index.js

Then ask things like:

  • "What's the CPU load and uptime on my router?"

  • "Which devices are on Wi-Fi right now?"

  • "Block 203.0.113.5 for one day."

  • "Show me the NAT rules and explain what each one does."

  • "Make a backup before we change anything."

Safety

  • Start with MIKROTIK_READ_ONLY=true until you trust the setup.

  • Use a dedicated RouterOS user with only the policies you need.

  • Firewall, bridge and address changes can lock you out. Consider Safe Mode or run mikrotik_backup first.

  • The plain binary API (8728) sends the password unencrypted; prefer REST over HTTPS or API-SSL (8729) outside a trusted LAN.

Development

npm test     # builds and runs the test suite against an in-memory mock RouterOS (REST and binary API)

Why not reverse engineer WinBox?

WinBox, the mobile app and the web UI all drive the same RouterOS configuration tree that the REST API and the binary API expose, and those APIs are documented and stable across versions. Using them gives the same feature coverage without depending on undocumented, encrypted WinBox protocol details that can change between releases.

FAQ

How do I connect Claude to a MikroTik router?

Install this server, enable the REST API (www-ssl) or the API service on the router, and add the server to Claude Desktop or Claude Code with the router's address and a RouterOS user (see Use with Claude). Claude can then query and configure the router in plain language.

Does it work with RouterOS 6?

Yes. Set MIKROTIK_TRANSPORT=api to use the binary API, which works on RouterOS v6 and v7. The REST API transport needs RouterOS v7.1 or newer.

Does it work with ChatGPT, Cursor or other AI tools?

It works with any client that supports the Model Context Protocol, including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot agent mode) and Windsurf. Use the same command, args and env settings shown for Claude Desktop.

Can it run on the MikroTik router itself?

Not from the RouterOS console. It runs on your computer (or any machine that can reach the router) and connects to the router over the network. Running it inside a RouterOS 7 container is possible on ARM, ARM64 and x86 models but is not packaged yet.

Is it safe to let an AI change my router configuration?

Use a dedicated RouterOS user with limited policies, start with MIKROTIK_READ_ONLY=true, and make a backup with mikrotik_backup before changes. Write and destructive tools are marked so MCP clients can ask for confirmation, and mikrotik_reboot requires an explicit confirm: true.

Can it manage more than one router?

Yes. List several devices in MIKROTIK_CONFIG or MIKROTIK_DEVICES and pass device to any tool. Each device can be read-only or read-write.

What can I ask it?

Examples: "Why is my internet slow?", "Which devices are using the most bandwidth?", "Show the firewall rules and find anything risky", "Block this IP for a day", "Add a port forward for 8080 to 192.168.88.10", "Which Wi-Fi clients have a weak signal?", "Back up the config".

License

MIT. MikroTik and RouterOS are trademarks of MikroTik SIA. This project is not affiliated with or endorsed by MikroTik.

Available Tools

22 tools
mikrotik_addAdd a RouterOS itemB

Add an item to any RouterOS menu (/<path> add ...). Returns the new item's .id.

Inputs: path (required), properties (required), device.

mikrotik_address_listManage firewall address listsC

Add or remove an address in a firewall address list (commonly used to block or allow hosts).

Inputs: list (required), action (required), address (required), ipv6, +3 more.

mikrotik_arp_tableARP table and neighborsA
Read-onlyIdempotent

List ARP entries and discovered neighbors (MNDP/CDP/LLDP) to see which hosts are on the network.

Inputs: limit, device, interface.

mikrotik_backupCreate a backupA

Save a binary backup (.backup) and/or a text export (.rsc) of the configuration to the router's file system.

Inputs: name, device, password, exportScript.

mikrotik_dhcp_leasesList DHCP leasesA
Read-onlyIdempotent

List DHCP server leases (IP, MAC, hostname, status), optionally for one DHCP server.

Inputs: limit, device, server.

mikrotik_firewall_add_ruleAdd a firewall ruleB

Add a firewall rule. properties takes any rule property (src-address, dst-port, protocol, in-interface, connection-state, to-addresses, ...). Use placeBefore with a rule .id to insert it above an existing rule; otherwise it is appended to the end of the table.

Inputs: chain (required), action (required), ipv6, table, +4 more.

mikrotik_firewall_rulesList firewall rulesB
Read-onlyIdempotent

List firewall rules in order (filter, nat, mangle or raw), including packet/byte counters.

Inputs: ipv6, chain, limit, table, +1 more.

mikrotik_interfacesList interfacesB
Read-onlyIdempotent

List interfaces with type, running/disabled state, MAC, MTU and traffic counters.

Inputs: type, limit, device, running.

mikrotik_ip_addressesList IP addressesB
Read-onlyIdempotent

List IPv4 (or IPv6) addresses assigned to interfaces.

Inputs: ipv6, limit, device, interface.

mikrotik_list_devicesList MikroTik devicesA
Read-only

List the MikroTik routers this server is configured to manage (no credentials are returned).

Inputs: no named parameters.

mikrotik_logsRead system logA
Read-onlyIdempotent

Read the most recent system log entries, optionally filtered by topic or text.

Inputs: limit, device, topics, contains.

mikrotik_pingPing from the routerA
Read-onlyIdempotent

Ping a host from the router itself (useful to test connectivity from a specific interface or source address).

Inputs: address (required), vrf, count, device, +2 more.

mikrotik_printRead any RouterOS menuA
Read-onlyIdempotent

Print items from any RouterOS menu path (the equivalent of /<path> print in the terminal or opening a window in WinBox). Use this for anything without a dedicated tool, e.g. /ip/dns, /interface/bridge/port, /ip/ipsec/peer, /routing/ospf/neighbor, /queue/simple, /user.

Inputs: path (required), limit, query, where, +2 more.

mikrotik_rebootReboot the routerA
Destructive

Reboot the router. The connection will drop for about a minute. Always confirm with the user first.

Inputs: confirm (required), device.

mikrotik_removeRemove a RouterOS itemA
Destructive

Remove an item (/<path> remove <id>), identified by id or a where filter matching exactly one item.

Inputs: path (required), id, where, device.

mikrotik_routesList routesA
Read-onlyIdempotent

List the IPv4 (or IPv6) routing table, optionally only active routes or a single destination.

Inputs: ipv6, limit, device, activeOnly, +1 more.

mikrotik_run_commandRun any RouterOS commandB
Read-onlyIdempotent

Run an arbitrary RouterOS command, e.g. /system/script/run, /interface/ethernet/monitor (with once=yes), /ip/dhcp-server/lease/make-static, /tool/fetch. Commands that never finish (monitor, torch, ping without count) must be given once or count/duration arguments. On read-only devices only print/get/monitor/ping/traceroute style commands are allowed.

Inputs: command (required), args, limit, query, +1 more.

mikrotik_setChange a RouterOS item or settingA

Change properties of an item (/<path> set <id> ...). Identify the item by id (e.g. "*1F") or a where filter matching exactly one item. For singleton menus such as /system/identity, /ip/dns or /ip/cloud omit both.

Inputs: path (required), properties (required), id, where, +1 more.

mikrotik_set_enabledEnable or disable a RouterOS itemA

Enable or disable an interface, firewall rule, route, user, etc. Identify it by id or a where filter.

Inputs: path (required), enabled (required), id, where, +1 more.

mikrotik_system_overviewSystem overviewB
Read-onlyIdempotent

Identity, RouterOS version, board, CPU/memory/disk usage, uptime, clock and health sensors in one call.

Inputs: device.

mikrotik_tracerouteTraceroute from the routerC
Read-onlyIdempotent

Trace the path from the router to a host.

Inputs: address (required), device, maxHops.

mikrotik_wireless_clientsList wireless clientsB
Read-onlyIdempotent

List connected Wi-Fi clients from the registration table (supports the wifi, wifiwave2, legacy wireless and CAPsMAN packages).

Inputs: limit, device.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 22 tools

    Disambiguation3/5

    The generic mikrotik_print/add/set/remove/run_command tools overlap substantially with dedicated tools such as mikrotik_ip_addresses, mikrotik_interfaces, mikrotik_firewall_add_rule, mikrotik_address_list, and mikrotik_set_enabled. Descriptions help by steering agents toward dedicated tools for common tasks, but an agent can still reasonably choose either path for several operations.

    Naming Consistency4/5

    All tools use a consistent mikrotik_ snake_case prefix, and the split between noun-style read tools and verb-style action tools is mostly predictable. Minor inconsistency remains because some read tools include list_ while others are bare resource nouns.

    Tool Count4/5

    Twenty-two tools is on the high side but reasonable for the broad MikroTik management domain, covering system info, interfaces, routing, firewall, DHCP, wireless, ARP, logs, diagnostics, and generic RouterOS operations. The generic CRUD tools also prevent the surface from needing dozens of menu-specific tools.

    Completeness5/5

    The set covers core read views, generic add/set/remove operations for any RouterOS menu, arbitrary command execution, diagnostics, firewall/address-list helpers, backup, and reboot. Remaining lifecycle operations such as restore or package updates can be reached through mikrotik_run_command, so there are no obvious dead ends.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with MikroTik RouterOS devices through API and SSH connections, supporting network monitoring, configuration management, and diagnostics across multiple routers with automatic connection fallback.
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to audit, inspect, and safely configure MikroTik RouterOS v7 routers through tools for connection testing, system status, security audits, firewall mangle management, routing, DHCP leases, sanitized exports, containers, and adlist queries.
      239 npm
      GPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to read, query, and safely modify RouterOS 7 devices over the REST API, covering firewall, routing, DHCP, DNS, interfaces, containers, files, and diagnostics, with confirmation gates and a scheduled rollback guard in front of disruptive changes.
      40 PyPI
      MIT