unifi-mcp
Query and inspect a UniFi network through MCP with spec-driven, read-only tools by default.
Discover available UniFi entities and their read/write operation counts with
unifi_list_entities.Describe an entity's operations, parameters, and read/write status with
unifi_describe_entity.Run read (GET) operations on entities with
unifi_get, passing path and query parameters.Attempt write operations with
unifi_invokeonly whenUNIFI_ALLOW_WRITES=true; otherwise it is blocked (default read-only).Use from any MCP stdio client (Claude Desktop, Claude Code, Cursor, etc.).
Benefit from runtime-generated tool behavior based on the UniFi OpenAPI spec, with live fetch, cache, stale fallback, and bundled draft spec.
Configure gateway address, API key, TLS CA cert, timeouts, spec URL/file, cache dir, freshness, and log level via environment variables.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@unifi-mcp show me the connected clients on my UniFi network"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
unifi-mcp
A Model Context Protocol server for the UniFi Local Network Integration API. Query your UniFi network from Claude Desktop, Claude Code, Cursor, or any MCP client.
Status
Phase 1 — read-only, four generic tools, spec-driven interface generated at runtime from the UniFi OpenAPI spec.
Related MCP server: UniFi MCP Server
How it works
The server fetches the OpenAPI spec from your gateway at startup (or uses a bundled fallback) and derives all tool behaviour from it — there is no per-resource code. Adding a new UniFi entity or operation requires no code change; it becomes available as soon as the updated spec is fetched.
The four tools follow a discover-then-query pattern:
Tool | Purpose |
| List available entities (derived from OpenAPI tags) |
| Operations, parameters, and fields for one entity |
| Invoke a read (GET) operation on an entity |
| Invoke a write operation — disabled until write support ships |
The agent calls unifi_list_entities to discover what is available, then
unifi_describe_entity on an entity to learn its operations and field names,
then unifi_get to retrieve data.
Read-only by default
unifi_invoke is defined and registered but gated: it returns an error unless
UNIFI_ALLOW_WRITES=true is set. The default is read-only. Write support will
ship in a later phase.
Spec resolution
The server resolves the OpenAPI spec in order:
Fresh local cache (age <
UNIFI_SPEC_FRESHNESS_MS, default 24 h)Live fetch from the gateway (
UNIFI_BASE_URL/proxy/network/integration/v1)Stale local cache (if the live fetch fails)
Bundled spec (a static-inference draft, shipped with the package as a last-resort fallback)
Run pnpm update-spec to refresh the bundled spec from the community
OpenAPI mirror, which is pinned to a commit and checked against a recorded
SHA-256 before it is parsed.
Configuration
Copy .env.example to .env and fill in the required values.
Variable | Required | Default | Description |
| yes | — | Gateway address, e.g. |
| yes | — | Integration API key (see below) |
| no | — | Path to the controller's CA certificate (PEM) |
| no |
| Disable TLS verification — last resort only |
| no |
| Enable write operations via |
| no |
| Per-request timeout in milliseconds |
| no | — | Override the OpenAPI spec URL fetched from the gateway |
| no | — | Use a local spec file as the bundled fallback |
| no |
| Where the cached spec is written |
| no |
| Max age of the cached spec in milliseconds |
| no |
| Pino log level ( |
Getting an API key
In the UniFi Network application: Settings → Integrations → Add Integration.
Copy the generated key into UNIFI_API_KEY.
TLS
UniFi gateways use self-signed certificates. The recommended approach is to pin the controller's CA certificate:
UNIFI_CA_CERT=/path/to/controller-ca.pemExport the certificate from the UniFi console or your browser and provide the path above. This keeps TLS verification enabled.
UNIFI_INSECURE_TLS=true disables certificate verification entirely. Use it
only as a last resort — it exposes connections to man-in-the-middle attacks.
The server prints a warning to stderr on startup when it is set.
Running
pnpm install
pnpm build
node dist/cli.js # or: unifi-mcp (after npm install -g @robinbowes/unifi-mcp)Note: The package is published as @robinbowes/unifi-mcp (scoped), but the CLI
command is unifi-mcp — unchanged.
Installing in an MCP client
The transport is stdio: the client spawns the binary and speaks MCP over its
stdin/stdout. The server reads configuration from the process environment only
— it does not load .env — so the gateway address and API key must come from
the client's own config block.
Claude Code
claude mcp add unifi -s user \
-e UNIFI_BASE_URL=https://192.168.1.1 \
-e UNIFI_API_KEY=your-integration-api-key \
-- npx -y @robinbowes/unifi-mcp-s user makes the server available in every project; -s local (the default)
limits it to the current one. Avoid -s project with a literal key — that scope
writes to .mcp.json, which is committed. Confirm with claude mcp list.
A global install drops the npx resolution from every launch:
npm install -g @robinbowes/unifi-mcp
claude mcp add unifi -s user \
-e UNIFI_BASE_URL=https://192.168.1.1 \
-e UNIFI_API_KEY=your-integration-api-key \
-- unifi-mcpClaude Desktop
Add an entry to claude_desktop_config.json and restart the app. It lives in
~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on
Windows.
{
"mcpServers": {
"unifi": {
"command": "/usr/local/bin/node",
"args": ["/usr/local/lib/node_modules/@robinbowes/unifi-mcp/dist/cli.js"],
"env": {
"UNIFI_BASE_URL": "https://192.168.1.1",
"UNIFI_API_KEY": "your-integration-api-key"
}
}
}
}If the file already exists, merge the unifi key into the existing
mcpServers object — pasting the block over the whole file drops any other
servers you have configured.
Use absolute paths. Claude Desktop is a GUI application and does not inherit a
login shell's PATH, so a bare node, npx, or unifi-mcp fails to spawn.
command -v node and npm root -g give the paths for your machine.
Other stdio clients take the same command/args/env shape — Cursor and
Windsurf under mcpServers, Zed under context_servers.
From a local checkout
pnpm install && pnpm build
claude mcp add unifi-dev \
-e UNIFI_BASE_URL=https://192.168.1.1 \
-e UNIFI_API_KEY=your-integration-api-key \
-- node /absolute/path/to/unifi-mcp/dist/cli.jsTroubleshooting
Symptom | Cause |
Server exits at once with |
|
| Relative command in a GUI client; use an absolute path |
Tools load, every query fails on TLS | Self-signed gateway certificate; set |
Entity list looks unfamiliar or over-large | Gateway was unreachable at startup and the bundled draft spec was used as fallback |
For the last two, set UNIFI_LOG_LEVEL=info and read the client's server log:
the server logs spec resolved with the source it used, and warns explicitly
when it falls back to the bundled spec.
Development
pnpm install
task hooks-install # install the git hooks (once per clone, and after they change)
pnpm dev # run from source with stdio transport
pnpm test # unit + component tests
pnpm verify # format + lint + typecheck + test
pnpm update-spec # refresh the bundled spec from the pinned mirror
pnpm smoke # build, then exercise the tools against a live controller (.env)task hooks-install is not optional bookkeeping: besides the pre-commit and
commit-msg checks, the hooks re-run pnpm install --frozen-lockfile after a
checkout, merge or rebase, which is what keeps node_modules matching the
lockfile for tools that read it directly (tsserver, ALE, node dist/cli.js).
Smoke test
pnpm smoke builds the server and drives it as a real MCP client over stdio
against the controller configured in your .env. It fetches the live spec,
lists and describes entities, runs a couple of read queries, and confirms the
read-only gate refuses a write. It is read-only: nothing on the network is
changed, and the API key is never printed.
Licence
MIT.
Available Tools
4 toolsunifi_describe_entityB
Describe one entity: its operations, path/query parameters, and whether each is read (GET) or write.
Inputs: entity (required).
unifi_getC
Invoke a read (GET) operation for an entity. Provide pathParams/query as needed.
Inputs: entity (required), operationId (required), query, pathParams.
unifi_invokeA
Invoke any operation by id (including writes). Gated off unless UNIFI_ALLOW_WRITES=true. Post-v1 write path.
Inputs: entity (required), operationId (required), body, query, +1 more.
unifi_list_entitiesA
List UniFi entities (OpenAPI tags) exposed by this controller, with read/write op counts. Call first.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct purpose: list entities, describe one entity, perform read-only GET, and invoke any operation (including writes). There is slight overlap between unifi_get and unifi_invoke for reads, but descriptions clarify safety, making ambiguity low.
All tools follow the pattern unifi_<verb>, with verbs list, describe, get, invoke. The naming is predictable and consistent, with no mixing of styles.
Four tools is appropriate for a dynamic API wrapper: discovery (list, describe) and execution (get, invoke). The number is well-scoped and each tool earns its place.
The tool set covers full lifecycle of API interaction: list available endpoints, describe details, perform safe reads, and invoke any operation (including writes if enabled). No obvious gaps for its purpose.
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Official Microsoft MCP Server to query Microsoft Entra data using natural language
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables managing UniFi networks through natural language, allowing users to monitor clients, check network health, and perform device actions like blocking or restarting access points. It securely connects UniFi Controllers to MCP clients with features like Google OAuth authentication.45 npmApache 2.0
- AlicenseNot gradedqualityCmaintenanceMCP server providing Claude Code with full UniFi network management capabilities -- devices, clients, ports, bandwidth auditing, firewall policies, and traffic rules -- all through natural language.45 npm1MIT
- AlicenseAqualityDmaintenanceMCP server that turns Claude into a UniFi network specialist. Manage devices, optimize WiFi, audit security, and troubleshoot your network through natural language.3113 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage UniFi Network, Protect, and Access infrastructure through MCP tools, with support for local controllers and cloud relay.MIT