unifi-mcp

unifi-mcp

Enables read-only querying of a UniFi fleet via the Site Manager API and per-console connector proxy, allowing users to list hosts, sites, devices, ISP metrics, and live network clients through Claude.

Category
访问服务器

README

unifi-mcp

Read-only remote MCP server exposing the Example Corp / examplecorp UniFi fleet as a Claude custom connector, via the official UniFi Site Manager API (api.ui.com).

Sibling of odoo-ticket-mcp and the TRMM MCP servers — same architecture:

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
  • Client → server auth: Microsoft Entra ID, resource-server mode. The server validates audience-bound bearer tokens; it never issues them. Access is controlled by Entra group membership on the app registration.
  • Server → UniFi auth: one fixed Site Manager API key (created at unifi.ui.com → API Keys with Site Manager + Network application scopes, All Sites). Caller identity is deliberately NOT forwarded to UniFi in v1.
  • Network path: public DNS → nginx (TLS + Anthropic IP allowlist) → container. Defense in depth: the allowlist is in addition to OAuth.

Tools (all read-only)

Site Manager (fleet-wide):

Tool What it returns
unifi_list_hosts Every console (UDM Pro / UNVR / Cloud Key): id, name, model, IP, state, version
unifi_get_host One console's detail (optional full raw record)
unifi_list_sites All Network sites across consoles, with device/client counts
unifi_list_devices Adopted devices fleet-wide (APs, switches, gateways), optional per-console filter
unifi_isp_metrics WAN/ISP health (latency, loss, downtime, throughput) for all sites, 5m or 1h granularity
unifi_query_isp_metrics Same, but for specific (host, site) pairs and windows
unifi_list_sdwan_configs / unifi_sdwan_config_status SD-WAN topologies + deployment state

Connector proxy (per-console drill-down, no VPN needed):

Tool What it returns
unifi_network_sites Console-local site list (local ids differ from Site Manager ids)
unifi_network_devices A site's devices from the console's own Network API
unifi_network_device Full device detail + latest live stats (CPU, memory, uplink, radios)
unifi_network_clients Live connected clients: name, MAC, IP, connection type, uplink

Typical flow: unifi_list_hosts → pick console → unifi_network_sites → unifi_network_clients / unifi_network_device.

Local development

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 opens the endpoint — local testing only, never in production.

Entra ID app registration (one-time)

Follow TrmmMCPServer/ENTRA_SSO_PLAYBOOK.md for the annotated version. Summary — do these in order:

  1. App registrations → New registration — name UniFi MCP, single tenant, no redirect URI yet. Copy the client id + tenant id.
  2. Expose an API → Application ID URI — set to exactly https://unifi-mcp.example.com/mcp (prevents AADSTS9010010).
  3. Expose an API → Add a scope — access_as_user, admins and users can consent, enabled.
  4. Certificates & secrets → New client secret — claude-connector, 24 months. Copy the value immediately.
  5. Authentication → Add platform → Web — redirect URIs https://claude.ai/api/mcp/auth_callback and https://claude.com/api/mcp/auth_callback.
  6. Manifest — set requestedAccessTokenVersion to 2 (prevents issuer-mismatch 401s).
  7. Enterprise applications → UniFi MCP → Properties — Assignment required = Yes.
  8. Enterprise applications → Users and groups — add the Unifi-MCP-Users group. Group membership = who can use the connector.

Deploy

See PORTAINER_DEPLOY.md (Portainer Git stack + webhook redeploy) and deploy/nginx-unifi-mcp.conf (TLS + Anthropic IP allowlist).

Register the connector in claude.ai

Settings → Connectors → Add custom connector:

Field Value
URL https://unifi-mcp.example.com/mcp
Client ID the Entra app's client id
Client Secret the Entra client secret
Authorization URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
Token URL https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
Scopes https://unifi-mcp.example.com/mcp/access_as_user

Acceptance tests

# 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选