Unifi Network MCP Server
Project description
📡 UniFi Network MCP Server
A self-hosted Model Context Protocol (MCP) server that turns your UniFi Network Controller into a rich set of programmable tools. Every capability is exposed via standard MCP tools prefixed with unifi_, so any LLM or agent that speaks MCP (e.g. Claude Desktop, mcp-cli, LangChain, etc.) can query, analyse and – when explicitly confirmed – modify your network.
Table of Contents
- Features
- Quick Start
- Using with Claude Desktop
- Runtime Configuration
- 📚 Tool Catalog
- Releasing / Publishing
Features
- Full catalog of UniFi controller operations – firewall, traffic-routes, port-forwards, QoS, VPN, WLANs, stats, devices, clients and more.
- All mutating tools require
confirm=trueso nothing can change your network by accident. - Works over stdio (FastMCP) and exposes an SSE HTTP endpoint (defaults to
:3000). - One-liner launch via the console-script
mcp-server-unifi-network. - Idiomatic Python ≥ 3.10, packaged with pyproject.toml and ready for PyPI.
Quick Start
Docker
# 1. Retrieve the latest image (published from CI)
docker pull ghcr.io/sirkirby/unifi-network-mcp:latest
# 2. Run – supply UniFi credentials via env-vars or a mounted .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
Python / UV
# Install UV (modern pip/venv manager) if you don't already have it
curl -fsSL https://astral.sh/uv/install.sh | bash
# 1. Clone & create a virtual-env
git clone https://github.com/sirkirby/unifi-network-mcp.git
cd unifi-network-mcp
uv venv
source .venv/bin/activate
# 2. Install in editable mode (develop-install)
uv pip install --no-deps -e .
# 3. Provide credentials (either export vars or create .env)
cp .env.example .env # then edit values
# 4. Launch
mcp-server-unifi-network
Install from PyPI
(when published)
uv pip install unifi-network-mcp # or: pip install unifi-network-mcp
The mcp-server-unifi-network entry-point will be added to your $PATH.
Using with Claude Desktop
Add (or update) the unifi-network-mcp block under mcpServers in your claude_desktop_config.json.
Option 1 – Claude invokes the local package
"unifi-network-mcp": {
"command": "/path/to/your/.local/bin/uvx",
"args": ["--quiet", "unifi-network-mcp", "mcp-server-unifi-network"],
"env": {
"UNIFI_HOST": "192.168.1.1",
"UNIFI_USERNAME": "admin",
"UNIFI_PASSWORD": "secret",
"UNIFI_SITE": "default"
}
}
uvxhandles installing/running the package in its own environment.- The
--quietflag preventsuvxwarnings from interfering with MCP communication. - The first argument (
unifi-network-mcp) is the package name. - The second argument (
mcp-server-unifi-network) is the executable script provided by the package.
Option 2 – Claude starts a Docker container
"unifi-network-mcp": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "UNIFI_HOST=192.168.1.1",
"-e", "UNIFI_USERNAME=admin",
"-e", "UNIFI_PASSWORD=secret",
"ghcr.io/sirkirby/unifi-network-mcp:latest"
]
}
After editing the config restart Claude Desktop, then test with:
@unifi-network-mcp list tools
Runtime Configuration
The server merges settings from environment variables, an optional .env file, and src/config/config.yaml (listed in order of precedence).
Essential variables
| Variable | Description |
|---|---|
CONFIG_PATH |
Full path to a custom config YAML file. If not set, checks CWD for config/config.yaml, then falls back to the bundled default (src/config/config.yaml). |
UNIFI_HOST |
IP / hostname of the controller |
UNIFI_USERNAME |
Local UniFi admin |
UNIFI_PASSWORD |
Admin password |
UNIFI_PORT |
HTTPS port (default 443) |
UNIFI_SITE |
Site name (default default) |
UNIFI_VERIFY_SSL |
Set to false if using self-signed certs |
src/config/config.yaml
Defines HTTP bind host/port (0.0.0.0:3000 by default) plus granular permission flags. Examples below assume the default port.
📚 Tool Catalog
All state-changing tools require the extra argument confirm=true.
Firewall
unifi_list_firewall_policiesunifi_get_firewall_policy_detailsunifi_toggle_firewall_policyunifi_create_firewall_policyunifi_update_firewall_policyunifi_create_simple_firewall_policyunifi_list_firewall_zonesunifi_list_ip_groups
Traffic Routes
unifi_list_traffic_routesunifi_get_traffic_route_detailsunifi_toggle_traffic_routeunifi_update_traffic_routeunifi_create_traffic_routeunifi_create_simple_traffic_route
Port Forwarding
unifi_list_port_forwardsunifi_get_port_forwardunifi_toggle_port_forwardunifi_create_port_forwardunifi_update_port_forwardunifi_create_simple_port_forward
QoS / Traffic Shaping
unifi_list_qos_rulesunifi_get_qos_rule_detailsunifi_toggle_qos_rule_enabledunifi_update_qos_ruleunifi_create_qos_ruleunifi_create_simple_qos_rule
Networks & WLANs
unifi_list_networksunifi_get_network_detailsunifi_update_networkunifi_create_networkunifi_list_wlansunifi_get_wlan_detailsunifi_update_wlanunifi_create_wlan
VPN
unifi_list_vpn_clientsunifi_get_vpn_client_detailsunifi_update_vpn_client_stateunifi_list_vpn_serversunifi_get_vpn_server_detailsunifi_update_vpn_server_state
Devices
unifi_list_devicesunifi_get_device_detailsunifi_reboot_deviceunifi_rename_deviceunifi_adopt_deviceunifi_upgrade_device
Clients
unifi_list_clientsunifi_get_client_detailsunifi_list_blocked_clientsunifi_block_clientunifi_unblock_clientunifi_rename_clientunifi_force_reconnect_clientunifi_authorize_guestunifi_unauthorize_guest
Statistics & Alerts
unifi_get_network_statsunifi_get_client_statsunifi_get_device_statsunifi_get_top_clientsunifi_get_dpi_statsunifi_get_alerts
System
unifi_get_system_infounifi_get_network_healthunifi_get_site_settings
Releasing / Publishing
This project uses PyPI Trusted Publishing via a GitHub Actions workflow.
To publish a new version:
- Bump the
versioninpyproject.toml. - Create a new GitHub Release: Draft a new release on GitHub, tagging it with the exact same version number (e.g.,
v0.2.0if the version inpyproject.tomlis0.2.0).
Once published, users can install it via:
uv pip install unifi-network-mcp
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unifi_network_mcp-0.1.0b3.tar.gz.
File metadata
- Download URL: unifi_network_mcp-0.1.0b3.tar.gz
- Upload date:
- Size: 127.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca8383f6a535b3f57e94947f4774041a7052f84ae12ff1f555663bf9048e5264
|
|
| MD5 |
b2980cae90c8115c6d6b847eb6acf7c7
|
|
| BLAKE2b-256 |
31222543b1ed9d1e684c6eccb2136b7c638c73d3fc5c3f7a345c91d6db059c6a
|
Provenance
The following attestation bundles were made for unifi_network_mcp-0.1.0b3.tar.gz:
Publisher:
publish-to-pypi.yml on sirkirby/unifi-network-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_network_mcp-0.1.0b3.tar.gz -
Subject digest:
ca8383f6a535b3f57e94947f4774041a7052f84ae12ff1f555663bf9048e5264 - Sigstore transparency entry: 207078301
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-network-mcp@3cfa1eddf6aecb8d44b0511c17c9423db314613f -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3cfa1eddf6aecb8d44b0511c17c9423db314613f -
Trigger Event:
release
-
Statement type:
File details
Details for the file unifi_network_mcp-0.1.0b3-py3-none-any.whl.
File metadata
- Download URL: unifi_network_mcp-0.1.0b3-py3-none-any.whl
- Upload date:
- Size: 84.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73c18b7808c7a46b58c8a7ce180ae26b04f1e3f96e2ef10a17116066425466d2
|
|
| MD5 |
75fcd5bc48dabf2b14b0a9cb3aeb63d7
|
|
| BLAKE2b-256 |
eaa36540519b419c91b4846ee9f4dceb9b32c50a2b25d5ecb8f5c4e362a9e776
|
Provenance
The following attestation bundles were made for unifi_network_mcp-0.1.0b3-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on sirkirby/unifi-network-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_network_mcp-0.1.0b3-py3-none-any.whl -
Subject digest:
73c18b7808c7a46b58c8a7ce180ae26b04f1e3f96e2ef10a17116066425466d2 - Sigstore transparency entry: 207078304
- Sigstore integration time:
-
Permalink:
sirkirby/unifi-network-mcp@3cfa1eddf6aecb8d44b0511c17c9423db314613f -
Branch / Tag:
refs/tags/v0.1.0b3 - Owner: https://github.com/sirkirby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3cfa1eddf6aecb8d44b0511c17c9423db314613f -
Trigger Event:
release
-
Statement type: