A Model Context Protocol (MCP) server that integrates the UI.com Site Manager API with Claude Desktop, providing comprehensive access to UniFi network management through natural language.
- Host Management: List and retrieve detailed information about UniFi hosts
- Site Management: Access all sites running UniFi Network applications
- Device Management: Monitor and manage UniFi devices across your network
- ISP Metrics: Retrieve performance metrics with customizable time ranges
- SD-WAN Management: Configure and monitor SD-WAN deployments
- 12 MCP Tools covering all API endpoints
- 4 MCP Resources for direct data access
- Natural Language Interface through Claude Desktop
- Pagination Support for large datasets
- Error Handling with comprehensive logging
- Python 3.8+
- UniFi Site Manager API key
- Claude Desktop (for MCP integration)
-
Clone the repository
git clone https://github.com/your-username/Unimcp.git cd Unimcp -
Set up virtual environment
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
-
Configure environment variables
cp .env.example .env # Edit .env and add your UniFi API key -
Run the server
./start_server.sh # On Windows: start_server.bat
Add this configuration to your Claude Desktop config file:
{
"mcpServers": {
"unifi": {
"command": "python3",
"args": ["/path/to/Unimcp/main.py"],
"env": {
"UNIFI_API_KEY": "your_api_key_here"
}
}
}
}- π API Reference - Complete API documentation
- βοΈ Configuration Guide - Setup and configuration
- π³ Docker Deployment - Container deployment
- π§ Troubleshooting - Common issues and solutions
list_hosts- List all hosts associated with your UI accountget_host_by_id- Get detailed information about a specific host
list_sites- List all sites from hosts running UniFi Network applications
list_devices- List UniFi devices with filtering and pagination support
get_isp_metrics- Retrieve ISP performance metrics (5m/1h intervals)query_isp_metrics- Query metrics with custom parameters
list_sdwan_configs- List all SD-WAN configurationsget_sdwan_config_by_id- Get detailed SD-WAN configurationget_sdwan_config_status- Check SD-WAN configuration status
get_sites- Legacy method for listing sitesget_devices- Legacy method for listing devicesget_clients- Legacy method (deprecated - not available in Site Manager API)
This implementation provides 100% coverage of the UI.com Site Manager API v1.0 endpoints:
| Endpoint | Method | Status |
|---|---|---|
/v1/hosts |
GET | β Implemented |
/v1/hosts/{hostId} |
GET | β Implemented |
/v1/sites |
GET | β Implemented |
/v1/devices |
GET | β Implemented |
/ea/isp-metrics/{type} |
GET | β Implemented |
/ea/isp-metrics/query |
POST | β Implemented |
/v1/sd-wan/configs |
GET | β Implemented |
/v1/sd-wan/configs/{configId} |
GET | β Implemented |
/v1/sd-wan/configs/{configId}/status |
GET | β Implemented |
Run with Docker Compose:
docker-compose up -dOr build and run manually:
docker build -t unifi-mcp-server .
docker run -p 8000:8000 -e UNIFI_API_KEY=your_key unifi-mcp-server| Variable | Required | Description | Default |
|---|---|---|---|
UNIFI_API_KEY |
Yes | Your UniFi Site Manager API key | - |
UNIFI_API_URL |
No | UniFi API base URL | https://api.ui.com |
- Log in to your UniFi console
- Navigate to Settings β Control Plane β Integrations
- Click "Create API Key"
- Save the generated key securely
"Show me all my UniFi hosts"
"Get ISP metrics for the last 24 hours"
"List all devices with their status"
"Show SD-WAN configuration details for config_123"
# List hosts
curl -X GET "http://localhost:8000/mcp/tools/list_hosts" \
-H "Content-Type: application/json" \
-d "{}"
# Get ISP metrics
curl -X GET "http://localhost:8000/mcp/tools/get_isp_metrics" \
-H "Content-Type: application/json" \
-d '{"metric_type": "5m", "duration": "24h"}'Run the API coverage test:
source .venv/bin/activate
python3 test_unifi_client.py- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- π Documentation
- π Issue Tracker
- π¬ Discussions