UniFi Network MCP Server

UniFi Network MCP Server

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

Category
访问服务器

README

UniFi Network MCP Server

A Model Context Protocol (MCP) server for the UniFi Network API. Manage your UniFi network infrastructure through AI assistants like Claude.

Quick Install

curl -fsSL https://raw.githubusercontent.com/Ruashots/unifi-network-mcp/master/install.sh | bash

This will:

  • Clone the repository to ~/.local/share/unifi-network-mcp
  • Install dependencies and build
  • Prompt for your UniFi Console URL and API key
  • Configure Claude Code automatically

Other commands:

# Reconfigure credentials
~/.local/share/unifi-network-mcp/install.sh --reconfigure

# Uninstall
~/.local/share/unifi-network-mcp/install.sh --uninstall

Features

50+ tools covering the complete UniFi Network API:

  • Sites - List all sites accessible to the API key
  • Devices - List, get statistics, adopt, restart, locate devices
  • Clients - View connected clients, authorize guest access
  • Networks - Full CRUD for network configurations
  • WiFi - Create and manage SSIDs with security settings
  • Hotspot Vouchers - Generate and manage guest vouchers
  • Firewall Zones - Organize networks into security zones
  • ACL Rules - Create and manage firewall rules with scheduling
  • Traffic Matching Lists - IP groups, port groups, domains, apps, regions

Prerequisites

  • Node.js 18+
  • UniFi Console with Network application (UniFi OS Console, Cloud Key, or self-hosted)
  • UniFi API key (Site Admin or Super Admin role)
  • jq (for automatic Claude Code configuration)

Getting a UniFi API Key

  1. Log into your UniFi Console
  2. Click your profile icon (bottom left)
  3. Go to API section
  4. Click Create API Key
  5. Copy the key (only shown once)

Note: Your API key inherits your user permissions. Use a Site Admin or Super Admin account for full access.

Manual Installation

# Clone the repository
git clone https://github.com/Ruashots/unifi-network-mcp.git
cd unifi-network-mcp

# Install dependencies
npm install

# Build
npm run build

Usage

Claude Code CLI

claude mcp add unifi-network \
  --transport stdio \
  -e UNIFI_API_KEY="your-api-key" \
  -e UNIFI_BASE_URL="https://your-console-ip" \
  -- node /path/to/unifi-network-mcp/dist/index.js

Scope options:

Flag Description
(default) Local to current directory
--scope user Available across all your projects
--scope project Shared with team via .mcp.json

Claude Desktop

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "unifi-network": {
      "command": "node",
      "args": ["/path/to/unifi-network-mcp/dist/index.js"],
      "env": {
        "UNIFI_API_KEY": "your-api-key",
        "UNIFI_BASE_URL": "https://your-console-ip"
      }
    }
  }
}

Environment Variables

Variable Description
UNIFI_BASE_URL Your UniFi Console URL (e.g., https://192.168.1.1)
UNIFI_API_KEY API key from your UniFi Console

Available Tools

Application

Tool Description
unifi_get_info Get application version and type

Sites

Tool Description
unifi_list_sites List all sites

Devices

Tool Description
unifi_list_devices List all devices at a site
unifi_get_device Get device details
unifi_get_device_statistics Get latest device statistics
unifi_adopt_device Adopt a pending device
unifi_restart_device Restart a device
unifi_locate_device Flash device LED
unifi_list_pending_devices List devices pending adoption

Clients

Tool Description
unifi_list_clients List all connected clients
unifi_get_client Get client details
unifi_authorize_guest Authorize guest on hotspot

Networks

Tool Description
unifi_list_networks List all networks
unifi_get_network Get network details
unifi_create_network Create a network
unifi_update_network Update a network
unifi_delete_network Delete a network

WiFi

Tool Description
unifi_list_wifi List all WiFi networks (SSIDs)
unifi_get_wifi Get WiFi network details
unifi_create_wifi Create WiFi network
unifi_update_wifi Update WiFi network
unifi_delete_wifi Delete WiFi network

Hotspot Vouchers

Tool Description
unifi_list_vouchers List all vouchers
unifi_get_voucher Get voucher details
unifi_create_voucher Create vouchers
unifi_update_voucher Update voucher
unifi_delete_voucher Delete voucher

Firewall Zones

Tool Description
unifi_list_firewall_zones List firewall zones
unifi_get_firewall_zone Get zone details
unifi_create_firewall_zone Create zone
unifi_update_firewall_zone Update zone
unifi_delete_firewall_zone Delete zone

ACL Rules (Firewall)

Tool Description
unifi_list_acl_rules List all ACL rules
unifi_get_acl_rule Get rule details
unifi_create_acl_rule Create ACL rule
unifi_update_acl_rule Update ACL rule
unifi_delete_acl_rule Delete ACL rule
unifi_batch_update_acl_rules Batch update rules

Traffic Matching Lists

Tool Description
unifi_list_traffic_matching_lists List all matching lists
unifi_get_traffic_matching_list Get list details
unifi_create_traffic_matching_list Create matching list
unifi_update_traffic_matching_list Update matching list
unifi_delete_traffic_matching_list Delete matching list

Supporting Resources

Tool Description
unifi_list_wans List WAN interfaces
unifi_list_vpns List VPN configurations
unifi_list_radius_profiles List RADIUS profiles
unifi_get_system_log Get system log entries
unifi_list_dpi_categories List DPI categories
unifi_list_dpi_applications List DPI applications
unifi_list_countries List countries for geo rules

Example Prompts

Once configured, use natural language:

"List all my UniFi sites"

"What devices are connected to my network?"

"Create a guest WiFi network with WPA3 security"

"Show me which clients are currently connected"

"Create 10 hotspot vouchers valid for 24 hours"

"Block traffic from the IoT network to the main network"

"Restart the access point in the living room"

"What's the current status of my UDM Pro?"

Development

npm install      # Install dependencies
npm run dev      # Run in development mode
npm run build    # Build for production
npm run watch    # Watch mode

API Endpoint

The MCP server connects to the UniFi Network Integration API at:

{UNIFI_BASE_URL}/proxy/network/integration/v1/...

This is the official public API introduced in UniFi Network 9.0+.

Security

  • Keep API keys secure and never commit them to version control
  • Use environment variables for sensitive configuration
  • API keys inherit user permissions - use least privilege principle
  • Consider creating a dedicated API user for automation

License

MIT

Links

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

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

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选