UniFi Protect MCP Server
Project description
UniFi Protect MCP Server
MCP server exposing UniFi Protect tools for LLMs, agents, and automation platforms. Query cameras, events, smart detections, recordings, lights, sensors, and chimes -- 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-protect@unifi-plugins
Then run the interactive setup to configure your controller connection:
/unifi-protect: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. If you already have the Network plugin configured on the same controller, the setup will detect and reuse those credentials. Restart Claude Code after setup to connect.
PyPI / Docker
# PyPI
uvx unifi-protect-mcp
# or: pip install unifi-protect-mcp
# Docker
docker pull ghcr.io/sirkirby/unifi-protect-mcp:latest
# From source
git clone https://github.com/sirkirby/unifi-mcp.git
cd unifi-mcp && uv sync
Configure
Set these environment variables (or create a .env file). If you used /unifi-protect:setup, this is already done.
# Server-specific variables (recommended)
UNIFI_PROTECT_HOST=192.168.1.1 # Controller IP or hostname
UNIFI_PROTECT_USERNAME=admin # Local admin username
UNIFI_PROTECT_PASSWORD=your-password # Admin password
# Optional:
# UNIFI_PROTECT_API_KEY= # UniFi API key (experimental — read-only, subset of tools)
# UNIFI_PROTECT_PORT=443 # Controller HTTPS port
# UNIFI_PROTECT_VERIFY_SSL=false # SSL certificate verification
Fallback: The shared UNIFI_* variables (e.g., UNIFI_HOST) also work. The server checks for UNIFI_PROTECT_* 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-protect-mcp
# Docker
docker run -i --rm \
-e UNIFI_PROTECT_HOST=192.168.1.1 \
-e UNIFI_PROTECT_USERNAME=admin \
-e UNIFI_PROTECT_PASSWORD=secret \
ghcr.io/sirkirby/unifi-protect-mcp:latest
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"unifi-protect": {
"command": "uvx",
"args": ["unifi-protect-mcp"],
"env": {
"UNIFI_PROTECT_HOST": "192.168.1.1",
"UNIFI_PROTECT_USERNAME": "admin",
"UNIFI_PROTECT_PASSWORD": "your-password"
}
}
}
}
Features
- Cameras -- list, inspect, snapshot, RTSP streams, PTZ control, settings, recording toggle, reboot
- Events -- query historical events, smart detections (person/vehicle/animal/package), thumbnails
- Real-time streaming -- websocket event buffer with MCP resource subscriptions and polling
- Recordings -- status, availability, clip export with timelapse support
- Devices -- lights (brightness, PIR sensitivity), sensors (temperature, humidity, motion), chimes (volume, trigger)
- Liveviews -- list and inspect multi-camera layouts
- System -- NVR info, health metrics, firmware status, connected viewers
Agent Skills
The Protect plugin ships one agent skill that works alongside the MCP tools:
Security Digest
Cross-product event intelligence that generates a concise security summary across all connected UniFi systems.
- Sources: Protect camera events, Access door events, Network firewall activity
- Severity classification: Events are classified by time-of-day context (business hours vs. after hours vs. overnight) and event type (person detection, vehicle, door access, firewall block, etc.)
- Cross-product correlation: Five built-in correlation rules surface patterns that span products:
- Motion at a door camera without a corresponding badge-in
- Multiple failed door access attempts in a short window
- Person detection coinciding with firewall blocks from the same timeframe
- After-hours camera activity with no Access event
- Repeated vehicle detections at the perimeter
- Activity counts: Aggregated totals across all sources for quick at-a-glance awareness
Invoke via the skill command after installing the plugin:
/unifi-protect:security-digest
Event Improvements
camera_name in Event Responses
All event-related tools now include camera_name alongside camera_id in every event object. The name is resolved from bootstrap data cached at startup — no extra API calls required.
Affected tools: protect_list_events, protect_list_smart_detections, protect_recent_events
Before:
{ "camera_id": "abc123", "type": "motion", ... }
After:
{ "camera_id": "abc123", "camera_name": "Front Door", "type": "motion", ... }
This eliminates the need to call protect_list_cameras separately just to map IDs to names.
Compact Mode
protect_list_events and protect_list_smart_detections accept a compact=true parameter that strips low-signal fields from responses: thumbnail_id, category, sub_category, and is_favorite. This produces responses roughly 40% smaller.
# Standard call
protect_list_events(limit=50)
# Compact — recommended for digests, summaries, and context-constrained workflows
protect_list_events(limit=50, compact=True)
Compact mode is the recommended default when building summaries or feeding events into downstream prompts where token budget matters.
Documentation
- Configuration -- Full env var reference, YAML config, Protect-specific options
- Permissions -- Permission system, category defaults, how to enable mutations
- Tool Catalog -- All 34 tools organized by category
- Event Streaming -- Real-time event architecture, MCP resources, polling
- Troubleshooting -- Connection issues, SSL, missing tools
Development
cd apps/protect
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_protect_mcp-0.1.3.tar.gz.
File metadata
- Download URL: unifi_protect_mcp-0.1.3.tar.gz
- Upload date:
- Size: 49.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b04a91a870ee21ac72470a4126d39670f0afd67a50aba6e2074a03127114049
|
|
| MD5 |
41a113a4108ffee4fe691a5aed0aad9e
|
|
| BLAKE2b-256 |
dc1b2609239ed19dddc294987904dea0019883a5118a16503db9510b18de6820
|
Provenance
The following attestation bundles were made for unifi_protect_mcp-0.1.3.tar.gz:
Publisher:
publish-protect.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_protect_mcp-0.1.3.tar.gz -
Subject digest:
4b04a91a870ee21ac72470a4126d39670f0afd67a50aba6e2074a03127114049 - Sigstore transparency entry: 1130468299
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-mcp@c3d9573c1481707213e523a69e7d31f8ed8bd620 -
Branch / Tag:
refs/tags/protect/v0.1.3 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-protect.yml@c3d9573c1481707213e523a69e7d31f8ed8bd620 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unifi_protect_mcp-0.1.3-py3-none-any.whl.
File metadata
- Download URL: unifi_protect_mcp-0.1.3-py3-none-any.whl
- Upload date:
- Size: 67.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01f048d8ccb99294fa9682d8a1e4698f5ba4af24d7ec506d03bb2cabe58d5f90
|
|
| MD5 |
0921ed6e448782cbe9e21440db735e34
|
|
| BLAKE2b-256 |
20e9df3f17aa4f8e9574b1176ce515858d62ef3fedec43aec5afe5e4aa68df79
|
Provenance
The following attestation bundles were made for unifi_protect_mcp-0.1.3-py3-none-any.whl:
Publisher:
publish-protect.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_protect_mcp-0.1.3-py3-none-any.whl -
Subject digest:
01f048d8ccb99294fa9682d8a1e4698f5ba4af24d7ec506d03bb2cabe58d5f90 - Sigstore transparency entry: 1130468374
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-mcp@c3d9573c1481707213e523a69e7d31f8ed8bd620 -
Branch / Tag:
refs/tags/protect/v0.1.3 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-protect.yml@c3d9573c1481707213e523a69e7d31f8ed8bd620 -
Trigger Event:
push
-
Statement type: