Model Context Protocol (MCP) server for Ubiquiti UniFi Network management. Control and monitor your UniFi network infrastructure through an AI-powered interface.
Focused on: WiFi networks, clients, firewall, VPN, DPI, ACL rules, traffic shaping, and hotspot management.
- 27 management tools for complete network control
- WiFi Network Management: Create, update, and monitor WiFi networks with detailed queries
- Firewall & Security: Manage firewall zones, ACL rules with detailed access control
- Traffic Control: Configure traffic rules and rate limiting
- VPN Management: Establish site-to-site tunnels with server management
- Hotspot Services: Manage guest WiFi vouchers with detailed tracking
- Deep Packet Inspection: Analyze DPI applications and categories
- Device Management: Monitor sites, devices, and client connections with health checks
- Network Configuration: Manage WAN config, device tags, and RADIUS profiles
- Stdio Transport: MCP protocol over standard input/output for seamless integration
- HTTP Transport: Optional HTTP API for remote connections and integration
# Clone and build
git clone https://github.com/surrealwolf/unifi-network-mcp.git
cd unifi-network-mcp
go build -o bin/unifi-network-mcp ./cmdCreate a .env file:
UNIFI_BASE_URL=https://your-unifi-controller.com:8443
UNIFI_API_KEY=your-api-key-here
UNIFI_SKIP_SSL_VERIFY=false
LOG_LEVEL=info### Running the Server
**Stdio Transport (Default):**
```bash
./bin/unifi-network-mcpHTTP Transport:
MCP_TRANSPORT=http MCP_HTTP_ADDR=:8000 ./bin/unifi-network-mcpThen access the endpoints:
# Health check
curl http://localhost:8000/health
# MCP endpoint
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{"method": "tools/list"}'Environment Variables:
MCP_TRANSPORT: Set to"http"for HTTP transport (default:"stdio")MCP_HTTP_ADDR: HTTP server address (default::8000)
get_network_sites- List all network sitesget_site_details- Get detailed site informationget_site_devices- List devices in a specific siteget_device_details- Get detailed device informationget_connected_clients- List connected clients in a site
create_wifi_network- Create a new WiFi networkget_wifi_networks- List all WiFi networksget_wifi_network_detailed- Get detailed WiFi network informationupdate_wifi_network- Update WiFi network settingspatch_wifi_network- Patch specific WiFi network properties
get_firewall_zones- List firewall zonescreate_firewall_zone- Create a new firewall zonepatch_firewall_zone- Update firewall zone settingsget_acl_rules- List ACL rulescreate_acl_rule- Create an ACL rulepatch_acl_rule- Update ACL rule settings
get_traffic_rules- List traffic matching rulescreate_traffic_rule- Create a traffic rulepatch_traffic_rule- Update traffic rule settings
get_hotspot_vouchers- List hotspot voucherscreate_hotspot_voucher- Generate guest access voucherspatch_hotspot_voucher- Update voucher settings
get_vpn_servers- List VPN serversget_vpn_tunnels- List site-to-site tunnels
get_dpi_categories- List DPI categoriesget_dpi_applications- List monitored applications
| Variable | Description | Default |
|---|---|---|
UNIFI_BASE_URL |
UniFi controller URL | Required |
UNIFI_API_KEY |
API key from UniFi controller | Required |
UNIFI_SKIP_SSL_VERIFY |
Skip SSL certificate verification | false |
LOG_LEVEL |
Logging level (debug, info, warn, error) | info |
When using this MCP with Claude or GitHub Copilot:
<mcp_server>
<name>unifi-network-mcp</name>
<command>./path/to/bin/unifi-network-mcp</command>
</mcp_server>
Then request network management tasks:
- "Create a guest WiFi network with 24-hour vouchers"
- "List all clients connected to the main WiFi network"
- "Set up a firewall rule blocking port 8080"
- "Get traffic statistics for my network"
For detailed AI assistant guidance, see .github/copilot-instructions.md.
This project uses Harbor (harbor.dataknife.net) as the container registry.
# Build image for Harbor
make docker-build
# Or manually
docker build -t harbor.dataknife.net/library/unifi-network-mcp:latest .# Login to Harbor (robot account)
docker login harbor.dataknife.net \
-u '<HARBOR_USERNAME>' \
-p '<HARBOR_PASSWORD>'
# Push image
make docker-push
# Or manually
docker push harbor.dataknife.net/library/unifi-network-mcp:latest# Pull from Harbor first
docker pull harbor.dataknife.net/library/unifi-network-mcp:latest
# Run container
docker run -e UNIFI_API_KEY=your-key -e UNIFI_BASE_URL=https://your-url \
harbor.dataknife.net/library/unifi-network-mcp:latest# Create .env file with your configuration
cp .env.example .env
# Edit .env with your UniFi credentials
# Login to Harbor (if not already logged in)
# Replace <HARBOR_USERNAME> and <HARBOR_PASSWORD> with your actual credentials
docker login harbor.dataknife.net \
-u '<HARBOR_USERNAME>' \
-p '<HARBOR_PASSWORD>'
# Start the service (pulls from Harbor)
docker-compose up -d
# View logs
docker-compose logs -fThis project includes automated workflows:
- Tests: Runs on every push and pull request
- Docker Build: Validates Dockerfile builds
- Release: Creates multi-platform binaries (Linux, macOS, Windows)
- Auto-assign: Assigns PRs to authors
See .github/workflows for details.
This MCP implements the following domain-specific skills:
- Device Management: Device adoption, inventory, and monitoring
- Infrastructure Reporting: Health reports, performance analysis, capacity planning
- Network Monitoring: Site health, device status, diagnostics
- Security Management: Firewall zones, ACL rules, hotspot management
- Traffic Analysis: DPI classification, bandwidth analysis, QoS optimization
- WiFi Management: Network optimization, client analysis, band distribution
See .github/skills for detailed skill documentation.
make buildmake testmake cleanFor detailed API documentation, see docs/API_REFERENCE.md.
unifi-network-mcp/
├── cmd/
│ └── main.go # Entry point and signal handling
├── internal/
│ ├── mcp/
│ │ └── server.go # 27 MCP tool definitions and handlers
│ └── unifi/
│ ├── network.go # Network API client
│ ├── protect.go # Protect API client (shared package)
│ ├── doc.go # Package documentation
│ └── client_test.go # Integration tests
├── docs/
│ ├── API_REFERENCE.md # Detailed API documentation
│ ├── GETTING_STARTED.md # Setup guide
│ └── EXAMPLES.md # Tool usage examples
├── bin/
│ └── unifi-network-mcp # Compiled binary
├── go.mod # Go module definition
├── go.sum # Dependency lock file
├── Makefile # Build and development tasks
└── .env.example # Configuration template
make buildmake testmake cleanFor detailed API documentation, see docs/API_REFERENCE.md.
For usage examples with specific tools, see docs/EXAMPLES.md.
See docs/TROUBLESHOOTING.md for common issues and solutions.
- Go 1.23.2 or later
- UniFi Controller 7.x or later with API access enabled
MIT License - see LICENSE file for details
Contributions welcome! Please ensure:
- Code follows Go conventions
- All tests pass (
make test) - Changes are documented
- unifi-protect-mcp: MCP server for UniFi Protect (cameras, sensors, events)
- UniFi Controller: Official UniFi management software
Built with Claude Haiku 4.5 - Crafted by AI to extend your infrastructure possibilities. 🤖✨
Version: 0.1.0 | Last Updated: December 2025
