Skip to main content
Glama

mikrotik-mcp

License: MIT Node.js RouterOS MCP Security Docker

Secure, Strictly Read-Only Model Context Protocol (MCP) Server for MikroTik RouterOS v7 REST API.

Features • RouterOS Requirements • Configuration • Client Setup • Docker • Security


📌 Overview

mikrotik-mcp is an official Model Context Protocol (MCP) server that seamlessly connects AI assistants (such as Claude Desktop, Cursor, Antigravity, Cline, or other MCP-compatible clients) to MikroTik RouterOS v7 devices via the native REST API.

Engineered specifically for network observability, performance monitoring, diagnostics, and configuration inspection, this server follows a strict zero-mutation security model to eliminate any risk of accidental router modifications.

🛡️ Zero-Mutation Security Guarantee

  1. 100% Read-Only: All exposed tools perform read-only inspection operations (HTTP GET only).

  2. Hardened HTTP Client: The internal HTTP client enforces GET requests exclusively at the source-code level. Methods for POST, PUT, PATCH, and DELETE do not exist in the client.

  3. No Arbitrary Execution: No arbitrary REST endpoints, CLI command execution, terminal sessions, or script evaluations are exposed.

  4. Least-Privilege Friendly: Requires only read and rest-api policies on the router. It never requires write, policy, password, or sensitive permissions.


Related MCP server: mtik-mcp

⚡ Features & Available Tools

All tools return structured, LLM-friendly JSON output:

Tool Name

Category

Parameters

Description

mikrotik_get_system_resource

System

-

Retrieves hardware and OS resources: CPU load, free/total RAM, storage, uptime, board name, and RouterOS version.

mikrotik_get_system_routerboard

System

-

Fetches RouterBOARD hardware details: model, serial number, current firmware, and factory firmware.

mikrotik_get_system_identity

System

-

Retrieves the router's identity / hostname.

mikrotik_list_interfaces

Interfaces

type (optional)

Lists network interfaces with their operational status (running/disabled), MAC address, MTU, and Tx/Rx traffic stats. Filterable by type (e.g. ether, bridge, vlan).

mikrotik_get_interface_details

Interfaces

nameOrId (required)

Returns complete configuration and live stats for a specific interface by name (ether1) or ID (*1).

mikrotik_get_ip_addresses

IP & Routing

interfaceName (optional)

Lists all configured IP addresses, subnet masks, and their assigned interfaces.

mikrotik_get_ip_routes

IP & Routing

activeOnly (optional)

Retrieves routing table entries (static, connected, and dynamic routes).

mikrotik_get_arp_table

IP & Routing

interfaceName, ipAddress (optional)

Inspects the ARP table (IP-to-MAC address mapping).

mikrotik_get_dhcp_leases

DHCP

hostname, status (optional)

Lists active DHCP server leases: assigned IP, client MAC, host-name, status (bound, waiting), and lease expiration time.

mikrotik_get_firewall_filter_rules

Firewall

chain (optional)

Lists firewall filter rules with hit counters (packets and bytes) and rule comments. Filterable by chain (input, forward, output).

mikrotik_get_firewall_nat_rules

Firewall

chain (optional)

Lists firewall NAT rules (masquerade, dstnat, srcnat, and port forwardings).

mikrotik_get_system_logs

Logs

limit, topic (optional)

Fetches recent router system log entries with optional topic filtering (e.g. error, firewall, system, warning).


🚀 MikroTik RouterOS Setup

1. Enable the REST API Service

Ensure the www-ssl service (HTTPS - port 443) or www service (HTTP - port 80) is enabled on your RouterOS v7 device:

# Check service status
/ip service print

# Enable www-ssl (strongly recommended)
/ip service enable www-ssl

2. Create a Dedicated Read-Only User (Best Practice)

Create a dedicated group and user restricted to read-only API access:

# 1. Create a group with minimal policies: 'read' and 'rest-api' (or 'api')
/user group add name=mcp-readonly policy=read,api,web,rest-api

# 2. Create a dedicated user for the MCP server
/user add name=mcp-agent group=mcp-readonly password="ReplaceWithStrongPassword123!"

⚙️ Configuration

The server can be configured via Environment Variables, CLI arguments, or a .env file (automatically loaded in Node.js 20+):

Variable

CLI Flag

Default

Description

MIKROTIK_HOST

--host

192.168.88.1

IP address or hostname of the MikroTik router

MIKROTIK_PORT

--port

443 (if SSL) / 80

RouterOS REST API port

MIKROTIK_USERNAME

--user / -u

admin

MikroTik login username

MIKROTIK_PASSWORD

--pass / -p

""

MikroTik login password

MIKROTIK_USE_SSL

--ssl / --no-ssl

true

Use HTTPS (true) or plain HTTP (false)

MIKROTIK_ALLOW_INSECURE_SSL

--insecure

true

Allow self-signed internal SSL certificates

MIKROTIK_TIMEOUT

--timeout

15000

Request timeout in milliseconds


🧩 Client Integration

1. Claude Desktop

Add the server entry to your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mikrotik": {
      "command": "node",
      "args": ["/path/to/mikrotik-mcp/dist/index.js"],
      "env": {
        "MIKROTIK_HOST": "192.168.88.1",
        "MIKROTIK_PORT": "443",
        "MIKROTIK_USERNAME": "mcp-agent",
        "MIKROTIK_PASSWORD": "ReplaceWithStrongPassword123!",
        "MIKROTIK_USE_SSL": "true",
        "MIKROTIK_ALLOW_INSECURE_SSL": "true"
      }
    }
  }
}

