ClaudeCodeMod

All shelves / MCP servers

UniFi Protect MCP

io.github.sirkirby/unifi-protect-mcp · 420 stars · Python · MIT

MCP server Manage UniFi Protect cameras, events, recordings, and smart detections via MCP.

Install

The repo has no one-line install. Follow its README.

Published as

  • PyPIunifi-protect-mcpstdio

From the server's entry in the official MCP Registry.

Configuration

NameSet asWhat it is
UNIFI_HOSTRequiredEnv varController IP/hostname
UNIFI_USERNAMERequired · SecretEnv varAdmin username
UNIFI_PASSWORDRequired · SecretEnv varAdmin password
UNIFI_API_KEYOptional · SecretEnv varAPI key (optional, experimental)
UNIFI_PORTOptionalEnv varController HTTPS port
UNIFI_VERIFY_SSLOptionalEnv varSSL certificate verification

Files

README.md

UniFi Protect MCP Server

MCP server exposing UniFi Protect tools for AI assistants and other MCP-capable clients. Query cameras, events, smart detections, Find Anything detection search, recordings, lights, sensors, chimes, Known Faces, license plates, and the Alarm Manager with safe-by-default permissions and preview-before-confirm for all mutations.

Software integrating over HTTP, including automation services and MCP adapters, should use unifi-api-server for REST and GraphQL reads, actions, and SSE events.

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.local.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.

Codex

Register the marketplace, then install unifi-protect from Codex's /plugins UI:

codex plugin marketplace add sirkirby/unifi-mcp

After installing, ask Codex to use the UniFi Protect setup skill. The setup flow registers the MCP server with codex mcp add, stores your controller environment values in Codex's MCP configuration, and prompts you to restart Codex.

PyPI / Docker

# PyPI
uvx unifi-protect-mcp@latest
# 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

Usage Examples

Once connected, just ask your AI agent in natural language:

"List all cameras that detected motion in the last hour"

"Show me smart detection events from the front door camera today — people and vehicles only"

"Find driveway detections for white vans this week"

"Which cameras have the most motion events this week? Any unusual patterns?"

"Are there any cameras offline or with degraded connections?"

"Show me all recording events from the driveway camera between 2 AM and 5 AM last night"

"What sensors triggered alerts today and what were the readings?"

All camera and event queries are read-only by default. Mutations (camera settings, light controls) use a preview-then-confirm flow.

Configure

Set these variables in the server's process environment. If you used /unifi-protect:setup, this is already done. The server does not automatically load .env or working-directory YAML files; load a trusted env file explicitly in your launcher (Docker env_file: is supported), or select custom YAML with an absolute CONFIG_PATH. See configuration for migration examples.

# 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=             # Required for camera HDR/mic volume and light power/brightness/PIR settings
# UNIFI_PROTECT_PORT=443             # Controller HTTPS port
# UNIFI_PROTECT_VERIFY_SSL=false     # SSL certificate verification

Camera HDR and microphone volume, plus floodlight power, brightness, PIR sensitivity, and duration now use the Protect public Integration API with uiprotect 16.x. Set UNIFI_PROTECT_API_KEY (or the shared fallback UNIFI_API_KEY) and restart the server before using these settings. Session credentials remain required for other Protect operations. Missing keys or incompatible public device IDs fail before any settings in the request are written.

Microphone volume updates accept 1–100; zero is rejected by the public API. Existing HDR aliases are preserved: true/on/normal mean auto, false means off, and always/superHdr select public HDR on. Light brightness remains 1–6, sensitivity 0–100, and duration 15–900 seconds. light_on and is_light_on are equivalent inputs and control forced illumination; turning forced illumination off does not disable motion-triggered lighting.

Settings updates retain preview/confirmation and policy gates. Requests are validated before writing; controller failures can still leave a partial update. Failed updates return an error with the settings that applied, so callers can inspect the current state before retrying.

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.

MCP response size

For tool results that already provide structured output, adaptive is the default response mode. It classifies each request by the canonical date-based protocolVersion advertised during MCP initialization, not by the client's product name or application version. Requests advertising MCP 2025-06-18 or later receive concise content plus the full result once in structuredContent; requests advertising an earlier revision (such as 2024-11-05 or 2025-03-26), or whose revision metadata is missing or malformed, keep full compatibility JSON in content. Set UNIFI_PROTECT_MCP_CONTENT_MODE to compat to force the duplicated compatibility form, or to compact to force concise text plus full structured output outside a negotiated request. This server-specific variable overrides UNIFI_MCP_CONTENT_MODE; use compat for any client that consumes the full result only from content, regardless of its advertised revision.

The lazy-loading meta-tools (_tool_index, _execute, _batch, _batch_status, and lazy-only _load_tools) remain content-only; they are not the pre-2025-06-18 protocol category described above. For structured inner results, _execute and *_batch_status expose one normalized JSON payload in content rather than a nested transport pair; content-only execute results remain unchanged. Response modes do not convert these meta-tools to structuredContent.

When Network is enabled alongside Protect, its largest source responses are independently bounded: unifi_get_dashboard defaults to summary=true, and unifi_list_rogue_aps defaults to a summarized page of at most 100 records; summary=false restores the full selected data.

AI-powered alarms need SuperAdmin. The alarm-rule tools (protect_alarm_list_rules / protect_alarm_get_rule / protect_alarm_create_rule / protect_alarm_update_rule / protect_alarm_delete_rule) transparently use the modern UniFi-OS Alarm Manager when the account is SuperAdmin, and fall back to the classic automations view otherwise. The modern path surfaces and manages AI-powered alarms (e.g. AI Natural Language); the legacy path cannot see those rules and responses include a standard MCP _meta notice when the view is limited. Grant the account SuperAdmin on the console hosting Protect to view/manage AI alarms. Blast radius: on a standalone UNVR this is contained to Protect; on a combined UDM console SuperAdmin also grants Network/UniFi-OS control.

Sensitive response fields

Protect tools redact secret-bearing stream fields by default before returning data to MCP clients. This includes RTSP/RTSPS stream aliases and URLs from protect_get_camera_streams. Disable redaction for a trusted local administration process with UNIFI_PROTECT_REDACT_SENSITIVE_FIELDS=false or the global UNIFI_REDACT_SENSITIVE_FIELDS=false policy flag when raw stream values are required.

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), Find Anything detection search, thumbnails
  • Real-time streaming -- websocket event buffer with MCP resource subscriptions and polling

Facts

Kind
MCP server
Repo
io.github.sirkirby/unifi-protect-mcp
Group
Uncategorized
Stars
420
License
MIT
Language
Python
Last push
2026-10-08
Forks
117
MCP Registry
io.github.sirkirby/unifi-protect-mcp
Homepage
unifimcp.com
Topics
agentic-ai, home-automation, mcp-server, unifi, unifi-access, unifi-controller, unifi-network, unifi-protect

More on this shelf

  1. 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
  2. 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
  3. 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
  4. 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
  5. 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
  6. 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k