UniFi MCP Server
by AL-SoL-13
README.md
# UniFi MCP Server
[](https://opensource.org/licenses/MIT)
[](https://www.typescriptlang.org/)
[](https://modelcontextprotocol.io)
Full-featured Model Context Protocol server for UniFi Network controllers. Monitor, configure, and manage your entire UniFi network from Claude Code, Cursor, or any MCP-compatible AI assistant.
**43 tools** covering monitoring, WiFi configuration, VLAN management, firewall rules, switch port config, and more.
## Quick Start
```bash
git clone https://github.com/alexsollars/mcp-unifi.git
cd mcp-unifi
npm install
npm run build
```
Add to your `.mcp.json`:
```json
{
"mcpServers": {
"unifi": {
"command": "node",
"args": ["/path/to/mcp-unifi/dist/index.js"],
"cwd": "/path/to/mcp-unifi",
"env": {
"UNIFI_URL": "https://192.168.1.1",
"UNIFI_USERNAME": "your-admin-username",
"UNIFI_PASSWORD": "your-admin-password",
"UNIFI_SITE": "default"
}
}
}
}
```
## Tools (43 total)
### Monitoring (10 tools)
| Tool | Description |
|------|-------------|
| `unifi_get_site_health` | Overall site health and status |
| `unifi_list_devices` | List all devices (APs, switches, gateways) |
| `unifi_get_device` | Detailed device info by MAC |
| `unifi_list_clients` | Connected clients (all/wireless/wired) |
| `unifi_get_client` | Detailed client info by MAC |
| `unifi_get_radio_config` | AP radio settings (channel, width, power) |
| `unifi_get_wlan_config` | Full WLAN config including advanced settings |
| `unifi_get_switch_ports` | Switch port status and config |
| `unifi_get_traffic_stats` | Traffic stats (hourly/daily/monthly) |
| `unifi_get_dpi_stats` | Deep packet inspection / app usage |
### WiFi Management (6 tools)
| Tool | Description |
|------|-------------|
| `unifi_set_radio_config` | Channel, channel width (20/40/80/160), TX power |
| `unifi_set_min_rssi` | Min RSSI threshold for client roaming |
| `unifi_set_wlan_config` | Band steering, PMF, 802.11r, DTIM, min rates, network assignment |
| `unifi_set_wlan_mac_filter` | MAC filtering (allow/deny list) |
| `unifi_enable_wlan` | Enable a wireless network |
| `unifi_disable_wlan` | Disable a wireless network |
### Network & VLAN (4 tools)
| Tool | Description |
|------|-------------|
| `unifi_list_networks` | List all networks |
| `unifi_create_network` | Create network/VLAN with DHCP |
| `unifi_update_network` | Update network settings |
| `unifi_delete_network` | Delete a network/VLAN |
### Firewall (4 tools)
| Tool | Description |
|------|-------------|
| `unifi_list_firewall_rules` | List all firewall rules |
| `unifi_create_firewall_rule` | Create rule (LAN_IN, WAN_OUT, etc.) |
| `unifi_update_firewall_rule` | Update existing rule |
| `unifi_delete_firewall_rule` | Delete a rule |
### Switch Ports (3 tools)
| Tool | Description |
|------|-------------|
| `unifi_get_switch_ports` | Port status and config |
| `unifi_set_port_config` | Port name, PoE, speed, VLAN assignment |
| `unifi_list_port_profiles` | Available port profiles |
### Client Management (3 tools)
| Tool | Description |
|------|-------------|
| `unifi_block_client` | Block a client |
| `unifi_unblock_client` | Unblock a client |
| `unifi_reconnect_client` | Force reconnect |
### Device Management (3 tools)
| Tool | Description |
|------|-------------|
| `unifi_restart_device` | Restart a device |
| `unifi_set_device_name` | Rename a device |
| `unifi_set_device_led` | LED control (on/off/color) |
### Routing (2 tools)
| Tool | Description |
|------|-------------|
| `unifi_create_port_forward` | Create port forwarding rule |
| `unifi_create_static_route` | Create static route |
### Site & System (4 tools)
| Tool | Description |
|------|-------------|
| `unifi_set_site_settings` | Site name, timezone, country |
| `unifi_run_speed_test` | Trigger WAN speed test |
| `unifi_set_wlan_password` | Change WiFi password |
| `unifi_create_backup` | Create controller backup |
### Guest & Events (4 tools)
| Tool | Description |
|------|-------------|
| `unifi_list_wlans` | List wireless networks |
| `unifi_list_alerts` | Recent alerts |
| `unifi_list_events` | Recent events |
| `unifi_list_vouchers` | Guest vouchers |
| `unifi_create_voucher` | Create guest vouchers |
## Optional Safety Guard
Set `UNIFI_CONFIRM_WRITES=true` to require confirmation on write operations:
```json
"env": {
"UNIFI_CONFIRM_WRITES": "true"
}
```
When enabled, write tools return a diff preview and require `confirm: true` to apply. Default is off.
## Examples
**Fix slow WiFi:**
```
→ unifi_set_radio_config(mac: "aa:bb:cc:dd:ee:ff", radio: "na", channel_width: "80")
```
**Create IoT VLAN:**
```
→ unifi_create_network(name: "IoT", vlan_id: 20, subnet: "192.168.20.1/24", dhcp_enabled: true)
```
**Block inter-VLAN traffic:**
```
→ unifi_create_firewall_rule(name: "Block IoT", action: "drop", ruleset: "LAN_IN", src_address: "192.168.20.0/24", dst_address: "192.168.1.0/24")
```
**Assign switch port to VLAN:**
```
→ unifi_set_port_config(mac: "aa:bb:cc:dd:ee:ff", port_idx: 4, network_id: "vlan-id", name: "Camera")
```
## How It Works
- **Auth**: Cookie-based login with automatic re-login on session expiry
- **CSRF**: Extracts and sends CSRF tokens (required by UniFi OS for writes)
- **Writes**: GET → merge changes → PUT. Only provided fields change.
- **Errors**: Clear messages with UniFi API error details
## Requirements
- Node.js >= 18
- UniFi Network Controller (UDM, UDM Pro, Cloud Key)
- Admin account with Super Admin role
## License
MIT
## Credits
Built by [Alexander Sollars](https://github.com/alexsollars) at [Beautiful Networks, LLC](https://beautifulnetworks.com) with Claude Code.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues