unifi-mcp-server — Claude Code MCP server for UniFi
Connect an AI agent to UniFi Network, Protect, and cloud APIs through MCP. Use it to inspect infrastructure and make changes to it.
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-serverWhat unifi-mcp-server 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.
What it helps with
- 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 for the agent
- Find the network client at
192.168.2.10and block it. - Show the UniFi devices and restart the access point named
Office AP. - Check recent events from UniFi Protect cameras.
How to install unifi-mcp-server
Platform CLI
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-serverReplace <…> with your own values. 1 more environment variable is in the server README
Platform CLI
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-serverReplace <…> with your own values. 1 more environment variable is in the server README
Config file
{
"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
Config file
{
"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
Platform CLI
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-serverReplace <…> with your own values. 1 more environment variable is in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about unifi-mcp-server
How do I install unifi-mcp-server in Claude Code?
Run `claude mcp add unifi-mcp-server -e UNIFI_HOST=<UNIFI_HOST> -e UNIFI_USERNAME=<UNIFI_USERNAME> -e UNIFI_PASSWORD=<UNIFI_PASSWORD> -- npx -y unifi-mcp-server`. Replace the placeholders with your host, username, and password.
What does unifi-mcp-server do?
It connects an agent to UniFi Network, Protect, and cloud APIs through MCP. The agent can inspect data and change infrastructure when the selected API mode supports it.
Can the cloud API control individual UniFi devices?
No. cloud-ea and cloud-v1 expose site information and aggregate statistics, not per-device control or configuration. Use local mode for those operations.