@ai-solutions.ru/mikrotik-mcp-server
High-performance TypeScript MCP server for MikroTik RouterOS management, enabling Claude, GPT-4, or any MCP-compatible AI to manage routers through natural language with dynamic API discovery, VPN management, and configuration backup.
README
@ai-solutions.ru/mikrotik-mcp-server
High-performance TypeScript MCP (Model Context Protocol) server for MikroTik RouterOS management. Connect Claude, GPT-4, or any MCP-compatible AI to your MikroTik router and manage it through natural language.
npx @ai-solutions.ru/mikrotik-mcp-server
🚀 Why This Server?
| Feature | This server | jeff-nasseri/mikrotik-mcp | kevinpez (nested fork) |
|---|---|---|---|
| Language | TypeScript / Node.js | Python | Python |
| Dynamic API Discovery | ✅ Browse full RouterOS API tree | ❌ | ❌ |
Structured JSON output (structuredContent) |
✅ Every tool | ❌ | ❌ |
| Zod output schemas | ✅ Typed & validated | ❌ | ❌ |
| MCP safety annotations | ✅ readOnly/destructive/idempotent |
❌ | ❌ |
| WireGuard VPN management | ✅ list + add peers | ❌ | ❌ |
| IPsec peer management | ✅ | ❌ | ❌ |
| Configuration backup & export | ✅ binary + script export | ❌ | ❌ |
| Raw command execution (escape hatch) | ✅ execute_command |
❌ | ❌ |
| Pagination on all list tools | ✅ limit/offset | partial | partial |
| Smart output truncation | ✅ auto-hint for large results | ❌ | ❌ |
| In-memory caching | ✅ discovery cache | ❌ | ❌ |
| MCP SDK version | 1.16+ (latest) | old | old |
| Install via npx | ✅ zero config | ❌ pip install | ❌ pip install |
✨ Unique Features
1. Dynamic API Discovery (unique in ecosystem)
Browse the entire RouterOS API tree without needing to know command paths in advance. The AI can explore unknown router configurations autonomously.
→ mikrotik_discover_endpoints(path: "/ip")
Returns: address, arp, dhcp-client, dhcp-server, dns, firewall, hotspot, ipsec, ...
→ mikrotik_get_endpoint_schema(path: "/ip/firewall/filter")
Returns: available commands (print, add, remove, set, enable, disable) and parameters
This means Claude can discover and interact with any RouterOS subsystem — including packages you've installed, containers, advanced routing, hardware-specific features — without the server needing hardcoded knowledge of them.
2. Structured Content + Zod Output Schemas
Every tool returns both human-readable Markdown and machine-readable JSON via structuredContent. The JSON is validated against Zod schemas, giving you typed, predictable data structures that work with MCP clients that support structured output.
// Example: mikrotik_list_ip_addresses returns
{
content: [{ type: "text", text: "# IP Addresses\n..." }], // ← Markdown for AI
structuredContent: { // ← Typed JSON for clients
total: 5,
addresses: [{ id: "*1", address: "192.168.1.1/24", interface: "bridge", ... }]
}
}
3. MCP Safety Annotations
Tools are annotated with MCP 2025 safety hints so AI clients can present appropriate warnings:
readOnlyHint: true— safe to call without side effects (list/print operations)destructiveHint: true— modifies router state (add/remove/reboot)idempotentHint: true— safe to retryopenWorldHint: true— queries live state from router
The reboot tool additionally requires confirm: true parameter as an extra safety gate.
4. VPN Management (WireGuard + IPsec)
First MikroTik MCP server with WireGuard peer management:
- List all WireGuard peers with traffic stats
- Add new WireGuard peers with endpoint and allowed addresses
- List IPsec peers with profiles
- Graceful handling when WireGuard package isn't installed
5. Raw Command Execution
mikrotik_execute_command provides a full escape hatch to the RouterOS API — execute any RouterOS command with any parameters. This enables AI to handle edge cases, new RouterOS features, or complex operations not covered by specialized tools.
6. Configuration Backup & Export
mikrotik_create_backup— binary RouterOS backup (survives factory reset)mikrotik_export_config— human-readable script export with statistics (line count, command count, size)
📋 Full Tool Reference
🖥 System (2 tools)
| Tool | Description | Annotations |
|---|---|---|
mikrotik_system_info |
CPU, RAM, storage, uptime, version, board info | readOnly |
mikrotik_system_reboot |
Reboot device (requires confirm: true) |
destructive |
🔌 Interfaces (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_interfaces |
List all interfaces with type filter + pagination |
mikrotik_get_interface |
Get detailed info for specific interface |
mikrotik_configure_interface |
Enable/disable, set MTU, comment |
🌐 IP Addresses (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_ip_addresses |
List all IP addresses with interface filter + pagination |
mikrotik_add_ip_address |
Add IP address to interface |
mikrotik_remove_ip_address |
Remove IP address by ID |
🔥 Firewall (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_firewall_rules |
List filter rules with chain filter + pagination |
mikrotik_add_firewall_rule |
Add filter rule with full parameter support |
mikrotik_remove_firewall_rule |
Remove rule by ID |
📡 DHCP (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_dhcp_leases |
List leases with status filter + pagination |
mikrotik_add_static_lease |
Assign static IP to MAC address |
mikrotik_list_dhcp_servers |
List configured DHCP servers |
🔍 DNS (2 tools)
| Tool | Description |
|---|---|
mikrotik_list_dns_static |
List static DNS records with pagination |
mikrotik_add_dns_record |
Add A/AAAA/CNAME static DNS record |
🗺 Routing (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_routes |
List all routes with pagination |
mikrotik_add_route |
Add static route with distance and routing table |
mikrotik_list_nat_rules |
List NAT rules with chain filter + pagination |
🔐 VPN (3 tools)
| Tool | Description |
|---|---|
mikrotik_list_wireguard_peers |
List WireGuard peers with traffic stats |
mikrotik_add_wireguard_peer |
Add WireGuard peer with endpoint |
mikrotik_list_ipsec_peers |
List IPsec peers with profiles |
💾 Backup (2 tools)
| Tool | Description |
|---|---|
mikrotik_create_backup |
Create binary system backup |
mikrotik_export_config |
Export config as text script with statistics |
⚡ Execute (1 tool)
| Tool | Description |
|---|---|
mikrotik_execute_command |
Execute any RouterOS API command (destructive) |
🔭 Discovery (2 tools)
| Tool | Description |
|---|---|
mikrotik_discover_endpoints |
Browse RouterOS API tree at any path |
mikrotik_get_endpoint_schema |
Get available commands & params for endpoint |
Total: 27 tools + 4 MCP resources
📦 MCP Resources
| Resource URI | Description |
|---|---|
routeros://system/info |
Live system info snapshot |
routeros://interfaces |
All interface states |
routeros://firewall/rules |
Full firewall ruleset |
routeros://routing/routes |
All routing table entries |
🔧 Installation & Setup
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"mikrotik": {
"command": "npx",
"args": ["-y", "@ai-solutions.ru/mikrotik-mcp-server"],
"env": {
"MIKROTIK_HOST": "192.168.88.1",
"MIKROTIK_USER": "admin",
"MIKROTIK_PASSWORD": "yourpassword",
"MIKROTIK_PORT": "8728",
"MIKROTIK_SECURE": "false"
}
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
MIKROTIK_HOST |
192.168.88.1 |
Router IP or hostname |
MIKROTIK_USER |
admin |
API username |
MIKROTIK_PASSWORD |
(required) | API password |
MIKROTIK_PORT |
8728 |
RouterOS API port (8729 for TLS) |
MIKROTIK_SECURE |
false |
Use TLS (requires port 8729) |
MIKROTIK_TIMEOUT |
10000 |
Connection timeout in ms |
DISCOVERY_CACHE_TTL |
300 |
Discovery cache TTL in seconds |
Enable RouterOS API
In RouterOS WebFig or terminal:
/ip service enable api
For TLS: /ip service enable api-ssl
💬 Example Conversations
"What's the current state of my router?"
Calls
mikrotik_system_info→ Returns device name, RouterOS version, CPU load, RAM usage, uptime
"Show me all firewall rules that drop traffic"
Calls
mikrotik_list_firewall_rules(chain="forward")→ Filters by action=drop
"Add a static DNS record for myserver.local pointing to 10.0.0.50"
Calls
mikrotik_add_dns_record(name="myserver.local", address="10.0.0.50")
"List all WireGuard peers and their traffic stats"
Calls
mikrotik_list_wireguard_peers()→ Returns peers with RX/TX bytes
"What API endpoints are available under /container?"
Calls
mikrotik_discover_endpoints(path="/container")→ Browses RouterOS container API
"Export the full router config as a backup script"
Calls
mikrotik_export_config()→ Returns full RouterOS export with stats
🏗 Architecture
src/
├── index.ts # Entry point, env config
├── server.ts # MCP server + tool/resource registration
├── constants.ts # Configuration constants
├── routeros/
│ └── client.ts # RouterOS API client (node-routeros)
├── cache/
│ └── memory.ts # LRU in-memory cache
├── discovery/
│ └── service.ts # Dynamic API discovery service
├── tools/
│ ├── system.ts # System info & reboot
│ ├── interfaces.ts # Interface management
│ ├── ip-address.ts # IP address CRUD
│ ├── firewall.ts # Firewall rules
│ ├── dhcp.ts # DHCP leases & servers
│ ├── dns.ts # Static DNS records
│ ├── routing.ts # Routes & NAT
│ ├── vpn.ts # WireGuard & IPsec
│ ├── backup.ts # Backup & export
│ ├── execute.ts # Raw command execution
│ └── discovery.ts # API discovery tools
├── resources/
│ ├── system-info.ts # System resource
│ ├── interfaces.ts # Interfaces resource
│ ├── firewall.ts # Firewall resource
│ └── routing.ts # Routing resource
└── utils/
├── format.ts # Formatting, truncation, pagination
├── errors.ts # RouterOS error handling
└── logger.ts # Structured logging
🔒 Security Notes
- All write operations carry
destructiveHint: trueannotation - Reboot requires explicit
confirm: trueparameter - Credentials are passed via environment variables (never in code)
- TLS support via
MIKROTIK_SECURE=true+ port 8729 - Consider using a read-only RouterOS API user for monitoring-only setups
📜 License
MIT © AI Solutions
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。