mikrotik-mcp
Provides tools to manage MikroTik RouterOS devices, including firewall, routing, DHCP/DNS, wireless, QoS, VPN, and system operations via SSH, with risk annotations and Safe Mode transactional support.
Allows configuration of OpenVPN servers and clients on MikroTik routers, including setting up server parameters, creating client connections, and managing certificates.
Enables management of WireGuard interfaces and peers on MikroTik routers, including adding peers, generating client configurations, and securing site-to-site or road warrior VPNs.
Click on "Install 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 firewall rules"
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.
@usex/mikrotik-mcp exposes MikroTik RouterOS as 310 Model Context Protocol
tools across 31 modules, so an AI client (Claude Desktop, Claude Code, any MCP
client) can read and configure your router in plain language. It speaks to the
device over SSH โ no agent, no API package to install on RouterOS โ runs on
Bun, and validates every tool call against a Zod schema.
Every tool is risk-annotated (read / write / destructive) so clients can gate what runs, and risky changes can be wrapped in Safe Mode โ RouterOS holds them in memory and auto-reverts if your session drops, so you can't lock yourself out.
// claude_desktop_config.json
{
"mcpServers": {
"mikrotik": {
"command": "mikrotik-mcp",
"env": {
"MIKROTIK_HOST": "192.168.88.1",
"MIKROTIK_USERNAME": "admin",
"MIKROTIK_PASSWORD": "your-password"
}
}
}
}"Show me the firewall input chain, then block SSH from the WAN under safe mode." "Build an IKEv2 site-to-site tunnel to 203.0.113.5 for 192.168.20.0/24." "Why can't VLAN 50 reach the internet?"
Why it's different
๐งฐ Breadth โ 310 tools covering the whole device: L2 (bridge, VLAN, wireless, PoE), L3 (addressing, routing, DHCP, DNS), security (firewall, NAT, address-lists, certificates), QoS (queues), and system ops (users, logs, backups, scheduler).
๐ A complete VPN suite โ WireGuard, IPsec (IKEv1/IKEv2), L2TP, PPTP, SSTP, OpenVPN, plus GRE/IPIP/EoIP/VXLAN tunnels. With a
choose-vpn-solutionprompt that picks the right one for you. See the VPN guide.๐ Safe Mode โ a real transactional window (
enable_safe_modeโ changes โcommit_safe_mode/rollback_safe_mode) backed by a persistent SSH session. Auto-reverts on disconnect.๐ฆ Risk-annotated tools โ
readOnlyHint/destructiveHintlet clients auto-approve reads and prompt on writes.๐งฑ Injection-safe by construction โ a command builder quotes/escapes every value, so a hostname like
LAN; /system resetcan never split into a second command.๐ Drop-in for the Python server โ the
MIKROTIK_*environment variables are byte-for-byte compatible; swap the binary, keep your config.๐ค Guided prompts โ 8 built-in workflows (harden, diagnose, guest Wi-Fi, VPNs, backup & document) that turn an intent into the right sequence of tool calls.
Related MCP server: RouterOS MCP Server
Quickstart
# 1. Install (requires Bun โฅ 1.3 โ https://bun.sh)
bun add -g @usex/mikrotik-mcp
# 2. Point it at your router and verify SSH connectivity
MIKROTIK_HOST=192.168.88.1 MIKROTIK_USERNAME=admin MIKROTIK_PASSWORD=โขโขโขโข \
mikrotik-mcp auth-check
# 3. List the catalog (name ยท risk ยท title)
mikrotik-mcp tools
# 4. Run it (stdio by default โ wire it into your MCP client)
mikrotik-mcp servePrefer SSH keys over a password? Point the server at a key file instead โ and add a passphrase if the key is encrypted:
MIKROTIK_HOST=192.168.88.1 MIKROTIK_USERNAME=admin \
MIKROTIK_KEY_FILENAME=~/.ssh/id_ed25519 \
MIKROTIK_KEY_PASSPHRASE=โขโขโขโข \
mikrotik-mcp auth-check # prints "Auth mode: SSH key"The key (file via --key-filename or inline PEM via --private-key) takes
precedence over a password. Full configuration reference:
docs/configuration.md.
From source
git clone https://github.com/ali-master/mikrotik-mcp && cd mikrotik-mcp
bun install
bun run start # serve from source
bun run build # bundle to dist/The tool catalog
310 tools across 31 modules. Full, always-current reference (parameters + risk per tool) is generated from source: docs/tools-reference.md.
Group | Tools | Modules |
Interfaces | 41 | interfaces, VLAN, bridge, wireless, PoE |
Addressing & Routing | 46 | IP addresses, IP pools, routing, DHCP, DNS |
Security | 34 | firewall filter, NAT, address-lists, certificates, IP services |
VPN & Tunneling | 96 | WireGuard, IPsec, PPP, L2TP, PPTP, SSTP, OpenVPN, GRE/IPIP/EoIP/VXLAN |
QoS | 19 | queue types, queue trees, simple queues |
System & Ops | 74 | system, network tools, scheduler/scripts, users, logs, backup, Safe Mode |
VPN & tunneling โ expert coverage
Every MikroTik VPN technology, modeled the way RouterOS actually layers them (the
PPP-based VPNs share one /ppp backend for users and addressing):
Need | Use | Build it with |
MikroTik โ MikroTik, modern clients | WireGuard |
|
Interop site-to-site / native IKEv2 | IPsec |
|
Built-in OS VPN clients | L2TP/IPsec |
|
Through restrictive firewalls | SSTP (TLS) |
|
Cross-platform OpenVPN | OpenVPN |
|
Route / L2-bridge between sites | GRE/IPIP/EoIP/VXLAN |
|
Not sure which? Invoke the choose-vpn-solution prompt and the server
recommends one and outlines the build. Details: docs/vpn-guide.md.
Built-in prompts
MCP prompts are one-click guided workflows. This server ships 8 โ authored as
Markdown in prompts/, so you can edit or add your own without
touching code:
harden-router ยท diagnose-connectivity ยท setup-guest-wifi ยท
choose-vpn-solution ยท setup-wireguard-vpn ยท setup-ipsec-site-to-site ยท
setup-l2tp-ipsec-roadwarrior ยท backup-and-document
See docs/prompts.md.
Transports
Transport | When | Run |
stdio (default) | Claude Desktop, local MCP clients |
|
streamable-http | Remote / shared, behind a proxy |
|
sse | Legacy HTTP clients |
|
HTTP transports expose POST /mcp and a GET /health check, with DNS-rebinding
protection that reconciles with your bind host automatically. See
docs/transports.md.
Safe Mode
enable_safe_mode โ (make changes) โ commit_safe_mode # persist
โ rollback_safe_mode # discardWhile active, every change is held in memory; if the SSH session drops (e.g. a firewall rule that locks you out), RouterOS reverts everything automatically. Commands issued during the window are routed through the same persistent session. See docs/safe-mode.md.
Configuration
Connection and transport settings come from MIKROTIK_* env vars or matching CLI
flags (highest precedence last: defaults โ env โ flags).
Variable | Flag | Default | Purpose |
|
|
| RouterOS host |
|
|
| SSH user |
|
|
| SSH port |
|
| โ | SSH password (or use a key โ) |
|
| โ | SSH private-key file path |
|
| โ | Inline private key (PEM) |
|
| โ | Passphrase for an encrypted key |
|
|
|
|
|
|
| HTTP bind port |
Full table (incl. HTTP host, allow-lists, timeouts, MIKROTIK_LOG_LEVEL):
docs/configuration.md.
Schemas
schemas/ ships machine-readable JSON Schemas, generated from the TypeScript
source (bun run gen:schemas) so they can never drift:
schemas/tool-catalog.jsonโ all 310 tools with risk, description, and input schemaschemas/tools/<name>.jsonโ per-tool input schemaschemas/config.schema.jsonโ the runtime configuration
Migrating from the Python server
This is a from-scratch rewrite of mcp-server-mikrotik
in Bun + TypeScript. All 169 original tools are ported 1:1 (same names, same
parameters), plus 141 new ones (the full VPN suite, system/network tools, bridge,
address-lists, scheduler, certificates, IP services). Because the MIKROTIK_*
environment variables are identical, migration is usually just swapping the
command. The legacy Python source remains in mikrotik-mcp/ for
reference.
Documentation
Doc | |
Install, verify, first run | |
Every env var & flag | |
Claude Desktop, stdio, HTTP | |
stdio / HTTP / SSE, DNS-rebinding | |
Transactional changes | |
Every tunnel type + how to build it | |
The 8 guided workflows | |
How it's built | |
Credentials, risk gating | |
All 310 tools | |
Build, test, deploy |
Development
bun run test:types # tsc --noEmit
bun test # unit tests
bun run gen # regenerate schemas/ + docs/tools-reference.md from source
bun run build # bundle to dist/See docs/development.md and CONTRIBUTING.md.
Security
Talks to RouterOS over SSH using credentials you supply; nothing is sent anywhere else. Tool values are quoted/escaped to prevent console-command injection. Destructive and dangerous tools are annotated so clients can require confirmation, and a plaintext-password-in-a-container warning nudges you toward key files or secrets. Details: docs/security.md. Only point this at devices you're authorized to manage.
License
MIT. Reuse freely. No warranty.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ali-master/mikrotik-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server