UniFi MCP
An MCP server that enables AI assistants to manage UniFi network infrastructure, including cloud management, local network devices, and Protect cameras, through natural language.
README
UniFi MCP
An MCP server that lets Claude interact with your UniFi infrastructure. Supports the Site Manager API (cloud), the Network API (local console), and the Protect API (local console).
Features
Site Manager API (cloud)
Read-only access to your UniFi account via https://api.ui.com:
| Tool | Description |
|---|---|
list_hosts |
List all consoles/gateways |
get_host |
Get detailed host information |
list_sites |
List all sites |
list_devices |
List all network devices |
get_isp_metrics |
Get ISP performance metrics (latency, bandwidth, uptime) |
query_isp_metrics |
Query ISP metrics for specific sites |
get_sdwan_config |
List or inspect SD-WAN configurations |
Network API (local console)
Full CRUD access to a local UniFi console (UDM, UCG, etc.):
| Tool | Description |
|---|---|
| Info | |
network_info |
Application info and site discovery |
| Devices | |
network_list_devices |
List all adopted devices |
network_get_device |
Get device details and statistics |
network_device_action |
Restart, locate, or adopt a device |
| Clients | |
network_list_clients |
List all connected clients |
network_get_client |
Get client details |
network_client_action |
Block or reconnect a client |
| Networks | |
network_list_networks |
List configured networks (VLANs) |
network_get_network |
Get network details |
network_create_network |
Create a network |
network_update_network |
Update a network |
network_delete_network |
Delete a network |
| WiFi | |
network_list_wifi |
List WiFi broadcasts (SSIDs) |
network_get_wifi |
Get WiFi broadcast details |
network_create_wifi |
Create a WiFi broadcast |
network_update_wifi |
Update a WiFi broadcast |
network_delete_wifi |
Delete a WiFi broadcast |
| Firewall | |
network_list_firewall_zones |
List firewall zones |
network_list_firewall_policies |
List firewall policies |
network_create_firewall_policy |
Create a firewall policy |
network_update_firewall_policy |
Update a firewall policy |
network_delete_firewall_policy |
Delete a firewall policy |
| DNS | |
network_list_dns_policies |
List DNS filtering policies |
| Vouchers | |
network_list_vouchers |
List hotspot vouchers |
network_create_vouchers |
Create hotspot vouchers |
network_delete_voucher |
Delete a hotspot voucher |
| Supporting | |
network_list_wans |
List WAN interfaces |
network_list_vpn_tunnels |
List site-to-site VPN tunnels |
network_list_vpn_servers |
List VPN servers |
network_list_radius_profiles |
List RADIUS profiles |
Protect API (local console)
Access to UniFi Protect cameras, sensors, and devices on a local console:
| Tool | Description |
|---|---|
| Info | |
protect_info |
Application info and NVR status |
| Cameras | |
protect_list_cameras |
List all cameras |
protect_get_camera |
Get camera details |
protect_update_camera |
Update camera settings |
protect_get_camera_snapshot |
Get a JPEG snapshot from a camera |
| Lights | |
protect_list_lights |
List all lights |
protect_get_light |
Get light details |
protect_update_light |
Update light settings |
| Sensors | |
protect_list_sensors |
List all sensors |
protect_get_sensor |
Get sensor details |
protect_update_sensor |
Update sensor settings |
| Chimes | |
protect_list_chimes |
List all chimes |
protect_get_chime |
Get chime details |
protect_update_chime |
Update chime settings |
| Door Locks | |
protect_list_doorlocks |
List all door locks |
protect_get_doorlock |
Get door lock details |
protect_update_doorlock |
Update door lock (lock/unlock, timeout) |
| Events | |
protect_list_events |
List recent events (motion, detections) |
| Liveviews | |
protect_list_liveviews |
List all liveviews |
protect_get_liveview |
Get liveview details |
protect_create_liveview |
Create a liveview |
protect_update_liveview |
Update a liveview |
| Viewers | |
protect_list_viewers |
List all viewers (Viewport devices) |
protect_get_viewer |
Get viewer details |
protect_update_viewer |
Update viewer settings |
Prerequisites
- UniFi API key -- generate at unifi.ui.com > API section. The same key works for Site Manager, Network, and Protect APIs.
Quick start
Docker (recommended)
# Build the image
docker build -t unifi-mcp .
# Run with Site Manager API only
docker run --rm -i -e UNIFI_API_KEY=your-key unifi-mcp
# Run with all three APIs (same key, just add the console host)
docker run --rm -i \
-e UNIFI_API_KEY=your-key \
-e UNIFI_NETWORK_HOST=192.168.1.1 \
-e UNIFI_PROTECT_HOST=192.168.1.1 \
unifi-mcp
Docker Compose
cp .env.example .env
# Edit .env with your API keys
docker compose build
docker compose run --rm unifi-mcp
Local (with uv)
# Install dependencies
uv sync
# Run the server
UNIFI_API_KEY=your-key uv run unifi-mcp
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
UNIFI_API_KEY |
Yes | -- | UniFi API key (shared across all APIs) |
UNIFI_API_BASE_URL |
No | https://api.ui.com/v1 |
Site Manager API base URL |
UNIFI_API_TIMEOUT |
No | 30 |
HTTP timeout in seconds |
UNIFI_NETWORK_HOST |
No | -- | Console IP/hostname for Network API |
UNIFI_NETWORK_API_KEY |
No | UNIFI_API_KEY |
Network API key (if different) |
UNIFI_NETWORK_VERIFY_SSL |
No | false |
Verify SSL for Network API |
UNIFI_PROTECT_HOST |
No | -- | Console IP/hostname for Protect API |
UNIFI_PROTECT_API_KEY |
No | UNIFI_API_KEY |
Protect API key (if different) |
UNIFI_PROTECT_VERIFY_SSL |
No | false |
Verify SSL for Protect API |
The Network API tools are only available when UNIFI_NETWORK_HOST is set. The Protect API tools are only available when UNIFI_PROTECT_HOST is set. By default, UNIFI_API_KEY is used for all APIs. Set UNIFI_NETWORK_API_KEY or UNIFI_PROTECT_API_KEY if a console requires a separate key.
Claude integration
Claude Desktop (via mcp-remote)
Run the server with an HTTP transport, then connect Claude Desktop using mcp-remote:
# Streamable HTTP (recommended)
docker compose up unifi-mcp-http
# Or SSE (legacy)
docker compose up unifi-mcp-sse
# Or without Compose
docker run --rm -p 8000:8000 \
-e UNIFI_API_KEY=your-key \
-e UNIFI_NETWORK_HOST=192.168.1.1 \
-e UNIFI_PROTECT_HOST=192.168.1.1 \
unifi-mcp --transport streamable-http
Add to your claude_desktop_config.json:
{
"mcpServers": {
"unifi": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8000/mcp"]
}
}
}
For SSE transport, use
http://localhost:8000/sseinstead.
Claude Desktop (stdio)
Alternatively, run the container directly via stdio:
{
"mcpServers": {
"unifi": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "UNIFI_API_KEY=your-key",
"-e", "UNIFI_NETWORK_HOST=192.168.1.1",
"-e", "UNIFI_PROTECT_HOST=192.168.1.1",
"unifi-mcp"
]
}
}
}
Claude Code
Add to your MCP settings:
{
"mcpServers": {
"unifi": {
"command": "uv",
"args": ["--directory", "/path/to/unifi-mcp", "run", "unifi-mcp"],
"env": {
"UNIFI_API_KEY": "your-key",
"UNIFI_NETWORK_HOST": "192.168.1.1",
"UNIFI_PROTECT_HOST": "192.168.1.1"
}
}
}
}
Project structure
src/unifi_mcp/
server.py # MCP server and tool definitions
client.py # Site Manager API client
formatting.py # Site Manager response formatters
network_client.py # Network API client (local console)
network_formatting.py # Network response formatters
protect_client.py # Protect API client (local console)
protect_formatting.py # Protect response formatters
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。