Skip to content
Unifi Mcp

Unifi Mcp

github.com • November 24, 2026

Network, Protect, Access and InnerSpace each connect to a console you name on your network. Site Manager is different: it reads Ubiquiti's cloud Site Manager API at with one account-wide key, and has nine read-only tools. It counts its domain tools only, without the meta-tools every server registers.

InnerSpace reads the floor plans, walls and device placements of the UniFi InnerSpace application on a console, with a console login rather than an API key, and has nine read-only domain tools, counted the same way. It has no plugin yet; add it to your MCP client with uvx or Docker, as InnerSpace shows.

Install these from the Claude Code, Codex or OpenClaw marketplace; Quick Start shows how.

The Agent Skills table lists every skill each plugin ships.

Choose an integration

An MCP adapter can expose a small set of tools while using unifi-api-server as its backend. This keeps application-specific joins, branching, loops, and code isolation out of the general-purpose MCP servers.

Cloud Relay pairs the Cloudflare-hosted Worker gateway with the Relay sidecar on your LAN. The Worker provides the authenticated edge MCP endpoint, Durable Object broker, multi-location routing, token boundary, and deployment/management CLI. The Relay sidecar is a local MCP HTTP client and forwarder: it discovers configured local MCP servers over HTTP and maintains an outbound WebSocket to the Worker. Remote requests follow MCP client → Worker gateway → outbound WebSocket → Relay sidecar → local MCP servers over HTTP ; the API server is not in this path. Read-only tools support annotation-based multi-location fan-out, while writes require explicit location targeting. Deploy the Worker with npm install -g unifi-mcp-worker && unifi-mcp-worker install , then see the Relay sidecar README to connect local servers.

unifi-api-server is an independent HTTP service for custom applications, automation, and adapters. It provides typed REST resources, read-only GraphQL queries, SSE streams, scoped API keys and administration, plus a REST action endpoint for supported controller operations. It shares unifi-core managers with the MCP servers but does not proxy or require them.

The API server also serves the nine Site Manager reads once an administrator adds one account-level cloud connection. Every API key with the read scope can then read the whole cloud account; see Site Manager cloud connection . It serves the nine InnerSpace reads for a controller that declares the innerspace product with a username and password, and never returns plan image bytes; see InnerSpace console product .

See apps/api/README.md for quick-start and deployment patterns.

UniFi MCP is a collection of Model Context Protocol servers that let AI assistants and automation tools interact with Ubiquiti UniFi controllers. Each server targets a specific UniFi application (Network, Protect, Access) and exposes its functionality as MCP tools — queryable, composable, and safe by default.

The InnerSpace server is local-first like the console servers: it talks only to the console you name, with a console login. The Cloud Relay does not include it unless you add it to UNIFI_RELAY_SERVERS , and floor plans describe a building, so weigh that before you do.

MCP HTTP is unauthenticated by default and intended for trusted local clients. Set UNIFI_MCP_HTTP_AUTH_TOKEN to require a static bearer token on every HTTP request ( details ). HTTP is disabled by default; when enabled, packages bind to loopback. Docker Compose enables it on the container network and publishes ports 3000–3002 on host 127.0.0.1 ; the Site Manager service uses port 3003 and the InnerSpace service port 3005, and each starts only with its own opt-in profile ( sitemanager , innerspace ). Use an authenticated TLS proxy or Cloud Relay for remote access, and prevent direct access to the backend. See the transport security model and HTTP setup and migration .

UniFi MCP keeps the standard MCP path primary: capable clients discover currently registered tools with tools/list and invoke them with tools/call . The default lazy mode keeps initial context small by exposing meta-tools first, while eager mode registers all selected domain tools directly for clients that prefer a full standard tool list.

The lazy-loading meta-tools — *_tool_index , *_execute , *_batch , *_batch_status , *_batch_cancel , and lazy-only *_load_tools — support filtered discovery, indirect execution, batch orchestration, and optional direct registration. They are independent of the protocol-version response compatibility policy below. See MCP Discovery and Lazy-Loading Meta-Tools for mode-by-mode behavior.

