UniFi Network MCP — Claude Code MCP server: use, install
This MCP server lets AI assistants inspect and manage UniFi Network clients, devices, VLANs, VPNs, and firewall rules. It fits network audits and controlled changes.
claude mcp add --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_API_KEY=<UNIFI_API_KEY> --env UNIFI_PORT=<UNIFI_PORT> --transport stdio network -- uvx unifi-network-mcpWhat UniFi Network MCP does
UniFi Network MCP exposes 210 UniFi Network tools to an AI assistant. It can query clients, devices, firewall rules, VLANs, VPNs, Traffic Flows, statistics, recent events, and configuration changes.
Mutating actions use a preview-then-confirm flow, so the proposed change is shown before it is applied. Setup needs a UniFi controller host, a username, and a password; an API key is used for inventory and explicit Integration API tools. Without a controller host, the server stays in setup mode and offers only unifi_setup_status.
Claude Code can store the connection as plugin options, while Codex saves a version-pinned MCP entry in config.toml. Other listed clients can launch the server with uvx unifi-network-mcp.
What it helps with
- inspect clients and usage on a VLAN
- audit firewall policies for conflicts
- find access points with frequent client disconnects
- review network changes before applying them
- summarize large Traffic Flows and new clients
Example prompts for the agent
- Audit my firewall policies and identify redundant or conflicting rules.
- Show network changes from the last 24 hours, then prepare an IoT blocking rule for confirmation.
How to install UniFi Network MCP
Platform CLI
claude mcp add --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_API_KEY=<UNIFI_API_KEY> --env UNIFI_PORT=<UNIFI_PORT> --transport stdio network -- uvx unifi-network-mcpReplace <…> with your own values. 2 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-network-mcp <command>
Platform CLI
codex mcp add network --env UNIFI_HOST=<UNIFI_HOST> --env UNIFI_USERNAME=<UNIFI_USERNAME> --env UNIFI_PASSWORD=<UNIFI_PASSWORD> --env UNIFI_API_KEY=<UNIFI_API_KEY> --env UNIFI_PORT=<UNIFI_PORT> -- uvx unifi-network-mcpReplace <…> with your own values. 2 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-network-mcp <command>
Config file
{
"mcpServers": {
"network": {
"command": "uvx",
"args": [
"unifi-network-mcp"
],
"env": {
"UNIFI_HOST": "<UNIFI_HOST>",
"UNIFI_USERNAME": "<UNIFI_USERNAME>",
"UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
"UNIFI_API_KEY": "<UNIFI_API_KEY>",
"UNIFI_PORT": "<UNIFI_PORT>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-network-mcp <command>
Config file
{
"servers": {
"network": {
"type": "stdio",
"command": "uvx",
"args": [
"unifi-network-mcp"
],
"env": {
"UNIFI_HOST": "<UNIFI_HOST>",
"UNIFI_USERNAME": "<UNIFI_USERNAME>",
"UNIFI_PASSWORD": "<UNIFI_PASSWORD>",
"UNIFI_API_KEY": "<UNIFI_API_KEY>",
"UNIFI_PORT": "<UNIFI_PORT>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-network-mcp <command>
Platform CLI
gemini mcp add -e UNIFI_HOST=<UNIFI_HOST> -e UNIFI_USERNAME=<UNIFI_USERNAME> -e UNIFI_PASSWORD=<UNIFI_PASSWORD> -e UNIFI_API_KEY=<UNIFI_API_KEY> -e UNIFI_PORT=<UNIFI_PORT> network uvx unifi-network-mcpReplace <…> with your own values. 2 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from unifi-network-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about UniFi Network MCP
How do I install UniFi Network MCP in Claude Code?
Run `claude mcp add unifi-network-mcp -e UNIFI_HOST=<UNIFI_HOST> -e UNIFI_USERNAME=<UNIFI_USERNAME> -e UNIFI_PASSWORD=<UNIFI_PASSWORD> -e UNIFI_API_KEY=<UNIFI_API_KEY> -- uvx unifi-network-mcp`.
What does UniFi Network MCP do?
It gives an AI assistant tools for UniFi Network clients, devices, firewall rules, VLANs, VPNs, statistics, and Traffic Flows. Changes use a preview-before-confirm flow.
What does UniFi Network MCP need to run?
It needs a UniFi controller host, account credentials, and an MCP client. An API key is used for inventory and explicit Integration API tools.