
A Model Context Protocol (MCP) server for UniFi Network Controller, written in Go.
概览
A Model Context Protocol (MCP) server for UniFi Network Controller, written in Go. go-unifi-mcp provides an MCP interface to UniFi Network Controller, enabling AI assistants and other MCP clients to interact with your UniFi infrastructure. 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. 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. Download pre-built binaries from the Releases page.
README
以下为原文 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).
# macOS (Apple Silicon)
curl -L https://github.com/claytono/go-unifi-mcp/releases/latest/download/go-unifi-mcp_darwin_arm64.tar.gz | tar xz
sudo mv go-unifi-mcp /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/claytono/go-unifi-mcp/releases/latest/download/go-unifi-mcp_darwin_amd64.tar.gz | tar xz
sudo mv go-unifi-mcp /usr/local/bin/
# Linux (amd64)
curl -L https://github.com/claytono/go-unifi-mcp/releases/latest/download/go-unifi-mcp_linux_amd64.tar.gz | tar xz
sudo mv go-unifi-mcp /usr/local/bin/
# Linux (arm64)
curl -L https://github.com/claytono/go-unifi-mcp/releases/latest/download/go-unifi-mcp_linux_arm64.tar.gz | tar xz
sudo mv go-unifi-mcp /usr/local/bin/
Homebrew
Available from the claytono/homebrew-tap tap:
brew install claytono/tap/go-unifi-mcp
Nix
# Run without installing
nix run github:claytono/go-unifi-mcp
# Install to your profile
nix profile install github:claytono/go-unifi-mcp
Docker
Multi-architecture images (amd64/arm64) are published to GitHub Container Registry.
# Latest (pinned to most recent release, rebuilt on base image updates)
docker pull ghcr.io/claytono/go-unifi-mcp:latest
# Edge (built from main on every merge, unstable)
docker pull ghcr.io/claytono/go-unifi-mcp:edge
Go Install
go install github.com/claytono/go-unifi-mcp/cmd/go-unifi-mcp@latest
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
安装
docker run -i --rm -e UNIFI_HOST -e UNIFI_API_KEY ghcr.io/claytono/go-unifi-mcp:latest配置
{
"mcpServers": {
"unifi": {
"command": "/usr/local/bin/go-unifi-mcp",
"env": {
"UNIFI_HOST": "https://your-controller:443",
"UNIFI_API_KEY": "your-api-key"
}
}
}
}