UniFi RMCP

ai.dinglebear由 dinglebear.ai 發布v0.2.4更新於 Oct 24, 2026

Rust MCP server and CLI for UniFi Network controller operations.

發布方自己的服務:RMCP

概覽

AI 產生的概覽

本機 MCP 伺服器兼 CLI,讓助理讀取 UniFi Network 控制器的用戶端、裝置、WLAN 與健康狀態,並在具備管理員權限時執行變更操作。

可以做什麼
讀取用戶端、裝置、WLAN 設定、站點健康、告警、事件、控制器系統資訊與目前驗證身分,可透過便利操作及 list_clients、list_devices 等混合別名完成。呼叫產生的 official_* 操作,存取有文件的 Network Integration API 端點。呼叫以模型為基礎的 unifi_* 內部控制器操作,其中包含變更類操作。使用 help 操作查看內建操作說明。透過 CLI 執行相同操作,便於腳本化與除錯。
適用情境
適合已運行 UniFi Network 控制器、希望助理彙整網路狀態、檢視用戶端與裝置或執行控制器操作而不必開啟主控台的場景。最適合本機單人環境;共用 HTTP 部署可行,但需自行設定驗證。
執行需求
透過 npx 以本機程序執行(npm 套件會從 GitHub Releases 下載 runifi 二進位檔),或使用自行建置的二進位檔。npm 方式需要 Node.js,並需能連線至控制器的網路,以及設定 UNIFI_URL 與 UNIFI_API_KEY 環境變數。選用設定包括站點名稱、舊版控制器、略過 TLS 驗證與 HTTP 驗證。
安裝前請注意
UNIFI_API_KEY 是控制器憑證,只應透過環境變數、設定檔或用戶端的密鑰儲存提供,切勿放入工具參數。許多產生操作屬於變更類,會修改網路設定;在掛載的 HTTP 模式下需要 unifi:admin 權限,實際權限由 UniFi 控管。預設對自簽控制器略過 TLS 驗證。非回送位址的 HTTP 部署需使用 bearer 權杖、OAuth 或可信任閘道。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 UniFi RMCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

unifi-rmcp

UniFi Network client, device, WLAN, firewall, and health operations over MCP and CLI.

It exposes one MCP tool, unifi, plus the runifi CLI. Agents can inspect clients, devices, WiFi networks, health, alarms, events, controller sysinfo, and authenticated identity, and can use generated official_* / unifi_* actions when their MCP auth scope permits it.

30-second path: set UNIFI_URL and UNIFI_API_KEY, then run npx -y @dinglebear/runifi health --json -> start loopback HTTP with UNIFI_MCP_HOST=127.0.0.1 npx -y @dinglebear/runifi serve -> call tools/call with {"action":"health"}.

Status: operational RMCP upstream-client server. The preserved convenience actions are read-oriented; generated mutating actions require unifi:admin authorization. HTTP MCP supports loopback dev mode, static bearer tokens, and Google OAuth through lab-auth.

Not for: replacing the UniFi console, storing controller credentials for callers, bypassing UniFi permissions, generic HTTP proxying, multi-tenant isolation, or passing UniFi API keys through MCP tool arguments.

Contents

Naming

SurfaceThis repo
Repositoryunifi-rmcp
Rust crateunifi-rmcp
Binary / CLIrunifi
npm package@dinglebear/runifi
npm binary aliasesunifi-rmcp, runifi
MCP toolunifi
Config home~/.unifi-rmcp on hosts, /data in containers
Env prefixesUNIFI_*, UNIFI_MCP_*, UNIFI_RMCP_* for npm launcher controls

The repo and npm package use the RMCP family name, while the shipped binary uses the short Rust CLI name runifi.

Capabilities And Boundaries

  • Read connected wireless and wired clients, network devices, WLAN configs, site health, active alarms, recent events, controller sysinfo, and current authenticated user.
  • Dispatch generated official_* actions for documented Network Integration API endpoints.
  • Dispatch model-backed unifi_* internal controller actions and hybrid aliases such as list_clients, list_devices, list_networks, list_wifi, and get_system_info.
  • Enforce unifi:read for read actions and unifi:admin for mutating actions in mounted HTTP MCP mode.
  • Provide setup, doctor, and endpoint-verification commands for local runtime checks.
