# unifi-mcp-server

Connect an AI agent to UniFi Network, Protect, and cloud APIs through MCP. Use it to inspect infrastructure and make changes to it.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 308
- Author: enuno
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/enuno/unifi-mcp-server
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/unifi-mcp-server

## What it does

The server exposes tools for network clients, devices, Wi-Fi, VLANs, firewall rules, and UniFi Protect cameras. Cloud API modes provide site information and aggregated statistics, but cannot control individual devices or change configuration. Use `local` mode for those tasks.

You’ll need a UniFi API key and the controller host. For Claude Code, the listed setup command passes `UNIFI_HOST`, `UNIFI_USERNAME`, and `UNIFI_PASSWORD` to an `npx` launch. The main quick-start uses `pip` or `uvx` instead, so check which installation path fits your environment. Zone-based firewall tools require UniFi Network 9.0 or later.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `UNIFI_HOST`, `UNIFI_USERNAME`, `UNIFI_PASSWORD`, `UNIFI_PORT`, `UNIFI_VERIFY_SSL`, `UNIFI_SITE` — 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_PORT=<UNIFI_PORT> --env UNIFI_VERIFY_SSL=<UNIFI_VERIFY_SSL> --transport stdio unifi-mcp-server -- npx -y unifi-mcp-server
```
Replace <…> with your own values. 1 more environment variable is in the server README

### Codex

**Platform CLI**
```bash
codex mcp add unifi-mcp-server --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_PORT=<UNIFI_PORT> --env UNIFI_VERIFY_SSL=<UNIFI_VERIFY_SSL> -- npx -y unifi-mcp-server
```
Replace <…> with your own values. 1 more environment variable is in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "unifi-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "unifi-mcp-server"
            ],
            "env": {
                "UNIFI_HOST": "<UNIFI_HOST>",
                "UNIFI_USERNAME": "<UNIFI_USERNAME>",
                "UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
                "UNIFI_PORT": "<UNIFI_PORT>",
                "UNIFI_VERIFY_SSL": "<UNIFI_VERIFY_SSL>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "unifi-mcp-server": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "unifi-mcp-server"
            ],
            "env": {
                "UNIFI_HOST": "<UNIFI_HOST>",
                "UNIFI_USERNAME": "<UNIFI_USERNAME>",
                "UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
                "UNIFI_PORT": "<UNIFI_PORT>",
                "UNIFI_VERIFY_SSL": "<UNIFI_VERIFY_SSL>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README

### 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_PORT=<UNIFI_PORT> -e UNIFI_VERIFY_SSL=<UNIFI_VERIFY_SSL> unifi-mcp-server npx -y unifi-mcp-server
```
Replace <…> with your own values. 1 more environment variable is in the server README

## When to use it
- find and block a network client
- restart a UniFi device
- change Wi-Fi or VLAN settings
- inspect UniFi Protect camera events
- retrieve statistics across UniFi sites

## Example prompts
- Find the network client at `192.168.2.10` and block it.
- Show the UniFi devices and restart the access point named `Office AP`.
- Check recent events from UniFi Protect cameras.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [Front-End Checklist](https://affpapa.org/en/nevibecode/mcp/front-end-checklist.md) — MCP server · ★ 74559
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433

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