Skip to main content

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.

License: MIT Python 3.13+

Install

# PyPI (recommended)
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):

# 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=             # Official UniFi API key (dual auth)
# 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

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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unifi_protect_mcp-0.1.0.tar.gz (54.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unifi_protect_mcp-0.1.0-py3-none-any.whl (74.1 kB view details)

Uploaded Python 3

File details

Details for the file unifi_protect_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: unifi_protect_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 54.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for unifi_protect_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a8f54c9a8311f8111840994bfef373bccf8e62070c5c8a700a21c9236ee7d374
MD5 a9a81e40ba4d06d0a0bdedace49f9298
BLAKE2b-256 f6213e5ad35318abcd540d1886af4692dd57f6e04acf27d569cd8027de423785

See more details on using hashes here.

Provenance

The following attestation bundles were made for unifi_protect_mcp-0.1.0.tar.gz:

Publisher: publish-protect.yml on sirkirby/unifi-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unifi_protect_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unifi_protect_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61da453d8cc557f04761cba13b3505433e799b90bc7145449d3e94f2d3b3e7b1
MD5 02bf622faec0729e08ba4e9808851beb
BLAKE2b-256 3270a2e4d39a20ce2a07e0be73f365b1d1046dc9eb2486db5ff19f69e3df3b70

See more details on using hashes here.

Provenance

The following attestation bundles were made for unifi_protect_mcp-0.1.0-py3-none-any.whl:

Publisher: publish-protect.yml on sirkirby/unifi-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page