MikroMCP

AI-native network automation for MikroTik RouterOS. MikroMCP exposes RouterOS as a typed, auditable Model Context Protocol server so Claude, Cursor, Codex, and other MCP clients can inspect, diagnose, and safely operate MikroTik routers in natural language.

MikroMCP

MikroMCP

AI-native network automation for MikroTik RouterOS. MikroMCP exposes RouterOS as a typed, auditable Model Context Protocol server so Claude, Cursor, Codex, and other MCP clients can inspect, diagnose, and safely operate MikroTik routers in natural language.

CI Release Version License: MIT Node.js >= 22 RouterOS 7.x MCP Server Tools

MikroMCP exists because raw router CLI access is the wrong abstraction for AI agents. RouterOS is powerful, but asking an LLM to improvise shell commands against production network gear is risky. MikroMCP gives agents a controlled tool surface: strict schemas, idempotent writes, dry-run previews, per-router circuit breakers, retry policies, RBAC, audit logs, snapshots, and rollback-aware change workflows.

In one sentence: MikroMCP turns MikroTik RouterOS into a production-minded MCP control plane for AI infrastructure, DevOps automation, and modern router management.

AI assistant connected through MikroMCP to a small MikroTik fleet, with tool calls flowing through validation, audit, and RouterOS REST


Why It Matters

Instead of...MikroMCP gives you...
Hand-written RouterOS CLI snippets from chatTyped MCP tools with strict Zod validation
Blind config changesDry-run previews, idempotency checks, snapshots, and rollback tooling
One-off scripts per routerA multi-router registry with per-router credentials, tags, TLS, SSH, and maintenance windows
Raw network access for every assistantRBAC identities, bearer tokens for HTTP mode, tool allowlists, and audit trails
Fragile troubleshooting workflowsRouter-originated ping, traceroute, torch, logs, interfaces, DHCP, firewall, routes, WiFi, WireGuard, and more

MikroMCP is especially useful when you want AI agents to help with network operations without giving them unchecked terminal access.


Feature Showcase

CategoryWhat MikroMCP covers
๐Ÿงญ Router managementSystem status, clock, reboot, packages, files, scripts, scheduler jobs, containers
๐ŸŒ Network operationsInterfaces, VLANs, IP addresses, DHCP leases, DNS static records, bridge ports, WiFi clients
๐Ÿ”ฅ Firewall and policyFilter/NAT rules, mangle rules, address lists, route tables, routing rules
๐Ÿ›ฐ๏ธ Routing visibilityStatic routes, routing tables, BGP peers, OSPF neighbors
๐Ÿ” Secure accessHTTP bearer auth, bcrypt token hashes, RBAC, router/tool restrictions, confirmation tokens
๐Ÿงช DiagnosticsRouter-originated ping, traceroute, torch, log filtering, guarded SSH command execution
๐Ÿ›ก๏ธ Change safetyDry-run, idempotent writes, snapshots, write journal, plan_changes, apply_plan, rollback_change
โš™๏ธ Production behaviorRetries for read tools, per-router circuit breakers, correlation IDs, structured logs, audit logs
๐Ÿค– AI-agent fitHuman-readable responses plus structured JSON content for reasoning, chaining, and automation
๐Ÿงฉ MCP compatibilitystdio for desktop clients, Streamable HTTP and legacy SSE for remote or service-style clients

Best-in-class strengths: MikroMCP is not just a thin REST wrapper. It models operational safety around RouterOS: typed tool contracts, safe write patterns, router-aware credentials, destructive-action gates, and rollback-oriented workflows.


Demo

Usage

MCP Inspector

The 77 registered MikroMCP tools with schemas


Quick Start

Prerequisites

  • Node.js 22 or newer
  • MikroTik RouterOS 7.x with the REST API enabled
  • A RouterOS user with the policies required by the tools you plan to use
  • Git and npm

Recommended RouterOS policies for full tool coverage:

read, write, api, rest-api, test, ssh, sniff, ftp

Notes:

  • ssh is required for ping, traceroute, torch, and run_command.
  • sniff is required by torch.
  • ftp is required only for upload_file.

Install Locally

git clone https://github.com/AliKarami/MikroMCP.git
cd MikroMCP
npm install
npm run build
cp config/routers.example.yaml config/routers.yaml
cp config/identities.example.yaml config/identities.yaml

Edit config/routers.yaml:

