Unifi Network MCP Server
Project description
UniFi Network MCP Server
MCP server exposing 161 UniFi Network Controller tools for LLMs, agents, and automation platforms. Query clients, devices, firewall rules, VLANs, VPNs, stats, and more — with safe-by-default permissions and preview-before-confirm for all mutations.
Install
Claude Code (recommended)
The plugin installs the MCP server, an agent skill for tool discovery, and a guided setup command:
/plugin marketplace add sirkirby/unifi-mcp
/plugin install unifi-network@unifi-plugins
Then run the interactive setup to configure your controller connection:
/unifi-network:setup
This walks you through entering your controller host, credentials, and permission preferences — then writes everything to .claude/settings.json so it persists across sessions. Restart Claude Code after setup to connect.
PyPI / Docker
# PyPI
uvx unifi-network-mcp@latest
# or: pip install unifi-network-mcp
# Docker
docker pull ghcr.io/sirkirby/unifi-network-mcp:latest
# From source
git clone https://github.com/sirkirby/unifi-mcp.git
cd unifi-mcp && uv sync
Usage Examples
Once connected, just ask your AI agent in natural language:
"Show me all clients on the Guest VLAN with their signal strength and data usage"
"Create a firewall rule that blocks IoT devices from reaching the internet between midnight and 6 AM"
"Which access points have the most client disconnections this week?"
"Audit my firewall policies — are there any redundant or conflicting rules?"
"Rename the device at 192.168.1.45 to 'Living Room TV' and show me its traffic stats"
"What changed on my network in the last 24 hours? Show me new clients and config changes."
All mutations (firewall rules, device changes, client blocking) use a preview-then-confirm flow — you see exactly what will change before anything is applied.
Configure
Set these environment variables (or create a .env file). If you used /unifi-network:setup, this is already done.
# Server-specific variables (recommended)
UNIFI_NETWORK_HOST=192.168.1.1 # Controller IP or hostname
UNIFI_NETWORK_USERNAME=admin # Local admin username
UNIFI_NETWORK_PASSWORD=your-password # Admin password
# Optional:
# UNIFI_NETWORK_API_KEY= # UniFi API key (experimental — read-only, subset of tools)
# UNIFI_NETWORK_PORT=443 # Controller HTTPS port
# UNIFI_NETWORK_SITE=default # UniFi site name
# UNIFI_NETWORK_VERIFY_SSL=false # SSL certificate verification
Fallback: Existing UNIFI_* variables (e.g., UNIFI_HOST) continue to work. The server checks for UNIFI_NETWORK_* first and falls back to UNIFI_* if the server-specific variable is not set. For single-controller setups, the shared variables are all you need.
Run
# stdio transport (default — for Claude Desktop, LM Studio, etc.)
unifi-network-mcp
# Docker
docker run -i --rm \
-e UNIFI_NETWORK_HOST=192.168.1.1 \
-e UNIFI_NETWORK_USERNAME=admin \
-e UNIFI_NETWORK_PASSWORD=secret \
ghcr.io/sirkirby/unifi-network-mcp:latest
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"unifi": {
"command": "uvx",
"args": ["unifi-network-mcp"],
"env": {
"UNIFI_NETWORK_HOST": "192.168.1.1",
"UNIFI_NETWORK_USERNAME": "admin",
"UNIFI_NETWORK_PASSWORD": "your-password"
}
}
}
}
Agent Skills
When installed via Claude Code, the network plugin ships three agent skills that extend Claude with specialized workflows for network management.
Network Health Check
Trigger: "check network health", "what's down", "run a health check", "network status"
Gathers a full diagnostic snapshot in a single unifi_batch call — system info, network health, device list, and active alarms — then produces a structured health report. Includes reference documents for device state codes, alarm types and severity levels, and health subsystem diagnostics (WAN → LAN → WLAN → VPN priority order).
Firewall Manager
Trigger: "block traffic", "create firewall rule", "set up IoT isolation", "manage content filtering"
Natural-language firewall management with a safe preview-then-confirm workflow. Ships with:
-
Policy templates for common scenarios — apply with
scripts/apply-template.py:Template Description iot-isolationBlock IoT VLAN from reaching the main LAN guest-lockdownRestrict guest network to internet-only kids-content-filterTime-based social media and gaming block via DPI block-bittorrentBlock P2P/BitTorrent traffic via DPI work-vpn-split-tunnelAllow corporate VPN while keeping local LAN accessible camera-isolationLock IP cameras to NVR-only communication -
Config snapshots via
scripts/export-policies.py— timestamped JSON backups of all policies, zones, and IP groups before every mutation -
Change tracking via
scripts/diff-policies.py— shows added, removed, and modified policies between two snapshots -
Reference docs for firewall schema, DPI categories, and full template parameter lists
Firewall Auditor
Trigger: "audit firewall", "review firewall rules", "check for security issues", "score my firewall"
Comprehensive automated audit across 16 security benchmarks in 4 categories, producing a 0–100 score with per-finding remediation guidance. Run with scripts/run-audit.py.
Score thresholds:
| Score | Rating | Meaning |
|---|---|---|
| 80–100 | Healthy | Follows best practices with minor gaps |
| 60–79 | Needs Attention | Notable gaps; address on a planned schedule |
| 0–59 | Critical | Significant exposure requiring immediate remediation |
Benchmark categories (4 × 25 points):
- Segmentation (SEG-01–04) — IoT/Guest/Management VLAN isolation, explicit inter-VLAN policies
- Egress Control (EGR-01–03) — Outbound filtering for high-risk VLANs, DNS enforcement, threat intelligence blocks
- Rule Hygiene (HYG-01–05) — Conflicts, redundant/disabled rules, stale references, naming, shadowing
- Topology (TOP-01–04) — Offline devices, firmware currency, VLAN consistency across switch uplinks, orphaned port profiles
Each finding includes the benchmark ID, severity (critical/warning/informational), a plain-language explanation, and — when automatable — the exact MCP tool call to fix it. Audit history is tracked in audit-history.json so score trends are visible over time.
Tool Improvements
Device Classification (unifi_list_devices)
unifi_list_devices now returns a device_category field that correctly classifies every adopted device:
| Category | Devices |
|---|---|
ap |
Real access points (excludes USP Smart Power strips that connect via wireless mesh) |
switch |
Managed switches |
gateway |
Security gateways and Dream Machines |
pdu |
Power distribution units |
wan |
UCI cable internet devices |
unknown |
Unrecognized device types |
The ap category uses the controller's is_access_point boolean flag as the authoritative signal, not just the device type prefix. This means USP Smart Power strips — which appear as uap-typed devices — are correctly excluded from the AP category.
Enriched Device Fields
Each device record now includes additional fields alongside the existing MAC, name, model, IP, firmware, uptime, and status:
| Field | Type | Description |
|---|---|---|
device_category |
string | Semantic category: ap, switch, gateway, pdu, wan, unknown |
upgradable |
bool | Whether a firmware upgrade is available |
connection_network |
string | Name of the VLAN the device's management interface is on |
uplink |
object | Topology info: uplink type, speed, parent device name, and port |
load_avg_1 |
float | 1-minute load average (from device system stats) |
mem_pct |
float | Memory utilization percentage (0–100) |
model_eol |
bool | Whether the device model has reached end-of-life |
Documentation
- Configuration — Full env var reference, YAML config, controller type detection
- Permissions — Permission system, category defaults, how to enable high-risk tools
- Tool Catalog — All 166 tools organized by category
- Transports — stdio, Streamable HTTP, and SSE setup
- Troubleshooting — Connection issues, SSL, missing tools
Development
cd apps/network
make test # Run tests
make lint # Lint
make format # Format
make manifest # Regenerate tools_manifest.json
make pre-commit # All of the above
See the root CONTRIBUTING.md for the full monorepo workflow.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unifi_network_mcp-0.14.6.tar.gz.
File metadata
- Download URL: unifi_network_mcp-0.14.6.tar.gz
- Upload date:
- Size: 157.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51b29fc1360c1907f55de394709cdef109cda4328982f7373ffb865bda425b8a
|
|
| MD5 |
205296258dbc7f6017b32841a178b220
|
|
| BLAKE2b-256 |
058cc723512edf3dd33dbbb6b0d74fffde9af620fc4d9810b4dfed631ab31cce
|
Provenance
The following attestation bundles were made for unifi_network_mcp-0.14.6.tar.gz:
Publisher:
publish-network.yml on sirkirby/unifi-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_network_mcp-0.14.6.tar.gz -
Subject digest:
51b29fc1360c1907f55de394709cdef109cda4328982f7373ffb865bda425b8a - Sigstore transparency entry: 1280971302
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-mcp@c3d19c69fae44f15f673b9005f4eee27a8746d28 -
Branch / Tag:
refs/tags/network/v0.14.6 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-network.yml@c3d19c69fae44f15f673b9005f4eee27a8746d28 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unifi_network_mcp-0.14.6-py3-none-any.whl.
File metadata
- Download URL: unifi_network_mcp-0.14.6-py3-none-any.whl
- Upload date:
- Size: 201.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68b0bc45b167f411dba162407f2c12ef0ae925eb379f2329195dd4bb294927e
|
|
| MD5 |
ac181c3cb34dcb813feacad75c72d51f
|
|
| BLAKE2b-256 |
40c994da4ce5fe97b922ae66f6fc444aa5486c5f9d64c6e06c6c975a6d7acd33
|
Provenance
The following attestation bundles were made for unifi_network_mcp-0.14.6-py3-none-any.whl:
Publisher:
publish-network.yml on sirkirby/unifi-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_network_mcp-0.14.6-py3-none-any.whl -
Subject digest:
f68b0bc45b167f411dba162407f2c12ef0ae925eb379f2329195dd4bb294927e - Sigstore transparency entry: 1280971305
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-mcp@c3d19c69fae44f15f673b9005f4eee27a8746d28 -
Branch / Tag:
refs/tags/network/v0.14.6 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-network.yml@c3d19c69fae44f15f673b9005f4eee27a8746d28 -
Trigger Event:
push
-
Statement type: