Self-hosted UniFi MCP server enables programmable network management with querying and secure modifications
The UniFi Network MCP Server is designed to transform your UniFi Network Controller into a versatile, programmable toolset accessible via the Model Context Protocol (MCP). It enables AI applications like Claude Desktop, Continue, Cursor, and others to interact with sophisticated network management tasks such as firewall policies, traffic routing, port forwarding, Quality of Service (QoS), Virtual Private Networks (VPNs), Wireless Local Area Network (WLAN) settings, device management, client handling, and statistical analysis. This server serves as a bridge between AI applications and the UniFi Controller's rich set of built-in capabilities.
The UniFi Network MCP Server offers a comprehensive suite of tools prefixed with unifi_
that enable you to query, analyze, and modify your network configuration programmatically. These tools include:
Firewall Management: Tools like unifi_list_firewall_policies
, unifi_toggle_firewall_policy
, and unifi_create_firewall_policy
allow for fine-grained control over network security.
Traffic Routing & QoS: Comprehensive management of traffic routes, QoS rules, and WLAN settings with tools such as unifi_list_traffic_routes
and unifi_create_qos_rule
.
Device Control: Functions like unifi_reboot_device
, unifi_rename_device
, and unifi_upgrade_device
enable detailed device management.
Client Management: Tools to manage clients, including blocking, unblocking, renaming, and authorizing guests with actions from unifi_block_client
to unifi_authorize_guest
.
System & Alert Monitoring: Features such as unifi_get_system_info
provide insights into the network's overall health.
VPN Management: Tools for configuring and managing both client and server aspects of VPNS like unifi_list_vpn_clients
.
All these capabilities are meticulously designed to be used safely, with a requirement for explicit confirmation via the confirm=true
parameter in mutating operations. The UniFi Network MCP Server also supports both FastMCP (stdio
) and SSE (HTTP) communication endpoints, ensuring seamless integration across various environments.
The UniFi Network MCP Server is built on idiomatic Python 3.10 and packaged with pyproject.toml
for ease of deployment. It leverages the Model Context Protocol to communicate securely with AI applications and local devices. The server architecture includes a robust command-line interface that supports one-liner launches, as well as Docker containerization for convenient execution.
Using Mermaid syntax, here’s an illustrated flowchart of the MCP protocol interaction:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
The compatibility matrix below details the support status for various MCP clients, including their ability to interact with the UniFi Network MCP Server's tools and commands.
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
To get started, you have multiple installation options, including Docker and traditional Python setup through virtual environments.
Install the latest version directly from the GitHub container registry:
docker pull ghcr.io/sirkirby/unifi-network-mcp:latest
Run the server by supplying UniFi credentials via environment variables or a .env
file:
docker run -i --rm \
-e UNIFI_HOST=192.168.1.1 \
-e UNIFI_USERNAME=admin \
-e UNIFI_PASSWORD=secret \
ghcr.io/sirkirby/unifi-network-mcp:latest
For a more detailed setup, follow these steps:
Install UV (modern pip/venv manager):
curl -fsSL https://astral.sh/uv/install.sh | bash
Clone the repository and create a virtual environment:
git clone https://github.com/sirkirby/unifi-network-mcp.git
cd unifi-network-mcp
uv venv
source .venv/bin/activate
Install from PyPI (future versions):
uv pip install --no-deps -e .
Provide credentials by creating a .env
file and updating values.
Launch the server using mcp-server-unifi-network
.
Example configuration in.env
:
UNIFI_HOST=192.168.1.1
UNIFI_USERNAME=admin
UNIFI_PASSWORD=secretpassword
Start the server with:
uv python -m unifi_network_mcp.server
AI applications can use the UniFi Network MCP Server to continuously monitor network performance, manage traffic routes, and prioritize certain types of data based on real-time analysis. This setup enables an intelligent response system that ensures network resources are allocated for mission-critical tasks.
unifi_list_traffic_routes
to gather current routing configurations.unifi_config_traffic_route
.AI systems can leverage the server's capabilities for routine device maintenance. For example, automated rebooting of underperforming devices or scheduling software updates without manual intervention.
unifi_get_system_info
.unifi_reboot_device
.The UniFi Network MCP Server provides seamless integration points for various AI applications that support the Model Context Protocol through its API. Common operations include setting up new devices, managing network policies, monitoring performance metrics, and more.
{
"mcpServers": {
"unifiNetworkServer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-unifi-network"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
This configuration is a simplified example and may need adjusting based on specific use cases or client requirements.
The performance matrix not only highlights the server's capabilities but also its integration with different MCP clients. This helps developers understand which features are fully supported and where additional work might be needed for optimal compatibility.
Feature | Claude Desktop | Continue |
---|---|---|
Device Management (on/off) | ✅ | ❌ |
Traffic Policies | ✅ | ✅ |
QoS Rules | ✅ | ✅ |
WLAN Settings | ✅ | ✅ |
For developers and administrators looking to fine-tune their setup, the UniFi Network MCP Server provides advanced configuration options secured with environment variables and strict access controls.
UNIFI_HOST
), username (UNIFI_USERNAME
), and password (UNIFI_PASSWORD
).Q: How do I install the UniFi Network MCP Server via Docker?
A: Pull the latest container image from the GitHub registry and run it with appropriate environment variables configured.
Q: Can I set up device management using AI applications? A: Yes, you can manage devices like setting schedules for reboots or updates, which are fully supported features.
Q: Are all tools compatible with every MCP client?
A: Some clients do not support certain operations, as noted in the compatibility matrix. Always check before integrating new functionality.
Q: How does security work with the UniFi Network MCP Server? A: Security is ensured through robust access control, and all communication can be encrypted using SSL/TLS.
Q: What are the performance implications of running this server on a resource-limited device?
A: Performance should remain stable even on less powerful machines but can be optimized for better resource management.
Contributions to the UniFi Network MCP Server project are welcome. Developers interested in contributing can find detailed guidelines and coding standards in our repository documentation.
Fork the Repository: Click on "Fork" to create your local version.
Clone the Repository:
git clone https://github.com/yourusername/unifi-network-mcp.git
cd unifi-network-mcp
Install Dependencies:
pip install -r requirements.txt
Run the Server Locally: Use your preferred method based on installation instructions.
Create Issues and Pull Requests: Open issues for bugs or enhancements, and submit pull requests to implement them.
For more information and resources related to the Model Context Protocol (MCP), visit the official MCP documentation.
This comprehensive guide positions the UniFi Network MCP Server as a critical tool for integrating advanced AI applications with network management tasks, ensuring robust and secure communication patterns.
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Python MCP client for testing servers avoid message limits and customize with API key
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
Analyze search intent with MCP API for SEO insights and keyword categorization
AI Vision MCP Server offers AI-powered visual analysis, screenshots, and report generation for MCP-compatible AI assistants