# UniFi Protect MCP

Connects UniFi Protect hardware to AI assistants. It lets models inspect camera events, search detections, and tweak device settings directly from the prompt.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 946
- Author: sirkirby
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/sirkirby/unifi-mcp/tree/HEAD/apps/protect
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/unifi-protect-mcp

## What it does

This server links UniFi Protect deployments to coding assistants like Claude Code and Codex. It tracks cameras and environmental sensors. The agent can pull recorded video clips or search for license plates and identified faces.

Read operations stay safe by default. Any change to device settings or floodlights requires confirmation after a preview. When the controller rejects a partial update, the server returns the parameters that took effect so you can review the state.

Running the server requires Python 3.13+. Without `UNIFI_PROTECT_API_KEY`, adjusting microphone volume or camera HDR fails before writing to hardware. The process can also start in setup mode without touching the local network if host credentials are not yet configured.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `UNIFI_HOST`, `UNIFI_USERNAME`, `UNIFI_PASSWORD`, `UNIFI_API_KEY`, `UNIFI_PORT`, `UNIFI_VERIFY_SSL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_API_KEY=<UNIFI_API_KEY> --env UNIFI_PORT=<UNIFI_PORT> --transport stdio protect -- uvx unifi-protect-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-protect-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add protect --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_API_KEY=<UNIFI_API_KEY> --env UNIFI_PORT=<UNIFI_PORT> -- uvx unifi-protect-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-protect-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "protect": {
            "command": "uvx",
            "args": [
                "unifi-protect-mcp"
            ],
            "env": {
                "UNIFI_HOST": "<UNIFI_HOST>",
                "UNIFI_USERNAME": "<UNIFI_USERNAME>",
                "UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
                "UNIFI_API_KEY": "<UNIFI_API_KEY>",
                "UNIFI_PORT": "<UNIFI_PORT>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-protect-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "protect": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "unifi-protect-mcp"
            ],
            "env": {
                "UNIFI_HOST": "<UNIFI_HOST>",
                "UNIFI_USERNAME": "<UNIFI_USERNAME>",
                "UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
                "UNIFI_API_KEY": "<UNIFI_API_KEY>",
                "UNIFI_PORT": "<UNIFI_PORT>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-protect-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e UNIFI_HOST=<UNIFI_HOST> -e UNIFI_USERNAME=<UNIFI_USERNAME> -e UNIFI_PASSWORD=<UNIFI_PASSWORD> -e UNIFI_API_KEY=<UNIFI_API_KEY> -e UNIFI_PORT=<UNIFI_PORT> protect uvx unifi-protect-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-protect-mcp <command>

## When to use it
- retrieve smart detection records for vehicles and people across cameras
- inspect offline cameras and unstable connection statuses
- locate recorded video segments within a designated time window
- adjust floodlight brightness levels and PIR sensor durations

## Example prompts
- List all camera smart detections from the front yard today.
- Find driveway recordings between 2 AM and 5 AM last night.
- Check if any security sensors triggered alerts over the last six hours.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [mcp](https://affpapa.org/en/nevibecode/mcp/kubeshark-mcp.md) — MCP server · ★ 12109
- [Robin: AI-Powered Dark Web OSINT](https://affpapa.org/en/nevibecode/mcp/robin-ai-powered-dark-web-osint.md) — MCP server · ★ 7658
- [jshookmcp](https://affpapa.org/en/nevibecode/mcp/jshookmcp.md) — MCP server · ★ 2061
- [OpenOSINT](https://affpapa.org/en/nevibecode/mcp/openosint.md) — MCP server · ★ 1802

From the same set: [sirkirby/unifi-mcp](https://affpapa.org/en/nevibecode/by/sirkirby/unifi-mcp.md) — 3 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
