UniFi MCP Server
A Model Context Protocol (MCP) server for comprehensive UniFi Network Management via the UniFi Cloud API. This server enables AI assistants like Claude to manage your UniFi infrastructure through natural language.
Features
UniFi Cloud API Integration - Full access to api.ui.com for remote management
OAuth 2.0 Authentication - Secure access with PKCE support for Claude Desktop, Claude Mobile, ChatGPT, and more
Multi-Transport Support - SSE and Streamable HTTP for flexible deployment
Complete UniFi Ecosystem - Network, Protect (cameras), and Access (doors) management
Production Ready - Docker support, Redis for token storage, Coolify/VPS deployment
Quick Start
1. Get Your UniFi Cloud API Key
Go to UniFi Site Manager
Navigate to API section from the left navigation
Click "Create API Key"
Copy the generated key
2. Installation
3. Configuration
Edit .env with your settings:
4. Run the Server
Development (stdio mode for Claude Desktop):
Production (HTTP server with OAuth):
Docker:
Claude Desktop Configuration
Add to your claude_desktop_config.json:
Remote Access (Claude Mobile / ChatGPT)
For remote access, deploy the HTTP server and connect via OAuth:
Deploy to your VPS or Coolify
Configure your domain with HTTPS
Connect using the OAuth flow:
Server URL:
https://your-domain.comClient ID:
claude-mobileorchatgptScope:
unifi-api
Available Tools
Network & System
Tool | Description |
| Check UniFi Cloud API connectivity |
| Comprehensive system status overview |
| List all UniFi OS consoles |
| List all network sites |
| Get ISP performance metrics |
Devices
Tool | Description |
| List all UniFi devices |
| Get device details |
| Flash LEDs to locate a device |
| Restart a device |
| Search by MAC address |
| List offline devices |
Clients
Tool | Description |
| List all connected clients |
| Block a client from network |
| Unblock a client |
| Force reconnect a client |
| Search clients by name |
| Bandwidth usage analysis |
UniFi Protect (Cameras)
Tool | Description |
| List all cameras |
| Get camera details |
| Toggle privacy mode |
| Set recording mode |
UniFi Access (Doors)
Tool | Description |
| List all access doors |
| Temporarily unlock a door |
| Lock a door |
Example Usage
Once connected, you can use natural language:
"Show me the status of my UniFi network"
"List all offline devices"
"Who's using the most bandwidth?"
"Block the device with MAC XX:XX:XX:XX:XX:XX"
"Unlock the front door for 10 seconds"
"Turn on privacy mode for the garage camera"
Deployment
Coolify
Create new application from Git repository
Set environment variables in Coolify dashboard
Configure your domain with HTTPS
Deploy!
Docker Compose
Manual VPS
API Endpoints
Endpoint | Description |
| Health check |
| Server status |
| OAuth discovery |
| OAuth authorization |
| Token exchange |
| SSE transport |
| MCP messages (authenticated) |
Security
HTTPS Required - Always use HTTPS in production
OAuth 2.0 + PKCE - Secure authorization flow
API Key Authentication - Alternative for server-to-server
Password Protection - Optional OAuth authorization password
Redis Token Storage - Secure token management with TTL
Troubleshooting
API Key Issues
OAuth Issues
Check
OAUTH_PASSWORDis set correctlyVerify
BASE_URLuses HTTPSEnsure redirect URIs match client configuration
Connection Issues
Verify UniFi Cloud API is accessible
Check firewall rules for port 3000
Review container logs:
docker-compose logs -f
License
MIT License - See LICENSE file for details.
Contributing
Pull requests welcome! Please ensure:
Tests pass
Documentation updated
Code follows existing style