
Go Unifi Mcp
io.github.claytono由 GitHub 账号 claytono 发布v0.3.1更新于 Oct 24, 2026
Manage UniFi sites, devices, clients, networks, port forwarding, DNS, and firewall
概览
面向 UniFi Network Controller 的 MCP 服务器,让助手查看和管理站点、设备、客户端、网络、防火墙规则、DNS 与端口转发。
- 可以做什么
- 通过工具索引、直接执行或并行批量调用检索并调度 UniFi 操作(懒加载模式以 3 个元工具覆盖 252 项操作)。列出并查看站点、设备、客户端、网络及其他控制器资源,可将不透明 ID 解析为可读名称。对列表结果按字段过滤、全文搜索和字段投影。创建、更新和删除网络、防火墙规则、DNS、端口转发等 UniFi 配置。可切换为 eager 模式直接注册全部 252 个工具。
- 适用场景
- 适合让 AI 助手查看或修改 UniFi 网络:审计设备与客户端、检查防火墙规则,或编辑网络、DNS 和端口转发,而无需在控制器界面中逐项操作。
- 运行要求
- 以本地进程运行(二进制、Homebrew、Nix、Docker 镜像或 go install),支持 macOS 和 Linux。需要能访问 UniFi Network Controller 的网络,并提供 UNIFI_API_KEY,或同时提供 UNIFI_USERNAME 与 UNIFI_PASSWORD,以及 UNIFI_HOST。可选:UNIFI_SITE、UNIFI_VERIFY_SSL、UNIFI_LOG_LEVEL、UNIFI_TOOL_MODE。
安装
在 SourceWeft 中
- 打开 控制台中的 Go Unifi Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
go-unifi-mcp
A Model Context Protocol (MCP) server for UniFi Network Controller, written in Go.
Overview
go-unifi-mcp provides an MCP interface to UniFi Network Controller, enabling
AI assistants and other MCP clients to interact with your UniFi infrastructure.
Why this exists
I couldn’t find an MCP server that supported both v1 and v2 firewall rules and IPv6, so I built one. This wraps the go-unifi library (which I trust from my Terraform provider experience) and leans on its generated API surface. The server is generated from the controller’s own API definitions, which makes it much easier to keep tool coverage up to date as UniFi evolves.
UniFi controller versioning
This project generates tools against the same UniFi Controller version pinned by go-unifi. When go-unifi updates its supported controller version, we regenerate our field definitions and tool metadata to match. We support the same controller range; see their controller support range.
Installation
Binary (GitHub Releases)
Download pre-built binaries from the Releases page. Binaries are available for macOS and Linux (amd64/arm64).
Homebrew
Available from the claytono/homebrew-tap tap:
Nix
Docker
Multi-architecture images (amd64/arm64) are published to GitHub Container Registry.
Go Install
Configuration
UniFi Credentials
The server requires access to a UniFi Network Controller. Two authentication methods are supported:
-
API Key (preferred): Create an API key in your UniFi controller under Settings > Control Plane > Integrations. Set
UNIFI_HOSTandUNIFI_API_KEY. -
Username/Password: Use a local admin account. Set
UNIFI_HOST,UNIFI_USERNAME, andUNIFI_PASSWORD.
Claude Desktop
Add to your claude_desktop_config.json:
Using the binary:
Using Docker:
Claude Code
Then set the required environment variables in your shell before running
claude.
Environment Variables
* Either UNIFI_API_KEY or both UNIFI_USERNAME and UNIFI_PASSWORD must be
set.
Log Levels
The UNIFI_LOG_LEVEL variable controls logging from the underlying go-unifi
client library. The default is error because the client otherwise emits INFO
messages to stderr, which can interfere with tools like mcp-cli that parse JSON
on stdout/stderr.
Tool Modes
The server supports two tool registration modes, following the pattern established by unifi-network-mcp:
Lazy mode (default) registers only 3 meta-tools that provide access to 252 UniFi operations (generated from the controller API):
tool_index- Search/filter the tool catalog by category or resourceexecute- Execute any tool by name with argumentsbatch- Execute multiple tools in parallel
This dramatically reduces context window usage while preserving full functionality. The LLM first queries the index to find relevant tools, then executes them via the dispatcher.
Eager mode registers all 252 tools directly, which may be useful for non-LLM clients or debugging but consumes significant context.
Update semantics: Updates use a read-modify-write flow against the controller API. We fetch the current resource, merge your fields, and submit the full object. This avoids clearing unspecified fields, but it is not atomic and concurrent updates can race (last write wins) because the UniFi API does not expose etags or revision IDs. In practice this is unlikely to be an issue, but it's something to be aware of.
ID Resolution
Responses from the UniFi API contain opaque ID references (e.g. network_id,
usergroup_id, networkconf_id). By default, the server resolves these to
human-readable names by looking up the referenced resource and injecting a
sibling _name field:
Resolution uses a per-request cache, so listing 100 firewall rules that
reference networks only makes one additional ListNetwork API call. Typical
overhead is 10-40ms depending on how many distinct resource types are
referenced.
To disable resolution for a specific call, pass "resolve": false in the tool
arguments.
Query Parameters
All list operations support optional post-processing parameters for filtering and projecting results.
filter — Match items by field values. Supports three operators:
search — Case-insensitive full-text search across all string field values:
fields — Project the response to include only specific keys:
Parameters can be combined. Execution order is filter → search → fields, so you can filter on fields that are excluded from the output:
Development
Prerequisites
Developing
Available Tasks
Testing with mcp-cli
The development environment includes mcp-cli for interactive testing of the MCP server.
-
Create
.envrc.localwith your UniFi credentials (not tracked in git): -
Build the binary:
-
Test with mcp-cli:
The
.mcp_servers.jsonconfig provides two server entries:go-unifi-mcp- eager mode (252 tools)go-unifi-mcp-lazy- lazy mode (3 meta-tools)
Eager mode (direct tool access):
Lazy mode (meta-tools):
Credits
This project builds upon:
- go-unifi - Go client library for UniFi Network Controller
- unifi-network-mcp - Python MCP server for UniFi that inspired this project
- mcp-go - Go SDK for Model Context Protocol
License
MPL-2.0
来源:README.md,提交 3a442b9
工具
0版本历史
1- v0.3.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分