MikroTik RouterOS MCP
Enables managing MikroTik RouterOS devices via natural language, with read-heavy network inspection and guarded write access across multiple routers.
README
<p align="center"> <img src="assets/banner.svg" alt="MikroTik RouterOS MCP" width="100%"> </p>
MikroTik RouterOS MCP
<p align="center"> <a href="https://github.com/drohi-r/mikrotik-routeros-mcp/actions/workflows/ci.yml"><img src="https://github.com/drohi-r/mikrotik-routeros-mcp/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://github.com/drohi-r/mikrotik-routeros-mcp/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-orange?style=for-the-badge" alt="License"></a> <img src="https://img.shields.io/badge/Python-3.12%2B-blue?style=for-the-badge" alt="Python 3.12+"> <img src="https://img.shields.io/badge/MCP_Tools-24-2196F3?style=for-the-badge" alt="24 MCP Tools"> </p>
An MCP server for MikroTik RouterOS with a lightweight web dashboard for multi-router management. Exposes 24 MCP tools covering transport fallback (API → API-SSL → SSH), read-heavy network inspection, and guarded write access, while the bundled dashboard provides a simple REST-backed UI for viewing routers and common network state.
Quick start
git clone https://github.com/drohi-r/mikrotik-routeros-mcp && cd mikrotik-routeros-mcp
uv sync
# Configure devices
cp devices.yaml.example devices.yaml # then edit with your router details
# Run the MCP server
uv run python -m mikrotik_routeros_mcp.server
# Or run the web dashboard
uv run python -m mikrotik_routeros_mcp.dashboard --host 0.0.0.0 --port 8080
The server looks for config in this order: MIKROTIK_ROUTEROS_CONFIG env var → ./devices.yaml → ./devices.yml → ./devices.json.
Architecture
graph TD
A["MikroTik RouterOS MCP Server<br/><code>mikrotik_routeros_mcp</code><br/>24 tools · safety gate"] --> B
B["Transport Layer<br/>Fallback: API → API-SSL → SSH"] --> C
C["RouterOS Devices<br/>Named targets from devices.yaml"]
D["Multi-Device Config<br/>Named routers · tags · per-device write control"] -.-> A
E["Guarded Write Flow<br/>plan_script_change → apply_script_change"] -.-> A
F["SSH Fallback<br/>Config export · limited-API environments"] -.-> B
style A fill:#1a1a2e,stroke:#2196F3,color:#fff
style B fill:#1a1a2e,stroke:#2196F3,color:#fff
style C fill:#1a1a2e,stroke:#0f3460,color:#fff
style D fill:#0f3460,stroke:#0f3460,color:#fff
style E fill:#0f3460,stroke:#0f3460,color:#fff
style F fill:#0f3460,stroke:#0f3460,color:#fff
Configuration
Device config example:
devices:
- name: home
host: 192.168.88.1
username: admin
password: change-me
transport_order:
- api
- api-ssl
- ssh
allow_writes: false
tags:
- home
- lab
- name: office
host: office-router.example.com
username: admin
password: change-me
fallback_ip: 203.0.113.10
transport_order:
- api-ssl
- ssh
allow_writes: false
tags:
- office
- production
Tools
Server and discovery
| Tool | What it does |
|---|---|
get_server_config |
Return current MCP server configuration and safety settings |
list_devices |
List all configured RouterOS devices |
describe_device |
Return detailed info for a named device |
System and network reads
| Tool | What it does |
|---|---|
system_info |
Return system identity, version, uptime, and hardware info |
interfaces |
List all network interfaces with status |
ip_addresses |
List IP addresses assigned to interfaces |
routes |
List the routing table |
firewall_filters |
List firewall filter rules |
nat_rules |
List NAT rules |
dns_settings |
Return DNS configuration |
dhcp_servers |
List DHCP server instances |
dhcp_leases |
List DHCP leases |
address_lists |
List firewall address list entries |
bridges |
List bridge interfaces |
bridge_ports |
List bridge port memberships |
neighbors |
List discovered network neighbors |
wireguard_interfaces |
List WireGuard interfaces |
wireguard_peers |
List WireGuard peers |
logs |
Retrieve system log entries |
ping |
Ping a target from a device |
export_config |
Export device configuration |
run_api_print |
Read-only API print for any RouterOS path |
Guarded writes
| Tool | What it does |
|---|---|
plan_script_change |
Preview a RouterOS script change with risk assessment |
apply_script_change |
Apply a planned script change with approval code |
Write access is blocked unless the target device has allow_writes: true. The intended workflow is: plan_script_change → inspect risk level and approval code → apply_script_change only if the plan is acceptable.
Claude Desktop
{
"mcpServers": {
"mikrotik-routeros": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mikrotik-routeros-mcp", "python", "-m", "mikrotik_routeros_mcp.server"],
"env": {
"MIKROTIK_ROUTEROS_CONFIG": "/path/to/devices.yaml"
}
}
}
}
VS Code / Cursor
{
"servers": {
"mikrotik-routeros": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mikrotik-routeros-mcp", "python", "-m", "mikrotik_routeros_mcp.server"],
"env": {
"MIKROTIK_ROUTEROS_CONFIG": "/path/to/devices.yaml"
}
}
}
}
Codex
Create a codex.json MCP config file:
{
"mcpServers": {
"mikrotik-routeros": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mikrotik-routeros-mcp", "python", "-m", "mikrotik_routeros_mcp.server"],
"env": {
"MIKROTIK_ROUTEROS_CONFIG": "/path/to/devices.yaml"
}
}
}
}
Then run Codex with:
codex --mcp-config codex.json
Production safety
- Device-scoped targeting — the model must choose a named target router explicitly. No ambient "default device" behavior.
- Write gating — write access is blocked per-device unless
allow_writes: trueis set in config. Read tools are always available. - Guarded write flow —
plan_script_changereturns a risk assessment and approval code.apply_script_changerequires that approval code to proceed. - Transport fallback — attempts
api, thenapi-ssl, thensshin order, so the server connects via the best available transport without manual switching. - Read-only API guard —
run_api_printblocks mutating RouterOS API paths by design. - Input validation — all tools validate parameters before any API call is made. Invalid inputs return structured JSON errors, never raw exceptions.
Development
uv sync
uv run python -m pytest -v
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。