MikroTik MCP
Provides tools for managing MikroTik RouterOS routers and switches, including checking system status, listing interfaces, routes, firewall rules, DHCP leases, wireless clients, reading logs, running diagnostics, creating backups, rebooting, and changing RouterOS configuration through the REST or binary API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MikroTik MCP Show my router's interfaces and any firewall rules blocking traffic"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MikroTik MCP Server: manage RouterOS routers with Claude and AI assistants
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 |
| v7.1+ | 443 (HTTPS) / 80 |
|
| v6 and v7 | 8728 / 8729 (TLS) |
|
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 |
| Read any menu, with filters and property selection |
| Add an item to any menu |
| Change an item (by |
| Remove an item |
| Enable or disable an item |
| Run any command ( |
Curated
Tool | What it does |
| Configured routers |
| Identity, version, board, CPU/RAM/disk, uptime, clock, health, packages |
| Interfaces with state and counters |
| IPv4/IPv6 addresses |
| Routing table |
| filter / nat / mangle / raw rules with counters |
| DHCP leases |
| Wi-Fi registration table (wifi, wifiwave2, wireless, CAPsMAN) |
| ARP entries and discovered neighbors |
| Recent log entries, filterable by topic or text |
| Diagnostics from the router |
| Add a firewall rule, optionally above an existing one |
| Add/remove addresses in firewall address lists (block/allow hosts) |
| Save a |
| Reboot (requires |
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/24Restrict the service address= to the network the MCP server runs on.
Configure
One router (environment variables)
Variable | Default | Meaning |
| — | Router IP or hostname |
|
| User name |
| empty | Password |
|
|
|
| 443 / 80 / 8728 / 8729 | Override the port |
|
| Use HTTPS / API-SSL |
|
| Accept self-signed certificates |
|
| Block every write tool |
|
| 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.jsThen 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=trueuntil 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_backupfirst.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".
Related
License
MIT. MikroTik and RouterOS are trademarks of MikroTik SIA. This project is not affiliated with or endorsed by MikroTik.
Available Tools
22 toolsmikrotik_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 neighborsARead-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 leasesARead-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 rulesBRead-onlyIdempotent
List firewall rules in order (filter, nat, mangle or raw), including packet/byte counters.
Inputs: ipv6, chain, limit, table, +1 more.
mikrotik_interfacesList interfacesBRead-onlyIdempotent
List interfaces with type, running/disabled state, MAC, MTU and traffic counters.
Inputs: type, limit, device, running.
mikrotik_ip_addressesList IP addressesBRead-onlyIdempotent
List IPv4 (or IPv6) addresses assigned to interfaces.
Inputs: ipv6, limit, device, interface.
mikrotik_list_devicesList MikroTik devicesARead-only
List the MikroTik routers this server is configured to manage (no credentials are returned).
Inputs: no named parameters.
mikrotik_logsRead system logARead-onlyIdempotent
Read the most recent system log entries, optionally filtered by topic or text.
Inputs: limit, device, topics, contains.
mikrotik_pingPing from the routerARead-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 menuARead-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 routerADestructive
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 itemADestructive
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 routesARead-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 commandBRead-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 overviewBRead-onlyIdempotent
Identity, RouterOS version, board, CPU/memory/disk usage, uptime, clock and health sensors in one call.
Inputs: device.
mikrotik_tracerouteTraceroute from the routerCRead-onlyIdempotent
Trace the path from the router to a host.
Inputs: address (required), device, maxHops.
mikrotik_wireless_clientsList wireless clientsBRead-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
Scored across 22 tools
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.
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.
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.
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
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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.3MIT
- AlicenseBqualityCmaintenanceMCP server that enables Claude Code to access, monitor, and manage MikroTik RouterOS devices via its REST API, with 92 tools for read-only and optional write operations.92Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables 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 npmGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables 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 PyPIMIT