2. Cursor / Antigravity / OpenCode / Cline

Add the server block to your MCP client configuration:

{
  "mcpServers": {
    "mikrotik": {
      "command": "npx",
      "args": ["-y", "@reyhanfahlevi/mikrotik-mcp"],
      "env": {
        "MIKROTIK_HOST": "192.168.88.1",
        "MIKROTIK_USERNAME": "mcp-agent",
        "MIKROTIK_PASSWORD": "ReplaceWithStrongPassword123!"
      }
    }
  }
}

Note: If running directly from a local clone before publishing to npm, you can point directly to the local folder:

"command": "npx",
"args": ["-y", "/absolute/path/to/mikrotik-mcp"]

🐳 Docker Deployment

The image utilizes a minimal, multi-stage Alpine build without development dependencies and runs under an unprivileged node user.

Build the Image

docker build -t mikrotik-mcp:latest .

Run with Security Hardening

docker run -i --rm \
  --read-only \
  --cap-drop=ALL \
  --security-opt=no-new-privileges:true \
  -e MIKROTIK_HOST="192.168.88.1" \
  -e MIKROTIK_USERNAME="mcp-agent" \
  -e MIKROTIK_PASSWORD="ReplaceWithStrongPassword123!" \
  mikrotik-mcp:latest

Using Docker Compose

Copy .env.example to .env, adjust your credentials, and start the service:

docker compose run --rm mikrotik-mcp

💻 Local Development

# 1. Clone repository
git clone https://github.com/reyhanfahlevi/mikrotik-mcp.git
cd mikrotik-mcp

# 2. Install dependencies
npm install

# 3. Start development server with hot-reload (tsx)
npm run dev

# 4. Build TypeScript to production JavaScript
npm run build

📄 License & Maintainer

Available Tools

12 tools
mikrotik_get_arp_tableB

Get the ARP (Address Resolution Protocol) table to view IP to MAC address mappings.

Inputs: ipAddress, interfaceName.

mikrotik_get_dhcp_leasesC

List DHCP server leases including active client IP addresses, MAC addresses, hostnames, and expiration times.

Inputs: status, hostname.

mikrotik_get_firewall_filter_rulesB

List firewall filter rules with hit counters (packets, bytes) and configuration.

Inputs: chain.

mikrotik_get_firewall_nat_rulesB

List firewall NAT rules (masquerade, dstnat, srcnat).

Inputs: chain.

mikrotik_get_interface_detailsB

Get detailed configuration and statistics for a specific interface by name or ID.

Inputs: nameOrId (required).

mikrotik_get_ip_addressesB

List all IP addresses configured on the MikroTik router interfaces.

Inputs: interfaceName.

mikrotik_get_ip_routesA

List the routing table entries (static, connected, dynamic routes).

Inputs: activeOnly.

mikrotik_get_system_identityA

Get the MikroTik system identity / hostname.

Inputs: no named parameters.

mikrotik_get_system_logsC

Retrieve recent system log entries from the MikroTik router.

Inputs: limit, topic.

mikrotik_get_system_resourceA

Get MikroTik system resources including CPU load, memory usage, uptime, board name, and RouterOS version.

Inputs: no named parameters.

mikrotik_get_system_routerboardA

Get MikroTik RouterBOARD hardware details, model, serial number, and firmware version.

Inputs: no named parameters.

mikrotik_list_interfacesA

List all network interfaces on the MikroTik router along with their status (running, disabled), type, and basic stats.

Inputs: type.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools map to a distinct resource (identity, routerboard, interfaces, IP addresses, routes, ARP, DHCP leases, filter vs NAT rules, logs). The only mild overlap is between get_system_resource and get_system_routerboard, both of which return hardware/system-level information, though the descriptions do differentiate CPU/memory vs board/serial/firmware.

    Naming Consistency4/5

    All tools consistently use the mikrotik_ prefix followed by a verb_noun pattern, which is predictable and readable. The only minor deviation is inconsistent use of get vs list for collection endpoints (mikrotik_list_interfaces but mikrotik_get_ip_addresses), which is semantically meaningful but not strictly uniform.

    Tool Count5/5

    Twelve tools is well within the ideal 3-15 range and each one targets a concrete, commonly needed piece of router telemetry. No tool feels redundant or padding the surface.

    Completeness3/5

    The surface is a coherent read-only inspection set covering system, interfaces, IP, routing, ARP, DHCP, firewall and logs, but it offers zero write operations (no creating/disabling interfaces, adding firewall or NAT rules, IP addresses, or DHCP leases), so any remediation workflow dead-ends. Notable read gaps also exist, such as DNS settings, wireless/registration tables, and interface traffic statistics beyond the details call.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides read-only (with limited address-list management) access to MikroTik RouterOS routers, enabling monitoring of system info, interfaces, DHCP leases, firewall rules, and more via natural language.
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables 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.
      39 npm
      GPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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.
      31 PyPI
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents and NOC staff to inspect TR-069 devices, tasks, faults, files, presets, and provisions through strictly read-only GenieACS NBI GET calls. Secrets and credentials are redacted, with bounded queries and policy guardrails that block write operations before any network request.
      8
      20 npm
      Apache 2.0