routers:
  core-01:
    host: "10.0.0.1"
    port: 443
    tls:
      enabled: true
      rejectUnauthorized: true
    credentials:
      source: "env"
      envPrefix: "ROUTER_CORE01"
    tags: ["core", "production"]
    rosVersion: "7.14"

Provide router credentials through environment variables:

export ROUTER_CORE01_USER="mcp-api"
export ROUTER_CORE01_PASS="your-router-password"
npm start

Docker

Pull and run

docker pull ghcr.io/alikarami/mikromcp:latest

One-liner with environment variables:

docker run --rm \
  -e MIKROMCP_TRANSPORT=http \
  -e MIKROMCP_PORT=3000 \
  -e MIKROMCP_CONFIRMATION_SECRET="$(openssl rand -hex 32)" \
  -e ROUTER_CORE01_USER=mcp-api \
  -e ROUTER_CORE01_PASS=your-router-password \
  -v "$(pwd)/config:/app/config:ro" \
  -p 3000:3000 \
  ghcr.io/alikarami/mikromcp:latest

Docker Compose

Copy the example file and fill in your .env:

cp docker-compose.example.yml docker-compose.yml
cp config/routers.example.yaml config/routers.yaml
cp config/identities.example.yaml config/identities.yaml
# edit config/routers.yaml and set MIKROMCP_CONFIRMATION_SECRET + router credentials in .env
docker compose up -d

See docker-compose.example.yml for the full service definition.

Build from source

docker build -t mikromcp .
docker run --rm -e MIKROMCP_TRANSPORT=http -p 3000:3000 mikromcp

Connect An MCP Client

Claude Desktop

Add MikroMCP to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS:

{
  "mcpServers": {
    "mikrotik": {
      "command": "node",
      "args": ["/absolute/path/to/MikroMCP/dist/main.js"],
      "env": {
        "MIKROMCP_CONFIG_PATH": "/absolute/path/to/MikroMCP/config/routers.yaml",
        "ROUTER_CORE01_USER": "mcp-api",
        "ROUTER_CORE01_PASS": "your-router-password"
      }
    }
  }
}

Restart Claude Desktop, then ask:

Use MikroMCP to show CPU, memory, uptime, active interfaces, and warning logs for core-01.

HTTP / SSE Mode

HTTP mode is useful for service deployments and MCP clients that connect over a local or private network endpoint.

export MIKROMCP_TRANSPORT=http
export MIKROMCP_PORT=3000
export MIKROMCP_BIND_HOST=127.0.0.1
export MIKROMCP_CONFIRMATION_SECRET="$(openssl rand -hex 32)"
export ROUTER_CORE01_USER="mcp-api"
export ROUTER_CORE01_PASS="your-router-password"
npm start

Every HTTP/SSE request must include:

Authorization: Bearer <token>

Tokens are configured as bcrypt hashes in config/identities.yaml.


Configuration Reference

VariableDefaultPurpose
MIKROMCP_TRANSPORTstdiostdio or http
MIKROMCP_CONFIG_PATHconfig/routers.yamlRouter registry path
MIKROMCP_IDENTITIES_PATHconfig/identities.yamlIdentity and bearer-token registry
MIKROMCP_STDIO_IDENTITYbuilt-in superadminNamed identity for stdio mode
MIKROMCP_PORT3000HTTP transport port
MIKROMCP_BIND_HOST127.0.0.1HTTP bind address
MIKROMCP_CONFIRMATION_SECRETunsetHMAC secret for destructive-action confirmation tokens
MIKROMCP_AUDIT_LOG_PATHunsetOptional NDJSON audit log file path
MIKROMCP_HTTP_MAX_BODY_BYTES1048576HTTP request body cap
MIKROMCP_HTTP_RATE_LIMIT_RPM60Requests per minute per IP; 0 disables rate limiting
MIKROMCP_SSH_COMMAND_TIMEOUT_MS30000SSH command timeout
MIKROMCP_SSH_MAX_OUTPUT_BYTES524288SSH output cap
MIKROMCP_CMD_ALLOWunsetGlobal allowlist patterns for run_command
MIKROMCP_CMD_DENYunsetGlobal denylist patterns for run_command
ROUTER_<PREFIX>_USERunsetRouter username from envPrefix
ROUTER_<PREFIX>_PASSunsetRouter password from envPrefix

Available Tools

MikroMCP currently registers 77 MCP tools.

