unifi-mcp
unifi-mcp
Example Corp / examplecorp の UniFi フリート を、公式 UniFi Site Manager API(api.ui.com)経由で Claude カスタムコネクタとして公開する、読み取り専用のリモート MCP サーバーです。
odoo-ticket-mcp や TRMM MCP サーバーの兄弟プロジェクトで、同じアーキテクチャを採用しています。
Claude (claude.ai / Claude Code)
│ OAuth 2.0 bearer token (Microsoft Entra ID)
▼
nginx — TLS, Anthropic egress-IP allowlist (160.79.104.0/21), 403 otherwise
│ http://127.0.0.1:8097
▼
unifi-mcp container (Portainer stack, FastMCP 3.x, Streamable HTTP at /mcp)
│ X-API-KEY (Site Manager API key, read-only usage)
▼
api.ui.com — Site Manager API + connector proxy into each console's Network APIクライアント→サーバー認証: Microsoft Entra ID(リソースサーバーモード)。サーバーは audience に紐付いたベアラートークンを検証するのみで、トークンを発行することはありません。アクセス制御は、アプリ登録の Entra グループメンバーシップによって行われます。
サーバー→UniFi 認証: 固定の Site Manager API キーを1つ使用します(unifi.ui.com → API キー で、Site Manager アプリケーションスコープ + Network アプリケーションスコープ、全サイトを選択して作成)。v1 では、呼び出し元の ID は意図的に UniFi に転送されません。
ネットワークパス: パブリック DNS → nginx(TLS + Anthropic IP 許可リスト)→ コンテナ。多層防御として、許可リストは OAuth に追加して適用されます。
ツール(すべて読み取り専用)
Site Manager(フリート全体):
ツール | 戻り値 |
| すべてのコンソール(UDM Pro / UNVR / Cloud Key): ID、名前、モデル、IP、状態、バージョン |
| 1台のコンソールの詳細(オプションで完全な生レコード) |
| コンソールをまたぐ全 Network サイトと、デバイス/クライアント数 |
| フリート全体で採用済みのデバイス(AP、スイッチ、ゲートウェイ)。コンソール単位のフィルタリングも可能 |
| 全サイトの WAN/ISP ヘルス(遅延、損失、ダウンタイム、スループット)。5分または1時間の粒度 |
| 特定の(ホスト、サイト)ペアと期間を指定して同じメトリクスを取得 |
| SD-WAN トポロジ + デプロイ状態 |
コネクタプロキシ(コンソール単位のドリルダウン。VPN は不要):
ツール | 戻り値 |
| コンソールローカルのサイト一覧(ローカル ID は Site Manager ID とは異なります) |
| コンソール自身の Network API から取得したサイトのデバイス一覧 |
| デバイスの完全な詳細と、最新のライブ統計(CPU、メモリ、アップリンク、無線) |
| 接続中のライブクライアント: 名前、MAC、IP、接続タイプ、アップリンク |
一般的なフロー: unifi_list_hosts → コンソールを選択 → unifi_network_sites → unifi_network_clients / unifi_network_device
Related MCP server: UniFi MCP Server
ローカル開発
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
copy .env.example .env # fill in UNIFI_API_KEY; set MCP_AUTH_ENABLED=false
.venv\Scripts\python -m unifi_mcp
# → http://127.0.0.1:8000/mcp (test with MCP Inspector)MCP_AUTH_ENABLED=false でエンドポイントが開きます。ローカルテスト専用で、本番環境では使用しないでください。
Entra ID アプリ登録(初回のみ)
注釈付きのバージョンは TrmmMCPServer/ENTRA_SSO_PLAYBOOK.md を参照してください。概要は以下の通りです。この順番で行ってください:
アプリの登録 → 新規登録 — 名前は
UniFi MCP、サポートされるアカウントの種類はシングルテナント、リダイレクト URI はまだ指定しません。クライアント ID とテナント ID をコピーします。API の公開 → アプリケーション ID URI — 正確に
https://unifi-mcp.example.com/mcpに設定します(AADSTS9010010 を防ぎます)。API の公開 → スコープの追加 —
access_as_userを追加し、管理者とユーザーの同意が可能な状態にします。証明書とシークレット → 新しいクライアント シークレット —
claude-connector、有効期限は 24 か月。すぐに値をコピーします。認証 → プラットフォームを追加 → Web — リダイレクト URI に
https://claude.ai/api/mcp/auth_callbackとhttps://claude.com/api/mcp/auth_callbackを追加します。マニフェスト —
requestedAccessTokenVersionを2に設定します(発行者不一致の 401 エラーを防ぎます)。エンタープライズ アプリケーション → UniFi MCP → プロパティ — 割り当てが必要 = はい に設定します。
エンタープライズ アプリケーション → ユーザーとグループ —
Unifi-MCP-Usersグループを追加します。グループメンバーシップ = コネクタを使用できるユーザーです。
デプロイ
PORTAINER_DEPLOY.md(Portainer Git スタック + Webhook 再デプロイ)と deploy/nginx-unifi-mcp.conf(TLS + Anthropic IP 許可リスト)を参照してください。
claude.ai にコネクタを登録
設定 → コネクタ → カスタムコネクタを追加:
フィールド | 値 |
URL |
|
クライアント ID | Entra アプリのクライアント ID |
クライアントシークレット | Entra のクライアントシークレット |
認証 URL |
|
トークン URL |
|
スコープ |
|
受け入れテスト
# 1. Discovery doc advertises the full resource scope (not api://…)
curl -s https://unifi-mcp.example.com/.well-known/oauth-protected-resource/mcp | jq .scopes_supported
# 2. Unauthenticated /mcp is challenged
curl -i https://unifi-mcp.example.com/mcp # 401 + WWW-Authenticate: Bearer
# 3. Non-Anthropic source IP is blocked at nginx
curl -i https://unifi-mcp.example.com/mcp # from anywhere else: 403
# 4. Health (host-local, bypasses nginx)
curl http://<docker-host>:8097/healthz # {"status":"ok","service":"unifi_mcp"}
# 5. In claude.ai: connect as a Unifi-MCP-Users member → tools appear;
# non-member → AADSTS50105 at sign-in.This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Ubiquiti UniFi network infrastructure for monitoring devices, managing clients, and performing configuration tasks like blocking/unblocking devices and viewing network health.101GPL 3.0
- AlicenseDqualityDmaintenanceEnables comprehensive management of UniFi network infrastructure through the UniFi Cloud API, including device control, client management, camera settings, and access door control through natural language.3952Apache 2.0
- AlicenseBqualityDmaintenanceEnables AI assistants to manage and monitor UniFi Network Controllers through natural language. Provides 25 read-only tools for discovering devices and clients, viewing security configurations, analyzing network statistics, and exporting configuration data.41MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to manage UniFi network infrastructure through 50+ tools covering devices, clients, networks, WiFi, firewall rules, and guest access using the official UniFi Network API.52585MIT
Related MCP Connectors
Uptime, SSL, DNS and domain monitoring you can talk to from Claude or any MCP client.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Connect Claude to Fathom meeting recordings, transcripts, and summaries
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JohnGilligan2/unifi-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server