This repo ownsUniFi ownsExplicitly out of scope
MCP/CLI projection, action registry, request validation, HTTP MCP auth policy, response shaping, generated action dispatch, setup checks, and endpoint verification.Controller state, site/device/client data, UniFi users, API key issuance, upstream authorization, and actual network mutations.Replacing the controller UI, credential brokerage, arbitrary HTTP proxying, long-lived polling, policy-as-code, multi-tenant sandboxing, and local gateway provisioning.

Install

PathCommandBest forNotes
npm / npxnpx -y @dinglebear/runifi --helpLocal MCP clients and quick trials.Downloads the matching runifi binary from GitHub Releases.
Release installercurl -fsSL https://raw.githubusercontent.com/dinglebear-ai/runifi/main/scripts/install.sh | bashHost installs without Node.Installs runifi for the current Linux host.
Docker / Composedocker compose up -dShared HTTP MCP deployments.Reads .env and exposes container port 40030.
Build from sourcecargo build --releaseDevelopment and audits.Produces target/release/runifi.
Pluginclaude plugin install plugins/unifiClaude Code local plugin setup from this checkout.Ships the skill and .mcp.json. No session hooks — plugin settings reach the server through .mcp.json's ${user_config.*} env block, so no manual setup step is needed.

npm / npx

Run the stdio MCP server or CLI without a manual binary install:

bash
npx -y @dinglebear/runifi --helpnpx -y @dinglebear/runifi mcpnpx -y @dinglebear/runifi health --json

The npm package downloads runifi during postinstall. Override download behavior only when testing packaging:

VariablePurpose
UNIFI_RMCP_SKIP_DOWNLOAD=1Skip postinstall binary download.
UNIFI_RMCP_VERSION or UNIFI_RMCP_BINARY_VERSIONSelect the GitHub Release tag.
UNIFI_RMCP_REPOSelect the GitHub repo used for release downloads.
UNIFI_RMCP_RELEASE_BASE_URLSelect a custom release base URL.

Build From Source

bash
git clone [email protected]:dinglebear-ai/runifi.gitcd runificargo build --release./target/release/runifi --help

Minimum supported Rust version: 1.86. The Cargo workspace has three members: the root unifi-rmcp package, crates/unifi (reusable core), and xtask (dev tooling). All members inherit Rust edition 2024 and MSRV 1.97.1 from the workspace root.

Quickstart

1. Create A UniFi API Key

In UniFi OS, go to Settings -> Admins & Users -> API Keys, create a key, and copy it into UNIFI_API_KEY.

2. Configure The Controller

bash
export UNIFI_URL=https://unifi.localexport UNIFI_API_KEY=...export UNIFI_SITE=defaultexport UNIFI_SKIP_TLS_VERIFY=true

Set UNIFI_LEGACY=true only for older non-UDM controllers that do not use the /proxy/network path prefix.

3. Run A Safe CLI Call

bash
npx -y @dinglebear/runifi health --json

4. Start Loopback HTTP MCP

bash
UNIFI_MCP_HOST=127.0.0.1 npx -y @dinglebear/runifi serve

In another shell:

bash
curl -sf http://127.0.0.1:40030/health

5. Make A First MCP Call

bash
curl -s -X POST http://127.0.0.1:40030/mcp \  -H "Content-Type: application/json" \  -H "Accept: application/json, text/event-stream" \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"unifi","arguments":{"action":"health"}}}'

Client Configuration

Claude Code Stdio

json
{  "mcpServers": {    "unifi": {      "command": "npx",      "args": ["-y", "unifi-rmcp", "mcp"],      "env": {        "UNIFI_URL": "https://unifi.local",        "UNIFI_API_KEY": "...",        "UNIFI_SITE": "default",        "UNIFI_SKIP_TLS_VERIFY": "true"      }    }  }}

Claude Code HTTP

json
{  "mcpServers": {    "unifi": {      "type": "http",      "url": "http://127.0.0.1:40030/mcp",      "headers": {        "Authorization": "Bearer ${UNIFI_MCP_TOKEN}"      }    }  }}

Codex / Labby Gateway

Register UniFi through Labby as an HTTP upstream when sharing one long-running server, or run it directly as stdio for local-only use.

toml
[mcp_servers.unifi]command = "npx"args = ["-y", "unifi-rmcp", "mcp"]

Generic MCP JSON

json
{  "command": "runifi",  "args": ["mcp"],  "env": {    "UNIFI_URL": "https://unifi.local",    "UNIFI_API_KEY": "..."  }}