For tool results that already provide structured output, adaptive response mode is the default. It classifies each request by the canonical date-based protocolVersion advertised during MCP initialization, not by the client's product name or application version. Requests advertising MCP 2025-06-18 or later receive concise text in content and the full result once in structuredContent ; requests advertising an earlier revision (such as 2024-11-05 or 2025-03-26 ), or whose revision metadata is missing or malformed, retain the full compatibility JSON in content . Set UNIFI_MCP_CONTENT_MODE=compat to force that duplicated compatibility form, or UNIFI_MCP_CONTENT_MODE=compact to force concise text plus the full structured result even outside a negotiated request. Use compat for any client that consumes the full result only from content , regardless of its advertised revision.

The lazy-loading meta-tools remain content-only; they are not the pre- 2025-06-18 protocol category described above. For structured inner results, *_execute and *_batch_status expose one normalized JSON payload in content rather than a nested transport pair; content-only execute results remain unchanged. Response modes do not convert these meta-tools to structuredContent .

UNIFI_NETWORK_MCP_CONTENT_MODE , UNIFI_PROTECT_MCP_CONTENT_MODE , UNIFI_ACCESS_MCP_CONTENT_MODE , UNIFI_SITEMANAGER_MCP_CONTENT_MODE , and UNIFI_INNERSPACE_MCP_CONTENT_MODE override the global setting for their respective servers. Independently of transport compaction, Network's unifi_get_dashboard defaults to summary=true , while unifi_list_rogue_aps defaults to a summarized page of at most 100 records; pass summary=false when the full selected data is required.

Install with your agent

Paste the block below into your coding agent. It points the agent at the canonical, versioned setup guide and limits what it may change:

The guide covers native plugins, product-scoped npx skills add installs, OpenCode's built-in MCP support, and the current manual paths for Antigravity, Cursor, and Devin Desktop. A skills install adds agent guidance; it does not by itself register the MCP server.

See the changelog for what each plugin release changed, and the plugin upgrade guide before updating an existing install.

Claude Code (recommended)

Install via the plugin marketplace — includes the MCP server, an agent skill, and guided setup:

Repeat for Protect or Access if needed:

For an account-wide view from Ubiquiti's cloud, /plugin install unifi-sitemanager@unifi-plugins , then run its setup skill to give it a Site Manager API key as a file or command provider. It asks for no console host or login.

For the cross-product skills, /plugin install unifi-intelligence@unifi-plugins also installs the Network and Protect plugins it needs. Claude Code opens no options dialog for plugins it installs as dependencies, so run each product's setup command ( /unifi-network:unifi-network-setup , /unifi-protect:unifi-protect-setup ) for any not yet configured.

/plugin install of a product plugin opens its options dialog straight away; fill it in there, or close it and run the setup command. Each plugin's setup command walks you through connecting to your controller and configuring permissions, and saves the result as the plugin's Claude Code options. Auto-update is off by default for this marketplace; see the plugin upgrade guide for update steps.

Prerequisites, version boundaries and verification status for each client are in the plugin support matrix .

Register the UniFi MCP marketplace, then install the plugins from Codex's /plugins UI:

Launch codex , run /plugins , open the UniFi MCP marketplace, and install unifi-network , unifi-protect , unifi-access , or unifi-sitemanager . unifi-intelligence adds the cross-product skills; Codex does not install plugin dependencies, so install and set up unifi-network and unifi-protect before it. After installing, ask Codex to run the plugin's setup skill, for example:

Use the unifi-network-setup skill to configure this for Codex.

Use the unifi-network-setup skill to configure this for Codex.

The setup skill saves your controller settings and credential provider references in a private file, ~/.config/unifi-mcp/ .env , which the plugin's own server reads, and keeps the same preview-before-confirm safety model as Claude Code. Codex installs plugin upgrades itself at the start of a session, and the server comes with them, so nothing needs rerunning. If you ran Codex setup before plugin 1.0.0, run its one-time --refresh ; see the plugin upgrade guide .

UniFi account requirements

