mikrotik-mcp
Provides tools for managing and monitoring MikroTik RouterOS devices, including system info, interfaces, DHCP leases, firewall rules, NAT rules, address lists, queues, routes, logs, WireGuard, DNS, and traffic. Read-only except for address-list management.
Allows retrieving WireGuard interface and peer information from the router, including endpoints, handshake times, and traffic statistics.
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-mcpshow me the current DHCP leases"
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
MCP server for MikroTik RouterOS. Talks to the router directly over the binary RouterOS API (port 8728) — a minimal hand-rolled implementation of the protocol (length encoding, sentence-based exchange, MD5-challenge login for older versions), no third-party RouterOS API library.
Intentionally read-only (with one exception — managing entries in a single address-list, see below). This is a deliberate architectural choice: the router is the most sensitive node in the network, and an LLM shouldn't be able to change firewall/NAT/routing directly.
Tools
Tool | Description |
| Model, RouterOS version, uptime, CPU, RAM |
| List of network interfaces with status |
| DHCP leases — who's connected to the network |
| Firewall filter rules, filterable by chain |
| NAT rules (dstnat/srcnat) |
| Contents of an address-list |
| Simple Queues — bandwidth limits |
| Routing table |
| The only write operations — add/remove an IP from an address-list (e.g. for blocking) |
| Recent log entries |
| Arbitrary read-only RouterOS command — only from an explicit whitelist in the code ( |
| WireGuard interfaces and peers (endpoint, handshake, rx/tx) |
| Router's static DNS entries |
| Instant per-interface throughput snapshot ( |
| JSON snapshot of key config sections — for diffing before/after manual changes |
Related MCP server: RouterOS MCP Server
Setup
git clone <this-repo> mikrotik-mcp && cd mikrotik-mcp
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # fill in MIKROTIK_HOST/USER/PASS, MCP_SECRET
uvicorn server:app --host 0.0.0.0 --port 8001Systemd unit example: deploy/mikrotik-mcp.service.
Docker:
docker build -t mikrotik-mcp .
docker run -p 8001:8001 --env-file .env mikrotik-mcpOn the router: create a dedicated user in a read-only group (/user group add name=ai-mcp-group policy=read,api,!write,!policy,!test,!winbox,!password,!web,!reboot,!ftp,!sniff,!sensitive,!romon), don't grant write/policy. Even if the server itself is compromised, access stays limited at the RouterOS level.
Security model
Auth is an
Authorization: Bearer $MCP_SECRETheader. EmptyMCP_SECRET= no check (local network/VPN only)./.well-known/oauth-authorization-server+/oauth/authorize+/oauth/tokenare a compatible stub for claude.ai custom connectors, which don't support a static API key — only full OAuth 2.1 or no auth at all. The actual protection is the Bearer token on/mcp, not this handshake. Via Claude Code CLI (claude mcp add --header ...) you don't need this stub at all.redirect_uriin/oauth/authorizeis checked against an allowlist (claude.ai,anthropic.com,console.anthropic.com,localhost).execute_commandruns strictly through a whitelist of root commands in the code — you cannot execute an arbitrary write command through this tool, even by trying.Transport: the server does not terminate TLS itself — it listens on plain HTTP. If it's reachable beyond localhost/a trusted LAN (and especially if you're connecting it as a custom connector in claude.ai, where HTTPS is required), put TLS termination in front of it: Cloudflare Tunnel, Tailscale Funnel, nginx/Caddy + Let's Encrypt, etc. Without that, the Bearer token (
MCP_SECRET) in theAuthorizationheader goes out in plaintext.
Requirements
MikroTik RouterOS 6.x/7.x with the API enabled (
/ip service enable api, port 8728 by default).Python 3.11+.
License
MIT — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Query and audit AppSheet apps in natural language via Knotrik's pre-scanned definitions.
Ask your Rent Manager portfolio anything: live, read-only financials, rent roll, leasing.
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA bridge between AI assistants and MikroTik RouterOS devices, allowing natural language interaction to manage network configurations including VLANs, firewalls, DNS settings, and more.1MIT
- 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
- AlicenseCqualityAmaintenanceProvides a bridge between AI assistants and MikroTik RouterOS devices, enabling natural language management of VLANs, firewall rules, DNS settings, and more.174210 PyPI269MIT
- AlicenseNot gradedqualityFmaintenanceEnables natural language management of MikroTik routers through Cursor IDE by translating requests into RouterOS commands via API or SSH.4MIT