Do not put UNIFI_API_KEY, OAuth secrets, passwords, SSH keys, or upstream bearer tokens in MCP tool arguments. Use env, config files, or the MCP client's secret storage. MCP callers never provide credentials, tokens, keys, or secrets as action arguments.

Runtime Surfaces

SurfaceStatusEntry pointPurpose
MCP stdioSupportedrunifi mcp, npx -y @dinglebear/runifi mcpLocal child-process MCP clients.
MCP HTTPSupportedrunifi serve, POST /mcpStreamable HTTP MCP for local or shared server deployments.
CLISupportedrunifi <command>Scriptable parity and debugging.
PromptsSupportednetwork_summaryAgent prompt for UniFi status summaries.
ResourceSupportedMCP tool schema resourceClient-side schema discovery.
REST APINot shippedN/AUniFi already owns the REST APIs.
Web UINot shippedN/AUniFi already owns the controller UI.

MCP Tool Reference

One MCP tool is exposed: unifi. Pass the required action argument to select the operation. The action enum is generated from the inventories in data/, so the surface is large:

FamilyActionsMutating
official_*7836
unifi_*17587
Preserved convenience80
Hybrid aliases50
help10
Total267123

Counts are derived from data/unifi_official_network_v10_3_58.json and the runtime: true entries of data/unifi_internal_endpoint_models.json. crates/unifi/src/capabilities.rs is the source of truth at runtime.

Preserved Convenience Actions

ActionDescriptionRequired paramsOptional params
clientsConnected wireless and wired clients.nonenone
devicesNetwork devices: APs, switches, gateways.nonenone
wlansWiFi network configurations.nonenone
healthSite health summary.nonenone
alarmsActive alarms and alerts.nonenone
eventsRecent controller events.nonelimit
sysinfoController system information.nonenone
meAuthenticated UniFi identity.nonenone
helpBuilt-in action documentation.nonenone

Generated Action Families

FamilyDescriptionScope behavior
official_*Documented Network Integration API operations under /proxy/network/integration/v1.Read operations require unifi:read; mutating operations require unifi:admin.
unifi_*Model-backed internal controller-compatible actions under /proxy/network/api/s/{site} and /proxy/network/v2/api/site/{site}.Read operations require unifi:read; mutating operations require unifi:admin.
Hybrid aliaseslist_clients, list_devices, list_networks, list_wifi, get_system_info.Use internal actions by default, or official API when siteId or params.prefer="official" is supplied.

Endpoint coverage is tracked in docs/unifi_api_coverage.md; contract and safe live verification are documented in docs/unifi_endpoint_verification.md.

CLI Reference

The binary calls the same service layer as the MCP tool:

bash
runifi clients [--json]runifi devices [--json]runifi wlans [--json]runifi health [--json]runifi alarms [--json]runifi events [--limit N] [--json]runifi sysinfo [--json]runifi me [--json]runifi official_list_clients --param siteId=<uuid> --jsonrunifi official_create_network --param siteId=<uuid> --body-json '{"name":"IoT"}' --jsonrunifi list_clients --param siteId=<uuid> --jsonrunifi doctor [--json]runifi setup check [--json]runifi setup repair [--json]runifi setup install [--json]runifi setup plugin-hook [--no-repair] [--json]

Generated actions accept --param k=v, --body-json JSON, and --json.

setup plugin-hook maps CLAUDE_PLUGIN_OPTION_* env vars into UNIFI_*, refreshes the ~/.local/bin copy of the binary, and runs check + repair. It used to run automatically from a Claude Code SessionStart/ConfigChange hook; those hooks have been removed.

You do not need to run it to configure the plugin: plugins/unifi/.mcp.json maps your plugin settings into the server's environment directly via ${user_config.*}. Run it by hand only when you want the ~/.local/bin binary refresh or the preflight checks.

Configuration

Configuration loads from config.toml first, then UNIFI_* environment variables override it. Host installs read ~/.unifi-rmcp/.env before loading config; containers read /data/.env. Process environment overrides both.