The Network, Protect and Access servers authenticate to the local UniFi controller APIs with a local admin/service account. Do not use a Ubiquiti SSO cloud account for their setup. For Network MCP today, accounts that require SSO MFA or local 2FA are not supported through configuration; use a dedicated local admin account without MFA for the service account, scoped to the permissions you are comfortable giving the MCP server.

The Site Manager server needs no console account. It uses a Site Manager API key created at unifi.ui.com under Settings > API Keys, which reads every console the UI account can see.

OpenClaw can install the same UniFi plugin bundles from the marketplace and map their skills plus MCP server definitions into embedded Pi sessions:

In a terminal OpenClaw asks you to confirm the source and the plugin's capabilities. Without a terminal, for example in a script, add --force --accept-capabilities ; otherwise it refuses.

Then run the matching setup skill from OpenClaw ( unifi-network-setup , unifi-protect-setup , or unifi-access-setup ), or run the plugin's setup script yourself. Point the password at a credential provider so the secret never appears in the command line:

Setup saves these settings in ~/.config/unifi-mcp/network.env , readable by you only, and the plugin's own server reads that file. It adds no entry to openclaw.json , so openclaw plugins update brings each new server version with nothing to rerun. An mcp.servers.unifi-network entry in openclaw.json replaces the plugin's server and pins its version; setup before plugin 1.0.0 wrote one, and set-env.sh --target openclaw --refresh converts it once (see the upgrade guide ). Repeat with unifi-protect or unifi-access as needed. Install unifi-intelligence for the cross-product skills only after setting up unifi-network and unifi-protect ; OpenClaw does not install plugin dependencies.

Run the servers directly:

For Claude Desktop, add to your claude_desktop_config.json :

Tip: If all servers connect to the same controller, you can use the shared UNIFI_HOST / UNIFI_USERNAME / UNIFI_PASSWORD variables instead of repeating them per server. A server given its own host that is not UNIFI_HOST needs its own username and password too; see Multi-controller setups .

Tip: If all servers connect to the same controller, you can use the shared UNIFI_HOST / UNIFI_USERNAME / UNIFI_PASSWORD variables instead of repeating them per server. A server given its own host that is not UNIFI_HOST needs its own username and password too; see Multi-controller setups .

Give the Site Manager server only its own key, in a file only you can read. It takes none of the console variables above:

It uses stdio by default; HTTP is opt-in on port 3003. See the Site Manager README .

The InnerSpace server has no plugin yet; add it to your MCP client directly. It reads InnerSpace through a console login, takes no API key, and never reads UNIFI_API_KEY . Keep the password in a file only you can read:

It uses stdio by default; HTTP is opt-in on port 3005. The image is ghcr.io/sirkirby/unifi-innerspace-mcp . See the InnerSpace README .

Once connected, just ask your AI agent in natural language:

"Show me all clients on the Guest VLAN with their signal strength and data usage" "Create a firewall rule that blocks IoT devices from reaching the internet between midnight and 6 AM" "Audit my firewall policies — are there any redundant or conflicting rules?" "Show me the top traffic flows from the last hour and group them by destination"

"Show me all clients on the Guest VLAN with their signal strength and data usage" "Create a firewall rule that blocks IoT devices from reaching the internet between midnight and 6 AM" "Audit my firewall policies — are there any redundant or conflicting rules?" "Show me the top traffic flows from the last hour and group them by destination"

"List all cameras that detected motion in the last hour" "Show me smart detection events from the front door camera today — people and vehicles only" "Find driveway detections for white vans this week"

"List all cameras that detected motion in the last hour" "Show me smart detection events from the front door camera today — people and vehicles only" "Find driveway detections for white vans this week"

"Who badged into the office today? Show me a timeline of all door access events" "Create a visitor pass for John Smith with access to the main entrance tomorrow 9-5"

"Who badged into the office today? Show me a timeline of all door access events" "Create a visitor pass for John Smith with access to the main entrance tomorrow 9-5"

"List every console on my UniFi account with its OS version and whether it is connected" "Which sites had WAN downtime or high latency in the last 24 hours?"

"List every console on my UniFi account with its OS version and whether it is connected" "Which sites had WAN downtime or high latency in the last 24 hours?"

