KM

kallistox/mcp-unifi-applications

浏览器自动化

本页由 AI 翻译,技术细节请以原文为准。 查看原文

40 stars 6 forks 质量 85 趋势 26MIT

这是一个MCP服务器,将UniFi应用API文档(Network、Protect、Site Manager)作为Claude Desktop、Claude Code(VS Code / JetBrains)或任何兼容MCP客户端的可查询工具。

概览

这是一个MCP服务器,将UniFi应用API文档(Network、Protect、Site Manager)作为Claude Desktop、Claude Code(VS Code / JetBrains)或任何兼容MCP客户端的可查询工具。 包含一个基于Playwright的爬虫,将JS渲染文档的SPA转换为结构化的JSON文件,以及一个为它们提供服务的Python主控服务器。 “你能告诉我如何用 UniFi 的网络 API 用 Go 创建网络吗?以及我有哪些关于托管 IPv4 DHCP 网关配置的选项?” Claude 会自动查询 MCP 服务器——搜索端点、获取模式并深入判别器变体——然后回复完整的 API 细节和一个可用的 Go 示例: 爬虫运行在 Docker 内部(需要 Playwright/Chromium): 包含预先抓取的文档:Network API v10.3.58(docs/network/)、Protect v7.1.87(docs/protect/)、Site Manager v1.0.0(docs/site-manager/)。每个应用目录都包含一个_meta.json(API 版本、抓取日期、页数)。

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,使官方UniFi API文档可被AI代理查询——端点搜索、模式深入分析,以及五种语言的代码示例,适用于Claude Desktop、Claude Code(VS Code / JetBrains)或任何兼容MCP的客户端。

涵盖Ubiquiti发布的所有应用程序API:Network、Protect、Site Manager、InnerSpace、Mobility和Carrier Fabric。

它是只读且无需凭证:它提供文档,不与你的控制器通信。包含一个基于Playwright的爬虫,将JS渲染的文档SPA转换为结构化JSON,以及一个提供该功能的Python主控服务器。

示例

“没有任何上下文,仅通过使用unifi-applications MCP Server:你能吗? 告诉我如何用 UniFi 的网络 API 用 Go 创建网络, 我有哪些关于托管IPv4 DHCP网关配置的选项?”

Claude 通过服务器来处理这些,服务器里没有任何文档 先说一下背景:

呼叫 回应内容
search_endpoints("create network") POST /v1/sites/{siteId}/networks

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

UniFi MCP Server — Queryable API Documentation

A Model Context Protocol (MCP) server that makes the official UniFi API documentation queryable by AI agents — endpoint search, schema drill-down, and code examples in five languages, for Claude Desktop, Claude Code (VS Code / JetBrains), or any MCP-compatible client.

Covers every application Ubiquiti publishes API docs for: Network, Protect, Site Manager, InnerSpace, Mobility and Carrier Fabric.

It is read-only and credential-free: it serves documentation, it does not talk to your controller. Includes a Playwright-based scraper that turns the JS-rendered docs SPA into structured JSON, and a Python MCP server that serves it.

Example

“Without any context, just by using the unifi-applications MCP Server: can you tell me how to create a network with Go with the network API from UniFi, and what options do I have regarding the managed IPv4 DHCP gateway configuration?”

Claude works that out through the server, with none of the documentation in its context to begin with:

Call What comes back
search_endpoints("create network") POST /v1/sites/{siteId}/networks
get_endpoint("network/createnetwork") the request body — management is a discriminated union
get_field_schema(…, "management[GATEWAY].ipv4Configuration.dhcpConfiguration") only the DHCP subtree
get_example("network/createnetwork", "go") a working request in Go

The third call is the one that earns the server its place. It returns this, and nothing else — not the 70 KB endpoint schema it is buried in:

# management[GATEWAY].ipv4Configuration.dhcpConfiguration (in requestBody)
- dhcpConfiguration: object (Gateway Managed IPv4 DHCP Configuration) — IPv4 DHCP
  configuration for this network. If omitted or null, DHCP is not working and hosts
  must get an address statically or from another server in this broadcast domain.
  - mode: string (required)
    [RELAY]:
在 GitHub 查看完整 README

安装

docker run --rm -v "$(pwd)/src/mcp_unifi_applications/docs:/output" unifi-scraper node scrape.mjs
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "unifi-docs": { "type": "stdio", "command": "mcp-unifi-applications" } } }