VariableDefaultPurpose
UNIFI_URLunsetController base URL, e.g. https://unifi.local.
UNIFI_API_KEYunsetAPI key for the X-API-KEY header.
UNIFI_SITEdefaultUniFi site name.
UNIFI_SITE_IDunsetOfficial API site UUID used by live tests and explicit generated calls.
UNIFI_SKIP_TLS_VERIFYtrueSkip TLS certificate verification for self-signed controllers.
UNIFI_LEGACYfalseLegacy controller mode without /proxy/network prefix.
UNIFI_MCP_HOST0.0.0.0HTTP bind host.
UNIFI_MCP_PORT40030HTTP bind port.
UNIFI_MCP_TOKENunsetStatic bearer token for HTTP MCP.
UNIFI_MCP_NO_AUTHfalseDisable auth only for loopback development.
UNIFI_MCP_DISABLE_HTTP_AUTHfalseCompatibility alias for UNIFI_MCP_NO_AUTH.
UNIFI_NOAUTHfalseTrust an upstream gateway to enforce auth.
UNIFI_MCP_ALLOWED_HOSTSemptyComma-separated Host header allowlist.
UNIFI_MCP_ALLOWED_ORIGINSemptyComma-separated CORS Origin allowlist.
UNIFI_MCP_PUBLIC_URLunsetPublic URL for OAuth metadata.
UNIFI_MCP_AUTH_MODEbearerbearer or oauth.
UNIFI_MCP_GOOGLE_CLIENT_IDunsetGoogle OAuth client ID.
UNIFI_MCP_GOOGLE_CLIENT_SECRETunsetGoogle OAuth client secret.
UNIFI_MCP_AUTH_ADMIN_EMAILunsetAdmin email for OAuth bootstrap.
UNIFI_MCP_AUTH_SQLITE_PATH/data/auth.dbOAuth state database path.
UNIFI_MCP_AUTH_KEY_PATH/data/auth-jwt.pemOAuth JWT signing key path.
UNIFI_MCP_HOME~/.unifi-rmcpAppdata dir override; read by setup only.

config.toml-only settings with no environment override: mcp.server_name and the [mcp.auth] TTL, rate-limit, and allowlist fields (access_token_ttl_secs, refresh_token_ttl_secs, auth_code_ttl_secs, register_rpm, authorize_rpm, disable_static_token_with_oauth, allowed_emails, allowed_client_redirect_uris). See config.example.toml.

xtask endpoint verification reads its own variables that the server never touches: UNIFI_ALLOW_INSECURE_TLS, UNIFI_RESOLVE_IP, UNIFI_VERIFY_TIMEOUT_SECS, UNIFI_VERIFY_RATE_LIMIT_MS, UNIFI_VERIFY_MAX_REQUESTS, UNIFI_VERIFY_UNVERIFIED_INTERNAL.

Authentication

Stdio MCP runs as a local trusted child process and does not use HTTP auth.

HTTP MCP auth policy:

StateConditionBehavior
Loopback devUNIFI_MCP_HOST starts with 127. or auth is explicitly disabled on loopbackLocal unauthenticated development is allowed.
Mounted bearerNon-loopback with UNIFI_MCP_TOKENRequires Authorization: Bearer <token> and action scopes.
Mounted OAuthUNIFI_MCP_AUTH_MODE=oauthUses Google OAuth/JWT through lab-auth.
Trusted gatewayUNIFI_NOAUTH=trueAssumes a reverse proxy or gateway already enforced auth.

unifi:admin satisfies unifi:read; unifi:read does not satisfy mutating actions.

Safety And Trust Model

  • UniFi API keys are loaded from config/env only.
  • MCP callers select actions, params, and request bodies, not upstream credentials.
  • Preserved convenience actions are read-oriented.
  • Generated mutating actions require unifi:admin in mounted HTTP MCP mode.
  • Unknown actions and malformed generated-action params fail before upstream calls.
  • Non-loopback HTTP deployments must use bearer auth, OAuth, or a trusted authenticated gateway.
  • This bridge does not sandbox UniFi itself. UniFi remains responsible for API permissions and the actual network-side effect of a mutating call.

Architecture

text
Capabilities   (src/capabilities.rs)   official/internal/hybrid registry      |UnifiClient    (src/api.rs, src/unifi.rs) HTTP path families and transport      |UnifiService   (src/app.rs)            action execution boundary      |MCP shim       (src/mcp/tools.rs)      JSON args -> service -> ValueCLI shim       (src/cli.rs)            argv -> service -> stdout