AreaTools
Systemget_system_status, get_system_clock, set_system_clock, reboot
Interfaces and IPlist_interfaces, create_vlan, manage_ip_address
DHCP and DNSlist_dhcp_leases, list_dns_entries, manage_dns_entry, get_dns_settings
DHCP Servers & Poolslist_dhcp_servers, manage_dhcp_server, list_dhcp_pools, manage_dhcp_pool
Routinglist_routes, manage_route, list_routing_rules, manage_routing_rule, list_routing_tables, manage_routing_table
Routing protocolslist_bgp_peers, list_ospf_neighbors
Firewalllist_firewall_rules, manage_firewall_rule, list_mangle_rules, manage_mangle_rule, list_address_list_entries, manage_address_list_entry
Bridge, WiFi, WireGuardlist_bridges, manage_bridge, manage_bridge_port, list_wifi_interfaces, list_wifi_clients, manage_wifi_interface, list_wireguard_interfaces, list_wireguard_peers, manage_wireguard_peer
IPSec/VPNlist_ipsec_peers, list_ipsec_policies, manage_ipsec_peer
Certificateslist_certificates, manage_certificate
Userslist_users, manage_user
Queues/QoSlist_queues, manage_queue
VRRPlist_vrrp_instances, manage_vrrp_instance
SNMP & NTPget_snmp_settings, get_ntp_settings
Netwatchlist_netwatch_entries, manage_netwatch_entry
Discovery & ARPlist_neighbors, list_arp_entries
Diagnosticsping, traceroute, torch, get_log, run_command
Automationlist_scripts, manage_script, run_script, list_scheduled_jobs, manage_scheduled_job
Runtimelist_packages, manage_package, list_files, get_file_content, upload_file, list_containers, manage_container
Change managementplan_changes, apply_plan, rollback_change
Fleet operationscheck_router_health, bulk_execute
mindmap
  root((MikroMCP tools))
    Operations
      System status
      Logs
      Clock
      Reboot
    Network
      Interfaces
      VLANs
      DHCP
      DNS
      WiFi
      WireGuard
    Policy
      Firewall
      NAT
      Mangle
      Address lists
      Routing rules
    Automation
      Scripts
      Scheduler
      Files
      Containers
    Safety
      Plan changes
      Apply plan
      Rollback change

Real-World Usage Examples

Router Inspection

Use MikroMCP to inspect core-01. Summarize system resources, RouterOS version,
running interfaces, active routes, DNS settings, and recent warning/error logs.
Flag anything that looks operationally risky.

Firewall Management

List firewall filter and NAT rules on edge-01. Identify disabled rules,
overlapping port forwards, broad accept rules, and anything without comments.
Do not change anything yet.

Safe Static Route Change

Dry-run a route on core-01 for 10.20.0.0/16 via 192.168.88.1 in the main table.
Show the exact planned diff and tell me whether an existing route conflicts.

WireGuard Operations

Show WireGuard peers on branch-02. Sort by last handshake age and flag peers
that have not handshaken recently or have no transfer counters.

Interface Diagnostics

Check interface health on edge-01, then run ping and traceroute from the router
to 1.1.1.1. If packet loss is present, use torch on the WAN interface for a
short traffic snapshot.

Configuration Backup And Audit

List files, scripts, scheduled jobs, firewall rules, DNS static records, and
routes on core-01. Produce an audit summary with change-risk notes and suggested
cleanup tasks.

Plan / Apply / Rollback Workflow

Create a change plan that adds a DNS record and a firewall address-list entry
on edge-01. Use dry-run first, explain the plan, then wait for approval before
applying anything.

Why MikroMCP Is Useful For AI Agents

MCP gives LLMs a standard way to call tools. MikroMCP makes RouterOS a high-quality MCP target by turning network operations into well-described, machine-readable, permission-aware actions.

AI assistants can use MikroMCP to:

  • Investigate router state without memorizing RouterOS command syntax.
  • Chain tool calls across interfaces, routes, firewall rules, logs, and diagnostics.
  • Return both operator-friendly summaries and structured JSON for follow-up reasoning.
  • Preview changes before mutation and explain exactly what would happen.
  • Respect tool-level authorization, router scoping, maintenance windows, and confirmation gates.

This makes MikroMCP a practical bridge between MikroTik networks and the emerging AI infrastructure ecosystem: Claude MCP, LLM tooling, infrastructure automation, DevOps workflows, and network operations copilots.


