UniFi MCP
UniFi MCP
FastMCP server for local UniFi controller management. Exposes a single unifi action router and a unifi_help reference tool covering devices, clients, network configuration, and controller monitoring.
Overview
The server connects to a self-hosted UniFi controller (including UDM Pro) and proxies all operations through a single MCP tool. A unified action parameter replaces 31 individual tools while preserving every capability. Destructive operations require explicit confirmation. Bearer token auth protects the HTTP endpoint in production.
What this repository ships
unifi_mcp/: server, client, config, formatters, models, services, resources, and toolsskills/unifi/: client-facing skilldocs/: API notes, action-pattern rationale, testing notes.claude-plugin/,.codex-plugin/,gemini-extension.json: client manifestsdocker-compose.yaml,Dockerfile: container deploymenttests/: unit, resource, and integration tests
Tools
unifi
Single action router for all UniFi operations.
Parameters
Parameter | Type | Required | Default | Description |
| string | yes | — | Action to perform (see below) |
| string | no |
| UniFi site name. Ignored by |
| string | no |
| Device or client MAC address (any format: |
| int | no | varies | Maximum results to return |
| bool | no |
|
|
| bool | no |
|
|
| string | no |
|
|
| string | no |
|
|
| string | no |
|
|
| int | no |
|
|
| int | no |
|
|
| int | no |
|
|
| int | no |
|
|
| bool | no |
| Set to |
unifi_help
Returns full markdown reference for all actions and parameters. No parameters needed.
Action Groups
Device Management
Action | MAC Required | Description |
| no | List all devices on a site with status, model, IP, and uptime |
| yes | Get full details for one device by MAC |
| yes | Destructive — reboot the device |
| yes | Activate the locate LED on the device |
get_devices response fields per device: name, model, type (Access Point / Gateway / Switch), status (Online / Offline), ip, mac, uptime, version
restart_device example:
unifi action=restart_device mac=aa:bb:cc:dd:ee:ff confirm=trueClient Management
Action | MAC Required | Description |
| no | List clients. |
| yes | Destructive — force a client to reconnect (kick-sta) |
| yes | Destructive — block a client from network access |
| yes | Re-allow a previously blocked client |
| yes | Destructive — remove all historical data for a client (GDPR) |
| yes | Set or update the display alias for a client |
| yes | Set or update the note for a client |
set_client_name / set_client_note: Both resolve the client by MAC against the controller user list (/list/user), then POST to /upd/user/{id}. Pass an empty string (name="") to remove the value.
Workflow — block a client:
# Step 1: find the MAC
unifi action=get_clients connected_only=true
# Step 2: block it
unifi action=block_client mac=aa:bb:cc:dd:ee:ff confirm=true
# Step 3: verify
unifi action=get_clients connected_only=falseNetwork Configuration
Action | Description |
| List all sites on the controller with health info |
| WLAN profiles: SSID, security, VLAN, guest flag, band steering |
| Network/VLAN configs: subnet, DHCP range, purpose, guest flag |
| Switch port profiles: native VLAN, tagged VLANs, PoE mode, port security |
| Port forwarding rules: protocol, external port, internal IP/port |
| Firewall rules: action, protocol, source/destination, ruleset, index |
| Firewall groups: type, member IPs or MACs, member count |
| Static routes: destination network, gateway (nexthop), distance, interface |
All network configuration actions accept site_name. get_sites does not use site_name.
Monitoring
Action | Key Parameters | Description |
| — | Controller version and up/down status |
|
| Recent controller events sorted newest-first. On UDM Pro tries the v2 API ( |
|
| Active or all alarms. Severity comes from |
|
| Deep Packet Inspection usage by application or category. Bandwidth values are in bytes (raw) in the structured response; the text summary formats them as human-readable (KB / MB / GB). |
|
| Detected foreign APs sorted by signal strength. Threat level: High > -60 dBm, Medium > -80 dBm, Low otherwise. |
|
| Trigger an RF spectrum scan on an access point. |
|
| Poll scan state and results for an AP. |
|
| Grant a guest client timed network access. |
|
| Historical speed tests from the last 30 days. Download/upload fields are in Mbps; latency and jitter in ms. |
|
| IPS/IDS threat events from the last 7 days: source/destination IP, protocol, signature, category, severity, action. |
Workflow — authorize a guest with bandwidth cap:
unifi action=authorize_guest mac=aa:bb:cc:dd:ee:ff minutes=120 down_bandwidth=5000 up_bandwidth=2000 quota=500Workflow — view DPI stats by category:
unifi action=get_dpi_stats by_filter=by_cat site_name=defaultIdentity
Action | Description |
| Return the MCP OAuth token claims (email, name, picture, expiry) |
get_user_info requires MCP OAuth (e.g. Google provider). UniFi controller credentials are separate. Returns an error if OAuth is not configured.
Destructive Operation Policy
Four actions require confirmation before executing:
Action | What it does |
| Reboots the device — causes brief network outage |
| Denies network access to the client |
| Forces disconnect/reconnect (kick-sta) |
| Permanently removes all historical data for the client |
Confirmation is checked in this order. The first matching rule wins:
UNIFI_MCP_ALLOW_DESTRUCTIVE=true— all destructive actions run without prompting (CI / automation)UNIFI_MCP_ALLOW_YOLO=true— same bypass, broader semantics (skips all elicitation prompts)confirm=trueparameter — per-call confirmation in the tool invocation
If none of the above apply, the tool returns error: confirmation_required with instructions to add confirm=true.
Installation
Marketplace
/plugin marketplace add jmagar/claude-homelab
/plugin install unifi-mcp @jmagar-claude-homelabLocal development
uv sync
uv run python -m unifi_mcp.mainConsole script entrypoints:
uv run unifi-mcp
uv run unifi-local-mcpDocker
just up
just logsConfiguration
Copy .env.example to .env and fill in the values:
cp .env.example .envEnvironment variables
Variable | Required | Default | Description |
| yes | — | Controller URL, e.g. |
| yes | — | Controller admin username |
| yes | — | Controller admin password |
| no |
| Set to |
| no |
| Set to |
| no |
| Server bind address |
| no |
| Server port. |
| no |
|
|
| no* | — | Bearer token for HTTP auth. Generate with |
| no |
| Disable Bearer auth (use only behind a trusted reverse proxy) |
| no |
| Log verbosity: |
| no |
| Log file path. File is cleared when it reaches 10 MB. |
| no |
| Skip confirmation for all destructive actions |
| no |
| Skip all elicitation prompts including destructive confirmation |
| no |
| UID/GID for Docker container process |
| no |
| Docker network name |
UDM Pro vs traditional controller (UNIFI_IS_UDM_PRO)
UDM Pro ( | Traditional ( | |
API base path |
|
|
Login endpoint |
|
|
CSRF token | Extracted from JWT | Not required |
Events API | Tries v2 ( | Legacy |
UNIFI_VERIFY_SSL=false
Self-hosted controllers typically use self-signed TLS certificates. Setting UNIFI_VERIFY_SSL=false disables certificate validation so the client can connect without a CA bundle. This is the safe choice for internal-network deployments. If your controller has a certificate issued by a public CA (e.g. via Let's Encrypt), set this to true.
Multi-site support
Every action that is site-scoped accepts a site_name parameter (default: "default"). Use get_sites to list available site names. Pass the name field (not the description) as site_name.
unifi action=get_sites
# returns: name="default", name="branch-office", ...
unifi action=get_devices site_name=branch-officeUsage examples
List all connected clients
unifi action=get_clients connected_only=trueGet a device by MAC
unifi action=get_device_by_mac mac=aa:bb:cc:dd:ee:ffBlock a client
unifi action=block_client mac=aa:bb:cc:dd:ee:ff confirm=trueUnblock a client
unifi action=unblock_client mac=aa:bb:cc:dd:ee:ffLabel a client
unifi action=set_client_name mac=aa:bb:cc:dd:ee:ff name="Living Room TV"
unifi action=set_client_note mac=aa:bb:cc:dd:ee:ff note="Guest device, 2026-04"Authorize a guest (2 hours, 5 Mbps down, 500 MB cap)
unifi action=authorize_guest mac=aa:bb:cc:dd:ee:ff minutes=120 down_bandwidth=5000 quota=500View DPI stats
unifi action=get_dpi_stats by_filter=by_app site_name=defaultCheck IPS threat events
unifi action=get_ips_events limit=20 site_name=defaultCheck controller status
unifi action=get_controller_statusView recent speed tests
unifi action=get_speedtest_results limit=5Get inline help
unifi_helpDevelopment
Commands
just dev # Start server with auto-reload
just lint # Lint with ruff
just fmt # Format with ruff
just typecheck # Type-check with ty
just check # lint + typecheck
just build # Editable install (uv pip install -e .)
just test # Run unit tests
just test-live # Health check against running server
just up # docker compose up -d
just down # docker compose down
just logs # Tail container logs
just health # curl /health endpoint
just gen-token # Generate a secure random token
just check-contract # Lint skill/server contract
just clean # Remove build artifacts and cachesGenerate a bearer token
just gen-token
# or
openssl rand -hex 32Verification
just lint
just typecheck
just testFor a running-server check:
just health
just test-liveRelated plugins
Plugin | Category | Description |
core | Core agents, commands, skills, and setup/health workflows for homelab management. | |
media | Search movies and TV shows, submit requests, and monitor failed requests via Overseerr. | |
infrastructure | Query, monitor, and manage Unraid servers: Docker, VMs, array, parity, and live telemetry. | |
utilities | Send and manage push notifications via a self-hosted Gotify server. | |
infrastructure | Create, edit, and manage SWAG nginx reverse proxy configurations. | |
infrastructure | Docker management (Flux) and SSH remote operations (Scout) across homelab hosts. | |
infrastructure | Manage Docker environments, containers, images, volumes, networks, and GitOps via Arcane. | |
infrastructure | Receive, index, and search syslog streams from all homelab hosts via SQLite FTS5. | |
dev-tools | Scaffold, review, align, and deploy homelab MCP plugins with agents and canonical templates. |
License
MIT