Skip to main content
Glama
UniFi Internal API MCP Server

UniFi Internal API MCP Server

by sevaepsteyn

UniFi Internal API MCP Server

An MCP (Model Context Protocol) server that exposes the internal UniFi Controller API — the same API the web UI uses — as tools for AI assistants.

This wraps the cookie-authenticated controller endpoints documented in the Art-of-WiFi/UniFi-API-client PHP library, providing ~170 tools for managing UniFi networks.

Features

  • Full controller access: Clients, devices, WLANs, networks, firewall, statistics, events, admins, firmware, backups, DNS, RADIUS, DPI, hotspot/vouchers, and more

  • Cookie-based authentication: Uses the same session auth as the UniFi web UI

  • UniFi OS support: Works with UDM, UDR, UCG, and legacy standalone controllers

  • Readonly safety mode: Write operations blocked by default — enable explicitly

  • 170+ tools across 19 categories

Related MCP server: UniFi MCP Server

Quick Start

  1. Clone this repository

  2. Copy .env.example to .env and fill in your controller details

  3. Run: uv run unifi-internal-api-mcp

Configuration

Variable

Description

Default

UNIFI_HOST

Controller URL (e.g. https://192.168.1.1)

required

UNIFI_USERNAME

Controller username

UNIFI_PASSWORD

Controller password

UNIFI_TOKEN

Pre-authenticated TOKEN cookie (alternative to username/password)

UNIFI_SITE

Site name

default

UNIFI_IS_UNIFI_OS

UniFi OS controller (UDM/UDR/UCG)

true

UNIFI_READONLY

Block all write operations

true

UNIFI_SSL_VERIFY

Verify SSL certificates

false

Authentication

Option 1: Username/password — for self-hosted controllers without 2FA:

UNIFI_USERNAME=admin
UNIFI_PASSWORD=your-password

Option 2: Browser token — for cloud-hosted (ui.com) or 2FA-enabled controllers:

  1. Log into your controller in a browser

  2. Open DevTools (Cmd+Option+I) > Application > Cookies

  3. Copy the TOKEN cookie value

UNIFI_TOKEN=eyJhbGciOiJIUzI1NiIs...

The token expires after ~30 days. When using a token, the server won't log out (so your browser session stays valid).

Tool Categories

Module

Tools

Description

system

15

Sysinfo, health, dashboard, settings, device states

sites

13

Site management, settings (country, SNMP, NTP, etc.)

clients

20

Client management, guest auth, block/unblock

devices

23

Device adoption, restart, locate, radio settings

hotspot

9

Vouchers, hotspot operators, guest login

wlans

8

WLAN configuration, MAC filters

networks

4

Network CRUD

firewall

5

Firewall groups and rules

statistics

22

5min/hourly/daily/monthly stats, speedtest, IPS

events

4

Events and alarms

admins

8

Admin management and permissions

firmware

10

Firmware updates, rolling upgrades

backups

3

Backup generation and export

dns

3

DNS records (v2 API)

radius

5

RADIUS profiles and accounts

tags

5

Device tags

dpi

5

DPI stats, port forwarding, system log

user_groups

4

User groups (bandwidth profiles)

ap_groups

4

AP groups (v2 API)

MCP Client Configuration

Add to your MCP client config (e.g. Claude Desktop):

{
  "mcpServers": {
    "unifi-internal": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/unifi_internal_api_mcp", "unifi-internal-api-mcp"],
      "env": {
        "UNIFI_HOST": "https://your-controller-url",
        "UNIFI_TOKEN": "eyJhbGciOiJIUzI1NiIs...",
        "UNIFI_SITE": "default",
        "UNIFI_READONLY": "true"
      }
    }
  }
}

Available Tools

64 tools
check_controller_updateB

Check for controller firmware updates. Returns latest known version info.

Inputs: no named parameters. Returns: result

count_alarmsA

Count alarms. Optionally count only non-archived (active) alarms.

Inputs: archived. Returns: result

custom_api_requestC

Make a custom API request to the controller. Use with care.

Inputs: path (required), method, payload. Returns: result

get_system_logB

Fetch system log entries (v2 API). Defaults to past 7 days.

Inputs: end, start, log_class, page_size, +1 more. Returns: object

get_tagA

Get a specific device tag by ID.

Inputs: tag_id (required). Returns: result

list_active_clientsA

List active clients using the v2 API with optional traffic and device filters.

Inputs: include_traffic_usage, include_unifi_devices. Returns: result

list_adminsA