Distribution Contract

  • Cargo.toml, Cargo.lock, packages/unifi-rmcp/package.json, .release-please-manifest.json, and server.json must agree on the released version.
  • GitHub Releases publish the runifi binary consumed by the npm launcher.
  • The npm package name is @dinglebear/runifi; binary aliases are @dinglebear/runifi and runifi.
  • Docker/OCI metadata uses ghcr.io/dinglebear-ai/runifi:<version>. The GHCR namespace still reads jmagar because that is what .github/workflows/docker-publish.yml publishes; the git remote is dinglebear-ai/runifi. Do not "fix" one without the other.
  • plugins/unifi/.mcp.json must launch npx -y @dinglebear/runifi mcp so stdio clients start the MCP transport rather than the HTTP server.
  • plugins/unifi/ ships no Claude Code hooks. scripts/validate-plugin-layout.sh and tests/setup_cli.rs both fail if a hooks/ directory or a manifest hooks key reappears.
  • The root README is curated. Source of truth for current actions and generated endpoint coverage is src/capabilities.rs, the data/ inventories, docs/unifi_api_coverage.md, and docs/unifi_endpoint_verification.md.

Development

bash
cargo fmt --checkcargo testcargo clippy -- -D warningscargo build --releasenpm --prefix packages/unifi-rmcp run check

Verification

bash
npm --prefix packages/unifi-rmcp run checkcargo checkcargo testcargo clippy -- -D warningsjust validate-plugincargo run -p xtask -- verify-api-endpoints --mode contractgit diff --check

Live read probes require a controller:

bash
UNIFI_URL=https://<gateway> \UNIFI_API_KEY=<network-api-key> \UNIFI_SITE=default \UNIFI_SITE_ID=<official-site-uuid> \UNIFI_SKIP_TLS_VERIFY=true \cargo run -p xtask -- verify-api-endpoints --mode safe_live

Deployment

Use loopback for local development:

bash
UNIFI_MCP_HOST=127.0.0.1 runifi serve

Use Docker Compose for shared HTTP deployment:

bash
cp .env.example .envdocker compose up -d

When binding to a non-loopback address, configure UNIFI_MCP_TOKEN, UNIFI_MCP_AUTH_MODE=oauth, or UNIFI_NOAUTH=true behind an authenticated gateway.

Troubleshooting

SymptomCheck
UNIFI_URL or UNIFI_API_KEY is missingSet it in env or ~/.unifi-rmcp/.env.
TLS errors against a UniFi controllerKeep UNIFI_SKIP_TLS_VERIFY=true unless the controller has a trusted certificate.
Legacy controller paths failSet UNIFI_LEGACY=true for older non-UDM controllers.
HTTP /mcp returns unauthorizedSet UNIFI_MCP_TOKEN and send Authorization: Bearer <token>.
Stdio client hangs or logs JSON errorsEnsure client config runs unifi-rmcp mcp, not the default HTTP server mode.
Generated official action needs siteIdPass --param siteId=<uuid> or MCP params.siteId.
Mutating generated action is forbiddenUse an HTTP MCP token/session with unifi:admin.

Related Servers

All sibling servers live under the dinglebear-ai org.

  • soma - RMCP runtime and scaffold for provider-backed MCP servers.
  • rtailscale - Tailscale API bridge for devices, users, and tailnet operations.
  • unraid - Unraid monorepo; unraid-rs/ is the GraphQL bridge (binary runraid).
  • rapprise - Apprise notification fan-out bridge for many delivery backends.
  • rgotify - Gotify push notification bridge for sends, messages, apps, and clients.
  • rarcane - Arcane Docker management bridge for containers and related resources.
  • yarr - Media-stack bridge for Sonarr, Radarr, Prowlarr, Plex, and related services.
  • rytdl - Media download and metadata workflow server.
  • synapse - Local Synapse workflow server for scout and flux actions.
  • cortex - Syslog and homelab log aggregation MCP server.
  • axon - RAG, crawl, scrape, extract, and semantic search project.
  • labby - Homelab control plane and MCP gateway project.

Documentation

  • CLAUDE.md is the curated local operating guide for contributors and agents.
  • docs/unifi_api_coverage.md is the curated API-family and coverage summary.
  • docs/unifi_endpoint_verification.md is the curated endpoint verification guide.
  • docs/SETUP.md is curated plugin/setup guidance.
  • docs/OAUTH.md is curated OAuth setup guidance.
  • plugins/unifi/skills/unifi/SKILL.md is the agent usage guide.
  • data/ inventories are generated/reference inputs for the action registry.
  • src/ is the source of truth for current action dispatch, config defaults, auth behavior, and CLI parsing.

License

Original Dinglebear-authored portions of this project are licensed under AGPL-3.0-only. Separate commercial licensing is available for organizations that need terms outside the AGPL. Third-party material remains under its original license. See LICENSING.md.

來源:README.md,提交 68f46bc

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Rmcp 整合