Provides comprehensive management and monitoring of UniFi Network and Protect infrastructure, including device management, client control, camera operations, system health monitoring, traffic analysis, and AI-powered network optimization recommendations.
UniFi MCP Server
An MCP (Model Context Protocol) server that provides AI assistants like Claude with access to UniFi Network and Protect infrastructure management and analysis capabilities.
Features
UniFi Network
Device Management: List, restart, locate, and upgrade UniFi devices (APs, switches, routers)
Client Management: Monitor connected clients, block/unblock, view traffic statistics
Site Management: View site health, network configurations, VLANs, and wireless settings
Statistics & Monitoring: Events, alarms, speed tests, and DPI statistics
AI-Powered Insights: Network analysis, optimization recommendations, and troubleshooting
UniFi Protect
Camera Management: List cameras, view status, get live snapshots
System Monitoring: NVR status, camera health summaries
Accessories: Manage lights, sensors, chimes, and viewers
Liveviews: Access configured camera view layouts
Multi-Device Support
Configure multiple UniFi devices (gateways, NVRs, etc.)
Target specific devices by name
Mix of Network and Protect services across devices
Supported Hardware
UniFi Dream Machine (UDM, UDM-Pro, UDM-SE)
UniFi Cloud Gateway (UCG-Ultra, UCG-Fiber)
UniFi Network Video Recorder (UNVR, UNVR-Pro)
UniFi Network Application (self-hosted)
Traditional Cloud Key (Gen1, Gen2, Gen2+)
Installation
Using uv (Recommended)
Using pip
Configuration
Create a .env file in the project root (or set environment variables).
Multi-Device Configuration (Recommended)
Configure multiple UniFi devices with different services:
Device configuration fields:
Field | Description | Default |
| Friendly name for targeting the device | (required) |
| Base URL of the UniFi device | (required) |
| API key from UniFi OS Control Plane | (required) |
| Array: |
|
| Site name for network operations |
|
| Verify SSL certificates |
|
| Username for Protect events (optional) |
|
| Password for Protect events (optional) |
|
Note: The username and password fields are only required for Protect event tools (motion events, smart detections). Basic camera operations work with just the API key.
To create an API key:
Log into your UniFi controller
Go to Settings → Control Plane → API
Create a new API key with appropriate permissions
Legacy Single-Device Configuration
For backwards compatibility, single-device configuration is still supported:
Local Session Auth (Traditional)
For traditional username/password authentication:
Cloud API (api.ui.com)
For Ubiquiti Cloud API access:
Get your API key from unifi.ui.com → API section.
Usage with Claude Desktop
Add to your Claude Desktop configuration (~/.config/claude/claude_desktop_config.json on Linux or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Usage with Claude Code
Available Tools
Multi-Device Management
list_unifi_devices- List all configured UniFi devices and their services
Device Management
list_devices- List all UniFi network devicesget_device_details- Get detailed device informationrestart_device- Restart a devicelocate_device- Blink LED to locate deviceget_device_stats- Get performance statisticsupgrade_device- Upgrade firmwareprovision_device- Force re-provision
Client Management
list_clients- List connected clientslist_all_clients- List all known clients (including offline)get_client_details- Get client detailsblock_client/unblock_client- Block/unblock clientskick_client- Disconnect a clientforget_client- Remove from known clientsget_client_traffic- Get traffic statistics
Site Management
list_sites- List all sitesget_site_health- Get site health statusget_site_settings- Get site settingsget_sysinfo- Get system informationget_networks- Get network/VLAN configsget_wlans- Get wireless network configsget_port_profiles- Get switch port profilesget_firewall_rules- Get firewall rulesget_routing_table- Get routing table
Statistics & Monitoring
get_network_health- Overall network healthget_recent_events- Recent eventsget_alarms- Active alarmsarchive_all_alarms- Archive all alarmsrun_speed_test- Start speed testget_speed_test_status- Get speed test resultsget_dpi_stats- DPI statisticsget_traffic_summary- Traffic summary
AI Insight Tools
analyze_network_issues- Comprehensive issue analysisget_optimization_recommendations- Configuration recommendationsget_client_experience_report- Client quality metricsget_device_health_summary- Device health overviewget_traffic_analysis- Traffic pattern analysistroubleshoot_client- Deep-dive client troubleshooting
UniFi Protect
list_cameras- List all cameras with connection statusget_camera_details- Get detailed camera informationget_camera_snapshot- Get live snapshot (base64 JPEG)get_protect_system_info- Get NVR system informationget_camera_health_summary- Camera health overview with issuesget_liveviews- Get configured liveview layoutsget_protect_accessories- List lights, sensors, chimes, viewers
UniFi Protect Events (require username/password)
get_motion_events- Get recent motion eventsget_smart_detections- Get smart detection events (person, vehicle, animal, package)get_protect_event_summary- Summary of all events by typeget_recent_protect_activity- Quick overview of recent activity
Example Conversations
After connecting the MCP server, you can ask Claude:
Network Management
"List all my UniFi devices"
"What's the current network health?"
"Analyze my network for any issues"
"What optimization recommendations do you have?"
"Show me client experience metrics"
"Troubleshoot the client with MAC aa:bb:cc:dd:ee:ff"
"Which clients are using the most bandwidth?"
"Are there any devices that need firmware updates?"
"Show me the recent network events"
"Run a speed test"
UniFi Protect
"List all my cameras"
"Show me the camera health summary"
"Get a snapshot from the Front Door camera"
"What's the status of my NVR?"
"Are any cameras disconnected?"
"Show me the protect accessories"
Protect Events (requires credentials)
"Show me recent motion events"
"What smart detections happened in the last 24 hours?"
"Were there any person detections today?"
"Give me an event summary for the past week"
"Show recent activity from the Front Door camera"
Multi-Device
"List my configured UniFi devices"
"Show cameras on my NVR"
"Get network health from the main gateway"
Development
Running Tests
Code Formatting
Security Notes
Credentials are passed via environment variables
SSL verification is disabled by default for self-signed certificates
The server only exposes read operations and safe management commands
Destructive operations (delete site, factory reset) are not exposed
API keys should be kept secure and rotated periodically
License
MIT License
Contributing
Contributions are welcome! Please open an issue or submit a pull request.