Provides AI-assisted UniFi Network and Protect management capabilities via an MCP server with multi-device configuration.
Configuration
View docs{
"mcpServers": {
"gbassaragh-unifi-mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/Unifi-mcp",
"python",
"-m",
"unifi_mcp.server"
],
"env": {
"UNIFI_DEVICES": "[{\"name\":\"gateway\",\"url\":\"https://192.168.1.1\",\"api_key\":\"your-key\",\"services\":[\"network\"]},{\"name\":\"nvr\",\"url\":\"https://192.168.1.2\",\"api_key\":\"your-key\",\"services\":[\"network\",\"protect\"]}] },",
"UNIFI_VERIFY_SSL": "false"
}
}
}
}You run a unified MCP server that gives AI assistants access to UniFi Network and Protect capabilities for management, monitoring, and insights. This server lets you configure multiple UniFi devices, inquire about health and status, control devices, and pull live data through concise, AI-assisted commands. It’s designed to be easy to install, configure, and use from your preferred MCP client.
Connect your MCP client to the UniFi MCP Server using the provided stdio configuration. You run the MCP server locally and request actions or data from your UniFi devices through clear, natural prompts. The tools cover device management, site and network health, client activity, camera status, and Protect events, all wrapped in a consistent command surface.
Prerequisites you need before installation: a Python runtime and the MCP runner. Ensure you have Python installed and that you can run the MCP client tool used to host your server.
# Choose installation method and run commands as shown
# Option 1: using uv (Recommended)
# Clone the MCP package repository
git clone https://github.com/gbassaragh/Unifi-mcp.git
cd Unifi-mcp
# Install dependencies via the MCP runner
uv sync
# Option 2: install via Python in editable mode
pip install -e .Configure your UniFi devices by providing connection details and the services you want to expose. The standard approach is to define multiple devices, each with a name, URL, API key, and the services you want to enable (network, protect, or both). The configuration supports multi-device setups and SSL verification control for environments with self-signed certificates.
{
"UNIFI_DEVICES": "[{
\"name\": \"main-gateway\",
\"url\": \"https://192.168.1.1\",
\"api_key\": \"your-gateway-api-key\",
\"services\": [\"network\"],
\"site\": \"default\"
},{
\"name\": \"nvr\",
\"url\": \"https://192.168.1.2\",
\"api_key\": \"your-nvr-api-key\",
\"services\": [\"network\",\"protect\"],
\"site\": \"default\"
}]"
}Credentials and sensitive data are provided through environment variables at runtime. SSL verification can be disabled for self-signed certificates in development environments. The server exposes read operations and safe management commands; destructive actions (such as deleting a site or factory resetting devices) are not exposed.
You can run unit tests to verify behavior and use formatting and linting tools to keep the codebase clean during development. Use the provided commands to run tests and format code.
List all configured UniFi devices and their services.
List all UniFi network devices.
Get detailed information about a specific device.
Restart a device.
Blink the device indicator to locate it physically.
Retrieve performance statistics for a device.
Upgrade the device firmware.
Force re-provision of a device.
List connected clients.
List all known clients, including offline ones.
Get details for a specific client.
Block a client from accessing the network.
Unblock a previously blocked client.
Disconnect a client from the network.
Remove a client from known clients.
Get traffic statistics for a client.
List all sites.
Get the health status of a site.
Get settings for a site.
Get system information.
Get network/VLAN configurations.
Get wireless network configurations.
Get switch port profiles.
Get firewall rules.
Get routing table.
Overall network health.
Recent events in the network.
Active alarms.
Archive all alarms.
Start a network speed test.
Get speed test results.
DPI statistics.
Traffic summary.
Comprehensive network issue analysis.
Configuration optimization recommendations.
Client quality metrics report.
Device health overview.
Traffic pattern analysis.
Deep-dive client troubleshooting.
List all cameras with status.
Get detailed camera information.
Get a live camera snapshot (base64 JPEG).
Get NVR system information.
Camera health overview including issues.
Get configured Protect liveview layouts.
List lights, sensors, chimes, and viewers.
Get recent motion events.
Get smart detection events (person, vehicle, animal, package).
Summary of events by type for Protect.
Recent Protect activity overview.