network-mcp
network-mcp
用于通过 UniFi Dream Machine 进行家庭网络管理的独立 HTTP MCP 服务器。
当前的控制器实现使用本地 UniFi Network UI/控制器 API,因为它支持纯文本设备管理所需的直接客户端阻止列表行为。应用程序的其余部分依赖于一个小的 NetworkController 接口,因此该实现以后可以被官方的 UniFi Network API 替换或补充。
设置
bun install
cp .env.example .env
bun run start该服务默认监听 127.0.0.1:4123。
Related MCP server: UniFi MCP Server
Docker
对于托管/家庭设置,请使用 Docker Compose 运行:
cp .env.example .env
docker compose up -d --buildCompose 文件将服务绑定到容器内的 0.0.0.0,仅在主机回环地址 127.0.0.1:4123 上发布,并将 LowDB 数据持久化在 ./data 中。
代码更改后重新构建/重启:
docker compose up -d --build查看日志:
docker compose logs -f network-mcp日志通过 Winston 以 JSON 格式输出到 stdout。设置 LOG_LEVEL=debug 以包含 UniFi 请求计时和 MCP 请求诊断信息。
端点
GET /healthPOST /mcpGET /mcpDELETE /mcp
如果设置了 MCP_AUTH_TOKEN,/mcp 需要:
Authorization: Bearer <token>OpenCode 配置
将远程 MCP 服务器添加到 /home/zac/.config/opencode/opencode.json:
{
"mcp": {
"home-network": {
"type": "remote",
"url": "http://127.0.0.1:4123/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:HOME_NETWORK_MCP_TOKEN}"
}
}
}
}更改 MCP 配置后,重启托管的 OpenCode 服务。
工具
list_clientsfind_deviceadd_tagremove_taglist_tagsadd_displaynameblock_deviceunblock_deviceblock_by_tagunblock_by_tagshow_blockedunblock_allrecent_actions
MAC 地址是设备的规范标识。标签和显示名称存储在 DB_PATH 下的 LowDB 中。
This server cannot be deployed
Maintenance
Related MCP Connectors
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server that turns Claude into a UniFi network specialist. Manage devices, optimize WiFi, audit security, and troubleshoot your network through natural language.3133 npm2MIT
- AlicenseAqualityDmaintenanceControl your UniFi network via AI with a lightweight 2-tool MCP server that supports both cloud and local UniFi controllers.318 npmMIT
- AlicenseBqualityDmaintenanceAn MCP server that enables AI assistants to manage UniFi network infrastructure, including cloud management, local network devices, and Protect cameras, through natural language.621MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for UniFi Network Controller enabling AI assistants to manage UniFi infrastructure via natural language. It supports firewall rules, IPv6, and uses lazy/eager tool modes to minimize context usage.6Mozilla Public 2.0