Skip to main content
Glama
UniFi Network API MCP Server

UniFi Network API MCP Server

by sevaepsteyn

UniFi Network API MCP Server

seva@sevatech.com

A Model Context Protocol (MCP) server that provides access to UniFi Network Controller API functionality.

Demo

UniFi Network API MCP Demo

Available Tools

Read Operations

  • application_info() - Get application version info

  • sites() - List all sites

  • devices(site_id) - List devices in a site

  • device_details(site_id, device_id) - Get device details

  • device_statistics(site_id, device_id) - Get device statistics

  • clients(site_id) - List connected clients

  • client_details(site_id, client_id) - Get client details

  • vouchers(site_id) - List hotspot vouchers

Write Operations

Device Management
  • restart_device(site_id, device_id) - Restart a device

  • power_cycle_port(site_id, device_id, port_idx) - Power cycle a PoE port

  • search_devices(site_id, name_pattern, model, state) - Search devices with filters

Guest Management
  • authorize_guest(site_id, client_id, ...) - Authorize guest access with optional limits

  • unauthorize_guest(site_id, client_id) - Revoke guest access

Voucher Management
  • create_vouchers(site_id, name, time_limit_minutes, ...) - Create hotspot vouchers

  • delete_voucher(site_id, voucher_id) - Delete a voucher

Related MCP server: UniFi Network MCP Server

Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/unifi_network_api_mcp.git
cd unifi_network_api_mcp

# Using uv (recommended)
uv sync

Configuration

Set the following environment variables:

# Required
export UNIFI_CONTROLLER_URL="https://your-controller.unifi-hosting.ui.com"
export UNIFI_API_KEY="your-api-key-here"

# Optional
export UNIFI_API_TIMEOUT=30.0
export UNIFI_API_RETRY_ATTEMPTS=3
export UNIFI_API_RETRY_DELAY=1.0
export UNIFI_DEFAULT_PAGE_SIZE=25
export UNIFI_LOG_LEVEL="INFO"

You can also create a .env file in your project root:

UNIFI_CONTROLLER_URL=https://your-controller.unifi-hosting.ui.com
UNIFI_API_KEY=your-api-key-here

Usage

Running the Server

# Using uv (if installed from source)
uv run unifi-network-api-mcp

Using with Claude Desktop

Add MCP server to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

Using uv

