Mikrotik

io.github.marcelo-ochoa由 GitHub 帳號 marcelo-ochoa 發布v1.0.6更新於 Oct 24, 2026

MCP server for MikroTik RouterOS API

概覽

AI 產生的概覽

唯讀的 MCP 伺服器,透過 RouterOS API 連接 MikroTik 路由器,讓助理檢視介面、橋接器、路由、日誌與系統狀態。

可以做什麼
  • 以明文 TCP 或 SSL/TLS 連線並驗證路由器,相容新舊登入方式
  • 以 MCP 資源形式讀取介面、橋接器、橋接埠與 IP 路由
  • 對任意 RouterOS API 路徑執行唯讀 print 查詢,例如介面、路由、位址、防火牆清單或日誌
  • 產生系統報告,彙整資源、健康狀態、RouterBOARD 資訊與介面流量
  • 產生 AWR 風格的效能與安全稽核報告並提供建議
  • 提供連線、列出介面、檢視路由與日誌、執行稽核等預設提示詞
適用情境
適合讓助理檢查 MikroTik 路由器的設定與健康狀態、檢視路由、防火牆或介面狀態,或快速取得效能與安全稽核,而不必手動登入路由器。
執行需求
以本機 npm 套件(npx)或 Docker 容器執行。需要能連線路由器的 API 埠:明文 TCP 為 8728,SSL/TLS 為 8729。憑證透過 MK_USER 與 MK_PASSWORD 環境變數或 mk-connect 工具提供;主機位址與 secure 旗標可作為啟動參數傳入。
安裝前請注意
路由器密碼以明文方式透過 MK_PASSWORD 或 mk-connect 工具參數傳遞,應避免寫入共用設定與日誌。伺服器雖標示為唯讀,但會以真實路由器帳號驗證,建議使用最小權限帳號。明文 TCP 連線未加密,請優先選用安全模式。路由器設定與日誌資料會傳送給模型提供者。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mikrotik,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MikroTik RouterOS API MCP Server

A Read-Only MCP server implementation for interacting with MikroTik routers using the RouterOS API.

Features

  • Connection Management: Connect and authenticate with MikroTik routers.
  • Resource Monitoring: Dynamic access to interfaces, bridges, and routing tables via MCP resources.
  • Protocol Support: Works with both plain TCP (8728) and secure SSL/TLS (8729).
  • Modern & Legacy Login: Supports RouterOS versions prior to and after v6.43.

Resources

This server exposes MikroTik entities as MCP resources for direct inspection:

  • Interfaces: mikrotik://interface/{name}
    • Example: mikrotik://interface/ether1
  • Bridges: mikrotik://bridge/{name}
    • Example: mikrotik://bridge/bridge1
  • Bridge Ports: mikrotik://bridge/{bridge_name}/{interface_name}
    • Example: mikrotik://bridge/bridge1/ether2
  • IP Routes: mikrotik://route/{id}
    • Example: mikrotik://route/400AF317 (Note: internal IDs are used for routing entries)

Tools

  1. mk-connect: Connects to a router.
    • host: IP address of the router.
    • user: Username.
    • password: Password.
    • secure: (Optional) Use SSL/TLS. Default is false.

Example: mk-connect 192.168.88.1 admin mypassword

  1. mk-report: Generates a comprehensive system report.

    • Aggregates system resources, health, routerboard info, and interface traffic statistics (using monitor-traffic once).
  2. mk-get: Returns a JSON array with the result of a MikroTik API /print command.

    • sentence: The API path (e.g., /ip/route, /interface, /log).
    • The server automatically ensures the path starts with / and ends with /print.
  3. mk-awr: Generates an Automatic Workload Repository (AWR) style report for MikroTik.

    • Includes performance metrics, security audit, and recommendations.
    • No input required.

Prompts

The server provides several pre-defined prompts for common tasks:

  • mk-connect: Connect to MikroTik: Helps you establish a connection to your router.
  • mk-report: System Report: Requests a full system status and traffic report.
  • mk-get-route: Routing Table: Specifically asks for the current IP routing table.
  • mk-get-interface: List Interfaces: Specifically asks for all configured interfaces.
  • mk-get-log: View Logs: Requests the latest system log entries.
  • mk-awr: Security Audit: Initiates a full performance and security audit of the router.

Configuration

The MikroTik server can use environment variables or the mk-connect tool for secure credential management:

  • MK_USER: MikroTik username (required if providing host at startup)
  • MK_PASSWORD: MikroTik password (required if providing host at startup)

Startup Arguments

You can optionally provide the host and security setting as command-line arguments:

  1. host: (Optional) IP address of the router.
  2. secure: (Optional) Use SSL/TLS. Default is false.

If these are provided, the server will attempt to connect automatically on startup using MK_USER and MK_PASSWORD.

Local Build

bash
cd src/mikrotiknpm installnpm run build

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

json
{  "mcpServers": {    "mikrotik": {      "command": "npx",      "args": [        "-y",        "@marcelo-ochoa/server-mikrotik",        "192.168.88.1"      ],      "env": {        "MK_USER": "ai_agent",        "MK_PASSWORD": "ai_password"      }    }  }}

Sample using Docker:

json
{  "mcpServers": {    "mikrotik": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "-e",        "MK_USER=admin",        "-e",        "MK_PASSWORD=password",        "mochoa/mcp-mikrotik",        "192.168.88.1",        "false"      ]    }}

Note: Arguments and environment variables are optional. You can connect later using mk-connect.

Demos

Using the information of mk-get:

  • interface
  • ip/address
  • ip/route
  • ip/route/rules
  • ip/firewall[address-list,filter,nat,mangle] find potential security risk and no-used entities

See Demos for usage examples with Claude Desktop, Gemini CLI, and Antigravity Code Editor.

MikroTik AWR in action

See MikroTik AWR in action for an example of an Automatic Workload Repository (AWR) style report generated by the mk-awr tool for a MikroTik router, highlighting performance metrics and security risks.

Docker

Building the container:

bash
docker build -t mochoa/mcp-mikrotik -f src/mikrotik/Dockerfile .

Running the container:

bash
docker run -i --rm -e MK_USER=admin -e MK_PASSWORD=mypassword mochoa/mcp-mikrotik 192.168.88.1

Change Log

See Change Log for the history of changes.

Sources

As usual, the code of this extension is at GitHub, feel free to suggest changes and make contributions.

📜 License

This project is licensed under the Apache License, Version 2.0 for new contributions, with existing code under MIT - see the LICENSE file for details.

來源:src/mikrotik/README.md,提交 bd2ce8f

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.6最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。