List admins for the current site.

Inputs: no named parameters. Returns: result

list_alarmsB

Fetch alarms, optionally filtered.

Inputs: payload. Returns: result

list_all_adminsA

List all admins across all sites.

Inputs: no named parameters. Returns: result

list_ap_groupsA

List all AP groups.

Inputs: no named parameters. Returns: result

list_backupsA

List available auto-backups.

Inputs: no named parameters. Returns: result

list_clientsA

List currently online (connected) clients, or fetch a single client by MAC address.

Inputs: mac. Returns: result

list_clients_historyB

List offline client history using the v2 API.

Inputs: within_hours, only_non_blocked, include_unifi_devices. Returns: result

list_country_codesA

Fetch available country codes (ISO 3166-1 numeric).

Inputs: no named parameters. Returns: result

list_current_channelsA

Fetch currently allowed wireless channels.

Inputs: no named parameters. Returns: result

list_dashboardA

Fetch dashboard metrics for the current site.

Inputs: five_minutes. Returns: result

list_device_name_mappingsA

Fetch device name mappings (firmware bundles). Does not require site context.

Inputs: no named parameters. Returns: object

list_devicesA

List devices with full detail, optionally filtered by MAC address(es).

Returns comprehensive device information including model, firmware, uptime, configuration, port tables, radio tables, and statistics.

Inputs: macs. Returns: result

list_devices_basicA

List all devices with basic properties only.

Returns a lightweight device list with minimal attributes such as MAC address, model, type, and name. Faster than list_devices().

Inputs: no named parameters. Returns: result

list_device_statesA

Return a mapping of device state codes to human-readable names.

Inputs: no named parameters. Returns: object

list_dns_recordsA

List all static DNS records.

Inputs: no named parameters. Returns: result

list_dpi_statsB

Fetch Deep Packet Inspection (DPI) statistics.

Inputs: no named parameters. Returns: result

list_dpi_stats_filteredB

Fetch filtered DPI statistics by category or application.

Inputs: dpi_type, cat_filter. Returns: result

list_eventsB

Fetch site events, sorted by most recent first.

Inputs: limit, start, historyhours. Returns: result

list_extensionsB

Fetch VoIP extensions.

Inputs: no named parameters. Returns: result

list_fingerprint_devicesC

Fetch client device fingerprint information.

Inputs: fingerprint_source. Returns: result

list_firewall_groupsA

List firewall groups, or get a specific group by ID.

Inputs: group_id. Returns: result

list_firewall_rulesB

List all firewall rules.

Inputs: no named parameters. Returns: result

list_firmwareB

List firmware versions available or cached on the controller.

Inputs: firmware_type. Returns: result

list_guestsA

List guest devices seen within the specified time window.

Inputs: within. Returns: result

list_healthA

Fetch health metrics for the current site.

Inputs: no named parameters. Returns: result

list_hotspot_operatorsA

List all hotspot operators.

Inputs: no named parameters. Returns: result

list_known_rogue_apsA

List known rogue access points.

Returns rogue APs that have been previously identified and marked as known in the controller.

Inputs: no named parameters. Returns: result

list_networksA

List network configurations, or get a specific network by ID.

Inputs: network_id. Returns: result

list_port_configsB

Fetch switch port configurations.

Inputs: no named parameters. Returns: result

list_port_forwardingB

List port forwarding rules/settings.

Inputs: no named parameters. Returns: result

list_port_forward_statsB

Fetch port forwarding statistics.

Inputs: no named parameters. Returns: result

list_radius_accountsA

List all RADIUS user accounts for the current site.

Inputs: no named parameters. Returns: result

list_radius_profilesA

List all RADIUS profiles for the current site.

Inputs: no named parameters. Returns: result

list_rogue_apsA

List rogue (neighboring) access points detected by managed APs.

Returns APs seen by your network that are not part of your UniFi deployment, within the specified time window.

Inputs: within. Returns: result

list_routingB

Fetch static routing settings, optionally filtered by route ID.

Inputs: route_id. Returns: result

list_selfA

Fetch information about the currently logged-in user.

Inputs: no named parameters. Returns: result

list_settingsB

Fetch all site configuration settings.

Inputs: no named parameters. Returns: result

list_sitesA

List all sites managed by this UniFi controller.

Returns basic attributes for each site including _id, desc (description), and name (short name).

Inputs: no named parameters. Returns: result

list_tagsA

List all device tags.

Inputs: no named parameters. Returns: result

list_user_groupsB

List all user groups (bandwidth profiles).

