openwrt-luci-mcp
This server provides a read-only MCP interface to an OpenWrt/LuCI router over its native /ubus/ JSON-RPC API, exposing status and diagnostic data without SSH, without installing router-side agents, and without any configuration-changing tools.
Read router system info: board, firmware, kernel, uptime, load, memory, LuCI version, local time, and time services.
Inspect network state: logical interfaces, interface details, network devices, port status, VLAN/Switch config, active routes, neighbors, and policy rules.
Query DHCP and DNS: current DHCPv4/v6 leases, hostname/IP/MAC hints, dnsmasq/odhcpd settings, and DNS records.
Inspect Wi-Fi: configured radios/networks, radio status, associated clients, and on-demand scanning of nearby Wi-Fi.
Read firewall and nftables state: firewall zones, rules, forwardings, redirects, and filtered/paginated active nftables rules.
View system activity: procd services, bounded process lists, real-time interface/wireless/conntrack/load samples, conntrack connections, and bounded system/kernel logs.
Examine storage and packages: mounted filesystems with byte counts, installed/world package search, and LuCI installed/available package catalog browsing.
Run passive and active diagnostics: WAN/DNS/route consistency checks without probes, plus fixed non-configuring ping, traceroute, and DNS lookups with validated targets and immutable limits.
Perform security audit: checks for unsafe WAN input, management port forwards, HTTP-only LuCI, and SSH password authentication.
Produce a merged client inventory combining DHCP leases, host hints, and Wi-Fi associations.
List LuCI page coverage and allowed ubus method signatures via router_luci_pages and router_capabilities.
All tools return both JSON text and structuredContent; larger results support offset/limit pagination, and sensitive secrets (passwords, PSKs, tokens, keys) are hidden before returning data.
Provides read-only access to OpenWrt router status through the LuCI ubus JSON-RPC interface, including system info, network interfaces, routes, Wi-Fi clients and scans, DHCP leases, firewall status, logs, storage, packages, and security auditing.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@openwrt-luci-mcpShow me the current Wi-Fi clients and their signal strengths"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenWrt LuCI HTTP MCP
标准 OpenWrt LuCI Web 界面的只读 MCP 表达,通过 LuCI 原生 POST /ubus/ JSON-RPC 接口读取状态和运行其诊断页中的固定命令,不使用 SSH,也不在路由器上安装代理。
当前版本:0.4.0。以 OpenWrt 25.12.3 / LuCI openwrt-25.12 为 ground truth;可选方法不存在时返回明确的 supported: false,不会把权限或认证错误误报为不支持。
安全范围
使用现有 LuCI
root登录,不创建新账户。密码只从环境变量读取,不写入源码或日志。
不注册任意 ubus 调用、任意 shell、重启、固件升级或 UCI 写入工具。
ip、nft、dmesg、软件目录和网络诊断只执行代码中写死的程序与参数结构;不经过 shell。网络诊断只允许经过校验的目标,Ping 次数、Traceroute 超时和跳数均不可由调用者改变。
返回给模型前隐藏密码、PSK、community、令牌、会话标识、私钥、HTTP Authorization 和 URL 内嵌认证材料。
单次 LuCI 响应限制为 2 MiB,单个 MCP 结果限制为 256 KiB;超限返回有效 JSON 错误而非截断内容。
这只是 Demo。root 密码通过普通 HTTP 发送时没有传输加密,只应在可信 LAN 中临时测试。长期使用应开启 LuCI HTTPS,并改为受限 rpcd 账户。
Related MCP server: OpenWrt MCP Controller
环境要求
Node.js 20 或更高版本
OpenWrt/LuCI 可通过局域网访问
uhttpd-mod-ubus与rpcd正常工作
安装
cd C:\absolute\path\to\openwrt-luci-mcp-demo
npm install不要复制 .env.example 后把真实密码提交到 Git。推荐直接在 MCP 客户端的进程环境中设置变量:
OPENWRT_URL=http://router.example.invalid
OPENWRT_USERNAME=root
OPENWRT_PASSWORD=<LuCI root 密码>
OPENWRT_ALLOW_INSECURE_HTTP=1OPENWRT_ALLOW_INSECURE_HTTP=1 是显式风险确认。若 LuCI 已启用 HTTPS,请使用 https://... 并删除该变量。
运行
npm startstdio 是 MCP 协议通道;程序日志只写入 stderr。通常由 MCP 客户端启动本程序,而不是手动交互。
参考 mcp-config.example.json 配置客户端,并把其中的 Node 与 src/index.mjs 路径改为绝对路径。
工具
router_capabilitiesrouter_luci_pagesrouter_system_inforouter_interfacesrouter_interface_detailsrouter_routing_configrouter_network_devicerouter_port_statusrouter_vlan_configrouter_dhcp_leasesrouter_dhcp_configrouter_dns_configrouter_known_hostsrouter_wifi_overviewrouter_wifi_detailsrouter_wifi_clientsrouter_servicesrouter_processesrouter_realtime_statsrouter_routesrouter_neighborsrouter_firewall_statusrouter_firewall_configrouter_nftables_rulesrouter_wifi_scanrouter_logsrouter_connectionsrouter_storagerouter_packagesrouter_package_catalogrouter_time_statusrouter_system_settingsrouter_network_diagnosticsrouter_network_consistencyrouter_run_diagnosticrouter_security_auditrouter_client_summary
每个工具同时返回兼容的文本 JSON 和 MCP structuredContent。路由、DHCP/DNS、Firewall、VLAN、大型规则和软件目录使用 offset、limit 分页。
v0.4.0 增加 LuCI 网络配置控制面的只读表达:静态路由与策略规则、dnsmasq/odhcpd、DNS 记录、Firewall 关系、DSA/swconfig VLAN、基础 System 设置,以及配置与运行态一致性检查。工具只读取已提交配置;不会读取其他 LuCI 会话中尚未应用的 UCI 暂存变更。
router_network_diagnostics 只分析现有状态。router_run_diagnostic 对应 LuCI Network → Diagnostics 页面,会产生 Ping、Traceroute 或 DNS 流量,但不修改配置。router_package_catalog 只调用 LuCI package manager 的 list-installed 和 list-available,不更新软件源。
LuCI 页面覆盖
LuCI 页面 | MCP 工具 | 状态 |
Status → Overview |
| supported |
Status → Realtime Graphs |
| supported |
Status → Routes |
| supported |
Status → System Log |
| supported |
Status → Processes |
| supported |
Status → Firewall |
| supported |
Network → Interfaces |
| supported |
Network → Switch/VLAN |
| supported/conditional |
Network → Wireless |
| supported |
Network → Routing |
| supported |
Network → DHCP |
| supported |
Network → DNS |
| supported |
Network → Diagnostics |
| supported |
Network → Firewall Configuration |
| supported |
System → System |
| supported |
System → Software |
| supported |
System → Mount Points |
| supported |
同一矩阵可由 router_luci_pages 读取。Switch/VLAN 仅在 DSA bridge-vlan 或旧 swconfig 配置存在时支持。WireGuard、SQM、UPnP 等可选 LuCI 应用不在 v0.4.0 范围内。
没有提供以下能力:
uci.set / uci.delete / uci.apply
任意 file.exec / file.write / file.remove
system.reboot
luci.setPassword
hostapd.*.del_client测试
27 项测试使用本机模拟 /ubus/ 服务,不连接或修改真实路由器:
npm test一次性真实连接检查
在 PowerShell 中使用安全密码提示,不把密码写入文件:
$secure = Read-Host 'LuCI root password' -AsSecureString
$ptr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure)
try {
$env:OPENWRT_PASSWORD = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($ptr)
$env:OPENWRT_URL = 'http://router.example.invalid'
$env:OPENWRT_USERNAME = 'root'
$env:OPENWRT_ALLOW_INSECURE_HTTP = '1'
npm run check:live
}
finally {
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ptr)
Remove-Item Env:OPENWRT_PASSWORD -ErrorAction SilentlyContinue
}该检查只调用 system.board、system.info 和 luci.getVersion。
目标路由器核验范围
通过已登录 LuCI 页面确认以下模块在目标路由器上存在且可正常读取,没有出现 RPC access denied:
活动 IPv4/IPv6 路由、策略规则和邻居表
nftables
fw4运行时状态系统日志
Wi-Fi 信道分析
软件包管理器
网络诊断
静态路由、DHCP/DNS 与 Firewall 配置
DSA/bridge-vlan 与基础 System 设置
实现方法与 OpenWrt 25.12 使用的 LuCI/rpcd 接口保持一致;若将来更换固件或裁剪 LuCI 软件包,可调用 router_capabilities 和 router_luci_pages 核对实际支持情况。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceEnables AI agents to manage OpenWRT routers remotely via SSH, supporting system monitoring, network management, OpenThread Border Router configuration, and package management through natural language commands.1916MIT
- FlicenseAqualityDmaintenanceEnables management and control of OpenWrt devices via a simple API, including reboot, status checks, log reading, and LED control.51
- AlicenseNot gradedqualityAmaintenanceProvides full administrative control of OpenWRT routers via SSH, with a preview-confirm safety model for mutating operations.13MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to read-only monitor iStoreOS/OpenWRT routers via SSH or HTTP/ubus API, providing 31 tools for system status, network info, logs, and plugin status (OpenClash, Passwall, AdGuardHome, etc.).31MIT
Related MCP Connectors
Query WHOIS/RDAP information for domains, IP addresses, CIDR prefixes and ASNs. Self-hostable.
Read-only NuMetric.work accounting & ERP data: statements, KPIs, reports, invoices, documents.
Read-only access to live ADSBiq aircraft and network state, with community contribution metadata.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JeffersonYoung/openwrt-luci-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server