"Which floor plans does my InnerSpace project have, and how many access points are placed on each?" "List the devices I have adopted but not yet placed on a floor plan"

"Which floor plans does my InnerSpace project have, and how many access points are placed on each?" "List the devices I have adopted but not yet placed on a floor plan"

UniFi Intelligence (the unifi-intelligence plugin)

"Switch aa:bb:cc:00:10:02 dropped off at 8:45 this morning, New York time. What happened between 8:00 and 9:00?" — cites Network events and mapped Protect camera events with their coverage "Show me everything that happened at the front entrance in the last hour" — needs the cloud worker and relay

"Switch aa:bb:cc:00:10:02 dropped off at 8:45 this morning, New York time. What happened between 8:00 and 9:00?" — cites Network events and mapped Protect camera events with their coverage "Show me everything that happened at the front entrance in the last hour" — needs the cloud worker and relay

All mutations use a preview-then-confirm flow (Site Manager has none: every one of its domain tools reads) — you see exactly what will change before anything is applied.

Set these variables in the server's process environment (shell exports, the MCP client's env block, or Docker environment: / env_file: ):

Startup configuration: The servers do not automatically load .env files or config/config.yaml from the working directory. MCP clients may launch servers inside untrusted projects, so project files must not control where credentials are sent or weaken permissions and redaction. If you previously relied on automatic loading, select a trusted env file in your launcher (for example, uv run --env-file /absolute/path/to/trusted.env --with unifi-network-mcp unifi-network-mcp ) or set an absolute CONFIG_PATH for custom YAML. Docker Compose env_file: remains supported.

Per-user settings file: UNIFI_SETTINGS_FILE names a file the server reads at startup, before anything else reads configuration. The Codex plugin's setup writes ~/.config/unifi-mcp/ .env and points its bundled server at it. The file holds KEY=VALUE lines ( # , optional matching quotes; no export , interpolation or multi-line values). Only UNIFI_* keys are accepted, and each behaves exactly as if exported, including _FILE / _COMMAND providers and policy gates. Variables already in the process environment win. A missing file is not an error. On POSIX the file must be owned by you and not group- or world-writable (keep it chmod 600 ); Windows has no mode check, so keep it in your user profile.

To keep the secret out of the MCP client's environment (and out of every process the client spawns), set UNIFI_PASSWORD_FILE to a path whose contents are the password, or UNIFI_PASSWORD_COMMAND to an absolute argv whose stdout is the password ( contract ). The same _FILE / _COMMAND suffixes work on UNIFI_API_KEY and on the per-server variables below. Details are in each server's docs/configuration.md .

Multi-controller setups

Each server supports its own prefixed environment variables that take priority over the shared UNIFI_* variables. This lets you point the Network and Protect servers at different controllers (or different credentials) while keeping a single trusted env file explicitly loaded by the launcher.

Credentials follow the host. The shared username, password and API key (rows marked †) are used only when the server has no host of its own, or its host and port name the same console as UNIFI_HOST (compared as written apart from letter case: no scheme, slash or space is stripped, and an IP address and a hostname for the same console count as different). A server pointed at another host takes its credentials from its own variables, and logs at startup which shared variable it ignored. Older releases sent the shared credentials to any host, so give a server on another host its own credentials. The other rows always fall back. Details: credential providers .

Single controller? Just set the shared UNIFI_* variables -- all servers will use them. Server-specific variables are only needed when the servers talk to different controllers or use different credentials; a server whose host differs from UNIFI_HOST needs its own credentials as well.

Site Manager has no shared fallback. Its only credential is UNIFI_SITEMANAGER_API_KEY , or its _FILE / _COMMAND form (set exactly one). It never reads UNIFI_API_KEY , any other shared UNIFI_* variable, config.yaml or CONFIG_PATH , and it takes no host, username or password. A console key and a Site Manager key reach different places, so neither is ever sent to the other's destination. See Site Manager configuration .

InnerSpace uses a console login. It takes a host, username and password like the other console servers, but has no API key setting and never reads UNIFI_API_KEY . See InnerSpace configuration .

