UnifiyMe

UnifiyMe

A Model Context Protocol (MCP) server for UniFi Network Controllers that enables LLMs to interact with UniFi infrastructure for monitoring and control.

Category
访问服务器

README

UnifiyMe

A Model Context Protocol (MCP) server for UniFi Network Controllers. This server allows you to interact with your UniFi network infrastructure through LLMs, providing both high-level monitoring and deep system-level control.

Features

  • Network Monitoring: Quick overview of devices, clients, and site health.
  • Client Management: Block/unblock clients, force reconnections, and search historical connection data.
  • Physical Control: Power cycle PoE ports and flash device LEDs for easy location.
  • Advanced Analytics: Deep Packet Inspection (DPI) stats, subsystem health, and alarm tracking.
  • Guest Access: Create guest WiFi vouchers on the fly.
  • SSH Diagnostics: Execute commands directly on the router and fetch system logs for deep troubleshooting.
  • Discord Integration: Manage and monitor your network directly from Discord.
  • Prometheus Exporter: Export UniFi metrics to Prometheus for long-term monitoring and alerting.
  • Grafana Dashboards: Pre-configured dashboards for visualizing network health and performance.
  • Restricted YouTube Blocker: Specialized tools for managing YouTube access via UniFi firewall rules.

Optimization

This server includes specialized optimizations for UniFi controllers:

  • Monkey-patched Session Management: Reduces redundant heartbeat checks, cutting request overhead by up to 50%.
  • Intelligent Caching: 10-second TTL cache for frequent lookups to improve responsiveness and reduce controller load.

Reliability & Security

  • Persistence Layer: Automated background monitoring ensures that critical traffic rules (like YouTube blocking) are re-enforced every 60 seconds if they are tampered with.
  • Health Monitoring: Integrated /health endpoint and Docker health checks ensure maximum uptime and automated container recovery.
  • API Hardening: All Gateway actions are strictly validated with MAC address regex and required field checks.
  • Secure Reverse Proxy: Pre-configured Caddy integration for automated TLS/HTTPS termination.

Setup

  1. Clone the repository.

  2. Install dependencies:

    npm install
    
  3. Create a .env file with your UniFi credentials:

    UNIFI_HOST=https://your-unifi-controller-ip
    UNIFI_USERNAME=your-username
    UNIFI_PASSWORD=your-password
    UNIFI_SITE=default
    
    # Optional: SSH Credentials for diagnostics
    SSH_HOST=192.168.1.1
    SSH_USERNAME=root
    SSH_PASSWORD=your-ssh-password
    
    # Optional: Discord Bot Configuration
    DISCORD_TOKEN=your-discord-bot-token
    DISCORD_CLIENT_ID=your-discord-client-id
    
  4. Build the project:

    npm run build
    

Usage

1. Installation via npm (Published)

This is the recommended way for most users. You can run the server directly using npx in your Claude Desktop configuration.

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "unifyme": {
      "command": "npx",
      "args": ["-y", "unifiyme"],
      "env": {
        "UNIFI_HOST": "https://<CONTROLLER-IP>",
        "UNIFI_USERNAME": "<YOUR-USERNAME>",
        "UNIFI_PASSWORD": "<YOUR-PASSWORD>",
        "UNIFI_SITE": "default"
      }
    }
  }
}

2. Local Development Setup

If you prefer to run from source or are contributing:

  1. Clone the repository.
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Use the following config:
{
  "mcpServers": {
    "unifyme": {
      "command": "node",
      "args": ["/path/to/UnifiyMe/dist/index.js"],
      "env": {
        "UNIFI_HOST": "...",
        "UNIFI_USERNAME": "...",
        "UNIFI_PASSWORD": "...",
        "UNIFI_SITE": "default"
      }
    }
  }
}

Discord Bot

To start the Discord bot:

npm run start # If built
# OR
npm run dev   # For development

Prometheus Exporter

The server automatically starts a Prometheus exporter on port 9090 (configurable). Metrics are available at /metrics.

Docker Support

You can run the entire stack (UnifiyMe, Prometheus, Grafana) using Docker Compose:

docker-compose up -d

Tools

Monitoring & Discovery

  • get_network_status: Get overall network health and status.
  • list_devices: List all network devices (APs, switches, gateways).
  • list_clients: List all connected network clients.
  • get_device_details: Get detailed information about a specific device.
  • search_network: Search for devices or clients by IP, MAC, hostname, or alias.
  • get_bandwidth_stats: Get top bandwidth consumers.
  • get_network_topology: Get network topology (simplified view of uplinks).
  • get_client_history: Search historical client data.
  • get_network_health: Get detailed subsystem health status.
  • get_alarms: List recent alerts and IPS/IDS events.
  • get_dpi_stats: Get application usage statistics.
  • get_wlan_config: Get WiFi network configurations (SSIDs, security, etc.).
  • get_network_config: Get logical network configurations (VLANs, subnets, DHCP).
  • get_firmware_status: Check for available firmware updates across all devices.
  • get_firewall_rules: Get all configured firewall rules.
  • get_firewall_groups: Get all configured firewall groups (IP, Port).
  • get_deep_dive: Perform a deep dive into network health, DPI stats, and active client traffic.
  • get_events: Get recent network events.

Control & Management

  • reboot_device: Restart a device by MAC address.
  • cycle_poe_port: Power cycle a PoE port on a switch.
  • locate_device: Flash/Stop flashing the LED on a device.
  • block_client / unblock_client: Manage network access for clients.
  • reconnect_client: Force a client to reconnect.
  • create_voucher: Create guest WiFi vouchers.
  • set_client_user_group: Assign a client to a specific user group (for throttling).
  • create_user_group: Create a new user group with bandwidth limits.

Specialized Management

  • block_restricted_youtube / unblock_restricted_youtube: Manage YouTube access for Restricted devices.
  • get_restricted_youtube_status: Check current YouTube blocking status for Restricted.
  • detect_iot_devices: Identify potential IoT devices not on the IoT VLAN.
  • migrate_iot_devices: Propose migration of detected IoT devices to a target network.
  • enforce_iot_limits: Throttle high-bandwidth IoT devices.
  • protect_vips: Ensure VIP devices are not throttled.
  • ensure_traffic_rule: Create or update complex traffic rules.

Diagnostics (SSH)

  • run_ssh_command: Execute a command directly on the router.
  • get_router_logs: Fetch system logs from the router.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to report issues, suggest features, and submit pull requests.

License

This project is licensed under the MIT License.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选