unifi-mcp
Enables querying UniFi network devices and data using natural language through MCP clients like Claude Desktop.
README
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.
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 |
|---|---|
unifi_list_entities |
List available entities (derived from OpenAPI tags) |
unifi_describe_entity |
Operations, parameters, and fields for one entity |
unifi_get |
Invoke a read (GET) operation on an entity |
unifi_invoke |
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 (shipped with the package as a last-resort fallback)
Run pnpm update-spec to update the bundled spec from a live gateway.
Configuration
Copy .env.example to .env and fill in the required values.
| Variable | Required | Default | Description |
|---|---|---|---|
UNIFI_BASE_URL |
yes | — | Gateway address, e.g. https://192.168.1.1 |
UNIFI_API_KEY |
yes | — | Integration API key (see below) |
UNIFI_CA_CERT |
no | — | Path to the controller's CA certificate (PEM) |
UNIFI_INSECURE_TLS |
no | false |
Disable TLS verification — last resort only |
UNIFI_ALLOW_WRITES |
no | false |
Enable write operations via unifi_invoke |
UNIFI_TIMEOUT_MS |
no | 30000 |
Per-request timeout in milliseconds |
UNIFI_SPEC_URL |
no | — | Override the OpenAPI spec URL fetched from the gateway |
UNIFI_SPEC_FILE |
no | — | Use a local spec file as the bundled fallback |
UNIFI_CACHE_DIR |
no | ~/.cache/unifi-mcp |
Where the cached spec is written |
UNIFI_SPEC_FRESHNESS_MS |
no | 86400000 |
Max age of the cached spec in milliseconds |
UNIFI_LOG_LEVEL |
no | error |
Pino log level (error, warn, info, debug) |
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.pem
Export 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.
For use with an MCP client, point the client at the binary with stdio transport.
Development
pnpm install
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 a live gateway
pnpm smoke # build, then exercise the tools against a live controller (.env)
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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。