-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
MikroMCP is a Model Context Protocol server that connects AI assistants like Claude, Cursor, and Codex directly to your MikroTik RouterOS infrastructure. Instead of copying CLI snippets from chat into a terminal, your AI assistant calls typed, validated tools that talk to the router's REST API — with dry-run previews, idempotency checks, and audit logs built in.
This guide takes you from zero to a working AI ↔ router connection in about 15 minutes.
- MikroTik router running RouterOS 7.x (the REST API requires ROS 7)
- Node.js 22 or newer — download from nodejs.org
- An AI assistant: Claude Desktop, Claude Code, Cursor, or Codex
The REST API must be enabled on your router before MikroMCP can connect. See RouterOS-API-Setup.md for the full walkthrough including TLS, firewall rules, and user policies.
Quick version using the RouterOS CLI:
/ip service enable api-ssl
/ip service set api-ssl port=443
/user add name=mcp-api group=full password=choose-a-strong-password
For a read-only setup (list/inspect tools only), use group=read instead.
npm install -g mikromcpAfter installation, mikromcp is available as a global command.
Download the binary for your platform from the latest GitHub release — Linux (x64/arm64), macOS (x64/arm64), and Windows (x64) are published. Make it executable and run it in place of the mikromcp command:
chmod +x mikromcp-linux-x64
./mikromcp-linux-x64 doctordocker pull ghcr.io/alikarami/mikromcp:latestSee Connecting to AI Assistants for a full Docker run example (HTTP mode, config mounting).
git clone https://github.com/AliKarami/MikroMCP.git
cd MikroMCP
npm install
npm run buildWith the source install, replace mikromcp with node /path/to/MikroMCP/dist/main.js in all commands below.
MikroMCP ships with an interactive setup wizard that generates your config files and tests your router connection in one step:
mikromcp initThe wizard will:
- Ask for your router's IP, port, and TLS settings
- Ask for a router ID (e.g.
core-01) and credentials - Write
~/.mikromcp/routers.yamland~/.mikromcp/.env(includingMIKROMCP_DEFAULT_ROUTERset to your router ID) - Optionally register the server with Claude Desktop
- Print next-step instructions including a pointer to the usage skill
Once complete, skip to Step 5.
Tip: Because the wizard sets
MIKROMCP_DEFAULT_ROUTER, you can omitrouterIdin tool calls for single-router setups. MikroMCP will route to your configured router automatically.
If you prefer to configure by hand, create config/routers.yaml:
routers:
core-01:
host: "10.0.0.1"
port: 443
tls:
enabled: true
rejectUnauthorized: false # set true once you have a valid cert
credentials:
source: "env"
envPrefix: "ROUTER_CORE01" # env vars: ROUTER_CORE01_USER / ROUTER_CORE01_PASS
tags: ["core"]
rosVersion: "7.14"And a .env file:
ROUTER_CORE01_USER=mcp-api
ROUTER_CORE01_PASS=choose-a-strong-passwordUse the built-in doctor command to check everything is working:
mikromcp doctorThis probes your router for REST API availability, tests authentication, and reports any issues with fix suggestions.
You can also test directly against the RouterOS REST API:
curl -sk https://10.0.0.1/rest/system/resource \
--user mcp-api:your-password | python3 -m json.toolCommon issues:
| Symptom | Cause | Fix |
|---|---|---|
Connection refused |
REST API not enabled or wrong port | Run /ip service print on the router; enable api-ssl
|
SSL handshake failed |
TLS mismatch | Set rejectUnauthorized: false in routers.yaml for self-signed certs |
401 Unauthorized |
Wrong credentials | Double-check ROUTER_CORE01_USER and ROUTER_CORE01_PASS
|
403 Forbidden |
User lacks rest-api policy |
See RouterOS-API-Setup.md — required policies table |
- Claude Desktop → see Connecting-to-Claude-Desktop.md
- Claude Code (CLI) → see Connecting-to-AI-Assistants.md
- Cursor → see Connecting-to-AI-Assistants.md
- Codex → see Connecting-to-AI-Assistants.md
- Remote / Docker / service deployment → see Connecting-to-AI-Assistants.md
The MikroMCP usage skill teaches your AI assistant how to use all 117 tools safely — dry-run before write, rollback patterns, fleet operations, and more. Install it once in Claude Code:
/mikromcpSee Using-the-Skill for full installation and usage instructions.
Once connected, paste these prompts into your AI assistant to confirm everything works:
List all interfaces on my router
Show me the firewall rules on core-01
What's the CPU and memory usage right now?
Are there any active DHCP leases?
Ping 8.8.8.8 from core-01 and tell me the round-trip time
You should see the assistant call MikroMCP tools and return real data from your router. Each tool call appears in the assistant's tool-use panel so you can see exactly what was sent.
"Connection refused" on port 443
The RouterOS REST API (api-ssl) is not running, or a firewall is blocking the port. On the router: /ip service print — confirm api-ssl shows enabled. Add a firewall rule if MikroMCP runs on a separate host; see RouterOS-API-Setup.md.
"Authentication failed" / 401
Check that ROUTER_CORE01_USER and ROUTER_CORE01_PASS are exported in the environment where MikroMCP runs. Variable names must match the envPrefix in routers.yaml — prefix ROUTER_CORE01 → variables ROUTER_CORE01_USER and ROUTER_CORE01_PASS.
"Router not found"
The routerId you used in the prompt (core-01) does not match a key in routers.yaml. Router IDs are case-sensitive.
"Permission denied" / 403
The RouterOS user lacks the rest-api policy, or the specific tool requires additional policies (e.g. write, test, ssh). See the Required Policies table in RouterOS-API-Setup.md.
Tools not appearing in the assistant
The MCP server did not register successfully. Check the server logs for startup errors. For Claude Desktop, make sure you fully quit and reopened the app after editing the config — Cmd+Q on macOS, not just closing the window.