{
  "mcpServers": {
    "unifi": {
      "command": "uv",
      "args": [
        "run",
        "--project",
        "/path/to/unifi_network_api_mcp",
        "unifi-network-api-mcp"
      ],
      "env": {
        "UNIFI_CONTROLLER_URL": "https://your-controller.unifi-hosting.ui.com",
        "UNIFI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Development

Setup

# Clone the repository
git clone https://github.com/sevaepsteyn/unifi_network_api_mcp.git
cd unifi_network_api_mcp

# Install dependencies with uv
uv sync

# Run in development mode
uv run unifi-network-api-mcp

# Or use uv with --project from any directory
uv run --project /path/to/unifi_network_api_mcp unifi-network-api-mcp

Testing

# Run tests
uv run pytest

# Run with coverage
uv run pytest --cov=unifi_network_api_mcp

API Reference

For detailed API documentation, see UNIFI_NETWORK_API.md.

License

MIT License - see LICENSE file for details

Available Tools

15 tools
application_infoB

Get general information about the UniFi Network application.

Inputs: no named parameters. Returns: Application information response.

authorize_guestB

Authorize guest access for a client.

This allows a client to access the network through the guest portal. You can optionally set limits on time, data usage, and bandwidth.

Inputs: site_id (required), client_id (required), time_limit_minutes, data_usage_limit_mb, +2 more. Returns: result

client_detailsA

Get detailed information about a specific client.

Inputs: site_id (required), client_id (required). Returns: Client information.

clientsB

List all connected clients on a site.

Inputs: site_id (required). Returns: Result from listing clients.

create_vouchersC

Create one or more hotspot vouchers.

Vouchers allow guests to access the network by entering a code. Each voucher can be used by multiple guests up to the authorized limit.

Inputs: name (required), site_id (required), time_limit_minutes (required), count, +4 more. Returns: Response from creating vouchers.

delete_voucherA

Delete a specific hotspot voucher.

This will invalidate the voucher code and disconnect any guests using it.

Inputs: site_id (required), voucher_id (required). Returns: result

device_detailsC

Get detailed information about a specific device.

Inputs: site_id (required), device_id (required). Returns: Detailed device information.

devicesB

List all adopted devices on a site.

Inputs: site_id (required). Returns: Result from listing devices.

device_statisticsC

Get the latest statistics for a specific device.

Inputs: site_id (required), device_id (required). Returns: Device statistics.

power_cycle_portA

Power cycle a specific port on a device.

This will temporarily disable PoE power on the port and then re-enable it. Useful for restarting PoE-powered devices like access points or cameras.

Inputs: site_id (required), port_idx (required), device_id (required). Returns: result

restart_deviceB

Restart a specific device.

This will cause the device to reboot, temporarily disconnecting any connected clients.

Inputs: site_id (required), device_id (required). Returns: result

search_devicesA

Search for devices with optional filters.

Use wildcards in name_pattern: * matches any characters, . matches single character. Example: "AP-*" matches all devices starting with "AP-"

Inputs: site_id (required), model, state, name_pattern. Returns: Result from listing devices.

sitesA

List all sites managed by this UniFi Network application.

Inputs: no named parameters. Returns: Result from listing sites.

unauthorize_guestA

Revoke guest access for a client.

This will immediately disconnect the client from the guest network.

Inputs: site_id (required), client_id (required). Returns: result

vouchersB

List all hotspot vouchers for a site.

Inputs: site_id (required). Returns: Result from listing vouchers.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools map to a distinct resource+action (device_details vs device_statistics vs restart_device vs power_cycle_port are clearly separable), and voucher and guest-authorization operations are unambiguous. The only real overlap is between `devices` (list adopted devices on a site) and `search_devices` (wildcard name search), where an agent could plausibly pick the wrong one; `sites` vs `devices` vs `clients` is otherwise clean.

    Naming Consistency3/5

    There is a readable implied convention — bare nouns for reads (`sites`, `devices`, `clients`, `vouchers`) and verb_noun for actions (`restart_device`, `authorize_guest`, `create_vouchers`) — but it is never stated and the reads are inconsistent with the noun_phrase reads (`application_info`, `device_details`, `client_details`). Plural/singular also drifts within one resource: `vouchers` / `create_vouchers` (plural) vs `delete_voucher` (singular).

    Tool Count5/5

    Fifteen tools is within a healthy range and the surface divides cleanly into three domains (devices, clients, vouchers) plus app/site context, with no filler tools. Each entry corresponds to a real UniFi operation rather than a variant of another tool.

    Completeness3/5

    The set covers device inspection/restart/PoE cycling and full voucher + guest-authorization lifecycle, but there are notable holes: no site details or site-level settings, no client block/kick (only guest auth), no WLAN/network/firewall/port-forward configuration reads, and no events/alarms/health data. An agent doing anything beyond monitoring and guest access will hit dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables managing UniFi networks through natural language, allowing users to monitor clients, check network health, and perform device actions like blocking or restarting access points. It securely connects UniFi Controllers to MCP clients with features like Google OAuth authentication.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Exposes the UniFi Network Integration API as tools for managing sites, devices, clients, networks, WiFi, firewalls, ACLs, switching, DNS policies, hotspot vouchers, VPNs, and more.
      49
      199 npm
      3
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Turns your UniFi Network Controller into programmable tools for querying and modifying network settings via MCP.
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server providing typed, safety-gated access to UniFi Network consoles via the official API, enabling management of devices, clients, networks, WiFi, firewall policies, and more.
      16
      29 npm
      2
      MIT