Controller operation gate: The Network, Protect and Access servers run confirmed writes to their controller one at a time, in the order they arrive (direct calls, *_execute and *_batch alike), and cap concurrent reads. The InnerSpace server caps its reads the same way. UNIFI_WRITE_HOLD_SECONDS (default 120), UNIFI_CALL_WAIT_SECONDS (25) and UNIFI_READ_CONCURRENCY (8) tune it, with per-server overrides such as UNIFI_NETWORK_READ_CONCURRENCY . A call refused as busy sends nothing to the controller and says so. The guarantee is per server process. See each server's configuration page.

Tracing: Set OTEL_EXPORTER_OTLP_ENDPOINT to export the MCP SDK's spans over OTLP, one per MCP message, continuing a trace context passed in the request's _meta . The Docker images include the exporter; pip and uvx installs need the otel extra (for example unifi-network-mcp[otel] ). Off by default.

For the full configuration reference including permissions, transports, and advanced options, see the Network server docs , Protect server docs , Access server docs , Site Manager server docs , or InnerSpace server docs .

Tool and API responses redact known controller secret fields by default — Wi-Fi passphrases, VPN private/preshared keys, whole VPN config blobs (imported WireGuard/OpenVPN .conf / .ovpn files), API tokens, SNMP community strings, SNMPv3 passwords, device-SSH credentials and the management key, and Access credential token/PIN values come back as ***REDACTED*** . This keeps secrets out of agent context and logs.

When a trusted local administration workflow genuinely needs raw values, disable redaction for that process with UNIFI_REDACT_SENSITIVE_FIELDS=false or a server-specific override such as UNIFI_NETWORK_REDACT_SENSITIVE_FIELDS=false , UNIFI_PROTECT_REDACT_SENSITIVE_FIELDS=false , UNIFI_ACCESS_REDACT_SENSITIVE_FIELDS=false , UNIFI_SITEMANAGER_REDACT_SENSITIVE_FIELDS=false , UNIFI_INNERSPACE_REDACT_SENSITIVE_FIELDS=false , or UNIFI_API_REDACT_SENSITIVE_FIELDS=false . To keep an existing secret during an update, simply omit the field — do not pass the ***REDACTED*** marker back; doing so is rejected so the placeholder can never be written as a real secret. See PRIVACY.md for the full list of redacted fields.

Each plugin ships with agent skills that go beyond raw tool access — they teach agents how to perform common tasks effectively:

Skills include reference documentation for device states, alarm types, firewall schemas, and event fields. The agent gathers and interprets evidence; the firewall score CLI computes scores from supported findings. Firewall snapshots, diffs, and template application follow the skill instructions.

Each non-setup skill declares required and optional servers and requires a Coverage and Limitations section in reports. Missing required dependencies stop the workflow; optional missing sources, failed reads, and result caps are disclosed. Security Patrol and Visitor Audit need the cloud worker's merged timeline through a connected relay; see Cross-Product Capabilities .

This is a monorepo with shared packages:

Each Python server in apps/ is an independent package that depends on the shared packages. apps/worker/ is intentionally separate: it is a self-contained TypeScript/Node app for the Cloudflare Worker gateway and npm CLI. Keeping it in this repo lets relay protocol changes and worker contract tests move together.

See docs/ARCHITECTURE.md for details.

See CONTRIBUTING.md for the development workflow, including how to work with the monorepo, run tests, and submit PRs.

UniFi MCP is maintained as an independent open-source project. Sponsorship helps cover the ongoing AI costs behind building, testing, and maintaining the project, plus live controller compatibility testing, release maintenance, documentation, and issue triage across the Network, Protect, Access, Site Manager, API, relay, and plugin packages.

For a reproducible Network, Protect, or Access MCP problem, if the server can start and register tools, generate and review an optional sanitized support bundle before opening a public bug report. If it cannot, use the bug report's manual form fields instead. The Site Manager and InnerSpace servers have no support-bundle tool; follow their Site Manager or InnerSpace troubleshooting guide and use the manual fields. Support bundles are safer than ordinary diagnostic logs but remain sanitized, not anonymous.

See what sponsorship funds

Extracted Entities

Companies (2)

Platforms (1)

Tools (1)