Documentation

ResourceUse it for
ROADMAP.mdShipped milestones and planned v1.0 work
ArchitectureSystem layers and request pipeline
Setup GuideRouterOS REST setup and end-to-end onboarding
ConfigurationRouter registry, TLS, SSH, credentials, HTTP mode
RunningLocal development and production commands
Connecting to an MCP ClientClaude Desktop, Claude Code, Cursor, and other MCP clients
Available ToolsTool parameters and example prompts
Error HandlingTyped errors, retry behavior, circuit breaker behavior
DevelopmentProject structure, tests, MCP Inspector workflow
ContributingAdding tools, coding conventions, PR checklist
RoadmapWiki mirror of the milestone roadmap

Development

npm run dev          # tsx watch hot-reload
npm run build        # build ESM output to dist/main.js
npm start            # run built server
npm test             # run Vitest once
npm run typecheck    # TypeScript type checking
npm run lint         # ESLint
npm run format       # Prettier

Run this before committing:

npm test
npm run typecheck

Key project paths:

PathPurpose
src/main.tsLoads config and starts stdio or HTTP transport
src/mcp/tool-registry.tsRegisters tools and applies auth, retry, circuit breaker, audit, snapshots, and credentials
src/domain/tools/Tool definitions and handlers
src/domain/snapshot/Snapshot, diff, and write-journal support
src/adapter/rest-client.tsRouterOS REST API client
src/adapter/ssh-client.tsSSH execution adapter for diagnostics and guarded commands
src/config/router-registry.tsRouter inventory loader
config/routers.example.yamlExample multi-router registry
config/identities.example.yamlExample RBAC identity registry

Roadmap

MilestoneStatusFocus
v0.1-v0.6โœ… ShippedFoundation, core tools, diagnostics, services, firewall, routing, automation, files, containers
v0.7โœ… ShippedIdentity, bearer auth, RBAC, audit log, confirmation gate
v0.8โœ… ShippedSnapshots, write journal, plan/apply, rollback, maintenance windows
v0.9โœ… ShippedFleet operations, IPSec, certificates, users, DHCP servers/pools, queues/QoS, VRRP, SNMP/NTP, Netwatch, discovery, ARP, health checks
v1.0๐Ÿ”œ PlannedDocker/npm/systemd distribution, Prometheus metrics, CHR integration tests, doctor CLI, stability policy

See ROADMAP.md for the complete milestone plan.


Contributing

Issues, bug reports, tool requests, documentation improvements, and pull requests are welcome.

Good first contributions:

  • Add a read-only tool for an uncovered RouterOS surface.
  • Improve the wiki tool reference with examples and parameter tables.
  • Add screenshots, demo GIFs, or topology diagrams.
  • Expand tests around RouterOS response normalization and idempotency edge cases.
  • Help validate RouterOS version compatibility across real MikroTik devices and CHR.

Development standards:

  • TypeScript strict mode
  • ESM imports with .js extensions
  • Zod schemas with .strict()
  • Idempotency and dryRun for write tools
  • MikroMCPError for domain errors
  • Focused Vitest coverage for every tool

Please open an issue before large changes so maintainers can align on scope.


Security

MikroMCP is designed for sensitive infrastructure, but it still controls real network devices. Treat it like an operations system.

  • Use least-privilege RouterOS users.
  • Prefer TLS verification and certificate fingerprint pinning.
  • Pin SSH host-key fingerprints for SSH-enabled tools.
  • Keep router credentials in environment variables or a secrets system, not YAML.
  • Use HTTP mode behind a trusted network boundary.
  • Configure identities with the smallest practical allowedRouters and allowedToolPatterns.
  • Enable audit logging for shared or production use.
  • Test write tools with dryRun: true before applying changes.

For vulnerabilities or unsafe behavior, open a private security advisory if available, or contact the maintainer before publishing exploit details.


Community And Support

  • โญ Star the repository if MikroMCP helps your MikroTik or MCP workflow.
  • ๐Ÿด Fork it to add RouterOS surfaces your network depends on.
  • ๐Ÿงต Open an issue for bugs, feature requests, compatibility notes, or documentation gaps.
  • ๐Ÿ›ฃ๏ธ Follow the roadmap for upcoming fleet, distribution, and production-readiness work.

License

MikroMCP is released under the MIT License.

Related Servers