Inputs: no named parameters. Returns: result

list_usersA

List all known client devices, including those currently offline.

Inputs: no named parameters. Returns: result

list_wlan_confA

List WLAN configurations (wireless networks), or get a specific WLAN by ID.

Inputs: wlan_id. Returns: result

list_wlan_groupsB

List WLAN groups.

Inputs: no named parameters. Returns: result

set_auth_tokenA

Set or update the browser TOKEN cookie for authentication.

Use this when authentication fails or no token is configured. To get the token: log into the UniFi controller in a browser, open DevTools (Cmd+Option+I) > Application > Cookies, and copy the TOKEN value.

Inputs: token (required). Returns: object

spectrum_scan_stateA

Check the state of an RF spectrum scan for an access point.

Returns the current scan progress and results if the scan has completed.

Inputs: mac (required). Returns: result

stat_allusersA

Fetch all users (wired and wireless) seen within the specified time window.

Inputs: historyhours. Returns: result

stat_authorizationsB

Fetch authorization records. Defaults to past 7 days.

Inputs: end, start. Returns: result

stat_clientA

Fetch detailed statistics for a single client by MAC address.

Inputs: mac (required). Returns: result

stat_full_statusA

Fetch full controller status (system information).

Inputs: no named parameters. Returns: result

stat_ips_eventsB

Fetch IPS/IDS events. Defaults to past 24 hours.

Inputs: end, limit, start. Returns: result

stat_paymentB

Fetch hotspot payment records.

Inputs: within. Returns: result

stat_reportA

Fetch periodic statistics for site, AP, user, or gateway.

Combines all stat report endpoints into one tool. Default time ranges: 5minutes=12h, hourly=7d, daily=52w, monthly=52w.

Inputs: entity (required), period (required), end, mac, +2 more. Returns: result

stat_sessionsB

Fetch login sessions. Defaults to past 7 days.

Inputs: end, mac, start, session_type. Returns: result

stat_sitesA

Fetch statistics for all sites on this controller.

Returns detailed statistics including number of devices, clients, guests, and health information for each site.

Inputs: no named parameters. Returns: result

stat_speedtest_resultsA

Fetch speed test results. Defaults to past 24 hours.

Inputs: end, start. Returns: result

stat_sta_sessions_latestB

Fetch latest login sessions for a single client.

Inputs: mac (required), limit. Returns: result

stat_sysinfoB

Fetch system information from the UniFi controller.

Inputs: no named parameters. Returns: result

stat_voucherA

List hotspot vouchers, optionally filtered by creation time.

Inputs: create_time. Returns: result

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 64 tools

    Disambiguation4/5

    Most tools target distinct resources (devices, clients, WLAN, firewall, etc.), but several client-related tools (list_users, list_clients, list_active_clients, list_clients_history, stat_allusers) have overlapping purposes. The descriptions help differentiate them by online/offline/v2/API filters, but there is still some potential for misselection.

    Naming Consistency4/5

    The naming pattern is predominantly verb_noun with underscores (list_*, stat_*, get_*, set_*), which is consistent. However, there is a mix of 'list' and 'stat' for similar operations (e.g., list_clients vs stat_client), and some names like stat_full_status and custom_api_request deviate slightly from the convention.

    Tool Count2/5

    With 64 tools, the server presents an overwhelming surface area. Even though the UniFi controller API is large, this many tools makes it difficult for an agent to select the right one quickly, and many tools are highly specific (e.g., list_device_name_mappings, list_country_codes). A more focused set of 20-30 tools would be more appropriate.

    Completeness3/5

    The tool set is extensive in read-only coverage across many domains (health, devices, clients, WLAN, firewall, stats, events). However, it lacks create/update/delete operations for most resources, which are only possible via the generic custom_api_request. This leaves a significant gap for management workflows, but the read surface is fairly complete for monitoring purposes.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to interact with Ubiquiti UniFi network infrastructure for monitoring devices, managing clients, and performing configuration tasks like blocking/unblocking devices and viewing network health.
      10
      1
      GPL 3.0
    • A
      license
      D
      quality
      D
      maintenance
      Enables comprehensive management of UniFi network infrastructure through the UniFi Cloud API, including device control, client management, camera settings, and access door control through natural language.
      39
      50 npm
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to manage and monitor UniFi Network Controllers through natural language. Provides 25 read-only tools for discovering devices and clients, viewing security configurations, analyzing network statistics, and exporting configuration data.
      41
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      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.
      52
      29 npm
      5
      MIT