Skip to main content
Cursor is an AI-powered code editor that supports MCP servers through a dedicated settings file. Adding the UniFi MCP Server to Cursor lets you manage your network infrastructure directly from the Chat sidebar—useful when you are building automation scripts, writing infrastructure-as-code, or just need quick network context while coding.

Prerequisites

  • Cursor installed and up to date
  • A UniFi API key (from Settings → Control Plane → Integrations in the UniFi Site Manager)
  • One of the following: the unifi-mcp-server PyPI package installed, uv installed, or Docker

Setup

1

Open Cursor MCP settings

In Cursor, open the command palette with Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux) and run View: Open MCP Settings. Cursor opens mcp.json in the editor.If the file does not exist yet, Cursor creates it for you.
2

Add the server configuration

Add the mcpServers block to mcp.json. Choose the tab that matches your installation method.
Install the package first, then add this config:
Replace your-api-key-here with your actual UniFi API key and 192.168.2.1 with your gateway’s IP address. The "disabled": false field tells Cursor the server is active.
3

Save and restart Cursor

Save mcp.json. Then fully quit and reopen Cursor so it picks up the new configuration.
Cursor reads MCP settings at startup. Changes to mcp.json require a full restart to take effect.
4

Test in the Chat sidebar

Open the Chat sidebar (Cmd+L on macOS, Ctrl+L on Windows/Linux) and try one of these prompts:
  • “List my UniFi devices”
  • “Show connected clients on site default”
  • “What firewall rules are active on my network?”
  • “Show me the current bandwidth usage by application”
Cursor routes the request to the UniFi MCP Server and displays the response inline in Chat.
MCP tools are only available in the Chat sidebar (Agent mode), not in inline code completions or the Composer panel. Make sure you are in Chat when invoking UniFi tools.

Environment variables reference

The local gateway API (UNIFI_API_TYPE=local) unlocks full network management capabilities including device control, network configuration, and firewall rules. Cloud API modes (cloud-v1, cloud-ea) are limited to read-only site statistics.