Skip to content
MCP server

UniFi Gateway

Safe-by-default UniFi MCP with dry runs, audit log and read-only mode

UniFi Gateway is an MCP server for cloud and infrastructure. It runs as a hosted remote server, so there is nothing to install locally.

Platforms
Self-hosted, Linux, macOS
Runs
Remotely
Access
Needs a secret key or token
Version
0.32.0
Listing updated

Similar MCP servers

Install

Add with the CLI

Run in a terminal

claude mcp add unifi --env MCP_UNIFI_AUTH_TOKENS='<MCP_UNIFI_AUTH_TOKENS>' --env UNIFI_API_KEY='<UNIFI_API_KEY>' --env UNIFI_ACCESS_API_KEY='<UNIFI_ACCESS_API_KEY>' -- docker run -i --rm -e MCP_UNIFI_AUTH_TOKENS -e UNIFI_API_KEY -e UNIFI_ACCESS_API_KEY ghcr.io/pete-builds/mcp-unifi:0.32.0

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "unifi": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "MCP_UNIFI_AUTH_TOKENS",
        "-e",
        "UNIFI_API_KEY",
        "-e",
        "UNIFI_ACCESS_API_KEY",
        "ghcr.io/pete-builds/mcp-unifi:0.32.0"
      ],
      "env": {
        "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
        "UNIFI_API_KEY": "<UNIFI_API_KEY>",
        "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
      }
    }
  }
}

Claude Code setup guide

Add to claude_desktop_config.json

{
  "mcpServers": {
    "unifi": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "MCP_UNIFI_AUTH_TOKENS",
        "-e",
        "UNIFI_API_KEY",
        "-e",
        "UNIFI_ACCESS_API_KEY",
        "ghcr.io/pete-builds/mcp-unifi:0.32.0"
      ],
      "env": {
        "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
        "UNIFI_API_KEY": "<UNIFI_API_KEY>",
        "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
      }
    }
  }
}

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

Claude Desktop setup guide

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "unifi": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "MCP_UNIFI_AUTH_TOKENS",
        "-e",
        "UNIFI_API_KEY",
        "-e",
        "UNIFI_ACCESS_API_KEY",
        "ghcr.io/pete-builds/mcp-unifi:0.32.0"
      ],
      "env": {
        "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
        "UNIFI_API_KEY": "<UNIFI_API_KEY>",
        "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
      }
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "unifi": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "MCP_UNIFI_AUTH_TOKENS",
        "-e",
        "UNIFI_API_KEY",
        "-e",
        "UNIFI_ACCESS_API_KEY",
        "ghcr.io/pete-builds/mcp-unifi:0.32.0"
      ],
      "env": {
        "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
        "UNIFI_API_KEY": "<UNIFI_API_KEY>",
        "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
      }
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

Add with the CLI

Run in a terminal

codex mcp add unifi --env MCP_UNIFI_AUTH_TOKENS='<MCP_UNIFI_AUTH_TOKENS>' --env UNIFI_API_KEY='<UNIFI_API_KEY>' --env UNIFI_ACCESS_API_KEY='<UNIFI_ACCESS_API_KEY>' -- docker run -i --rm -e MCP_UNIFI_AUTH_TOKENS -e UNIFI_API_KEY -e UNIFI_ACCESS_API_KEY ghcr.io/pete-builds/mcp-unifi:0.32.0

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.unifi]
command = "docker"
args = ["run", "-i", "--rm", "-e", "MCP_UNIFI_AUTH_TOKENS", "-e", "UNIFI_API_KEY", "-e", "UNIFI_ACCESS_API_KEY", "ghcr.io/pete-builds/mcp-unifi:0.32.0"]
env = { MCP_UNIFI_AUTH_TOKENS = "<MCP_UNIFI_AUTH_TOKENS>", UNIFI_API_KEY = "<UNIFI_API_KEY>", UNIFI_ACCESS_API_KEY = "<UNIFI_ACCESS_API_KEY>" }

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "unifi": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "MCP_UNIFI_AUTH_TOKENS",
        "-e",
        "UNIFI_API_KEY",
        "-e",
        "UNIFI_ACCESS_API_KEY",
        "ghcr.io/pete-builds/mcp-unifi:0.32.0"
      ],
      "env": {
        "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
        "UNIFI_API_KEY": "<UNIFI_API_KEY>",
        "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
      }
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Or run: gemini mcp add -s user -e MCP_UNIFI_AUTH_TOKENS='<MCP_UNIFI_AUTH_TOKENS>' -e UNIFI_API_KEY='<UNIFI_API_KEY>' -e UNIFI_ACCESS_API_KEY='<UNIFI_ACCESS_API_KEY>' unifi docker -- run -i --rm -e MCP_UNIFI_AUTH_TOKENS -e UNIFI_API_KEY -e UNIFI_ACCESS_API_KEY ghcr.io/pete-builds/mcp-unifi:0.32.0

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "unifi": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "MCP_UNIFI_AUTH_TOKENS",
            "-e",
            "UNIFI_API_KEY",
            "-e",
            "UNIFI_ACCESS_API_KEY",
            "ghcr.io/pete-builds/mcp-unifi:0.32.0"
          ],
          "env": {
            "MCP_UNIFI_AUTH_TOKENS": "<MCP_UNIFI_AUTH_TOKENS>",
            "UNIFI_API_KEY": "<UNIFI_API_KEY>",
            "UNIFI_ACCESS_API_KEY": "<UNIFI_ACCESS_API_KEY>"
          }
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

Configuration

  • STUB_MODEWhen true, the server returns realistic mock data and requires no UniFi hardware. Defaults to true. Set to false to manage a real gateway, which then needs UNIFI_HOST plus UNIFI_API_KEY (or UNIFI_API_KEY_FILE), or MCP_UNIFI_CONTROLLERS_FILE. In either mode the HTTP transport will not start without MCP_UNIFI_AUTH_TOKENS.
  • MCP_UNIFI_AUTH_TOKENSBearer tokens that HTTP clients must present. Required: the streamable-http transport exits at startup with 'HTTP transport requires MCP_UNIFI_AUTH_TOKENS' when it is empty. Comma-separated; each entry is a bare token (named client-N automatically) or a 'name:token' pair. Generate one with `openssl rand -hex 32`.Required
  • MCP_UNIFI_READONLYWhen true, every tool that changes state is hidden from tools/list and refused on tools/call; read tools are unaffected. Defense in depth on top of a read-only UniFi API key. Defaults to false.
  • UNIFI_HOSTIP address or hostname of the UniFi OS gateway (UCG-Fiber, UDM Pro, etc). Required when STUB_MODE=false and MCP_UNIFI_CONTROLLERS_FILE is unset.
  • UNIFI_API_KEYLocal API key generated under Settings -> Control Plane -> Integrations on the gateway. Required when STUB_MODE=false and MCP_UNIFI_CONTROLLERS_FILE is unset, unless UNIFI_API_KEY_FILE is used instead.
  • UNIFI_API_KEY_FILEPath to a file inside the container that holds the local API key, for a Docker or Kubernetes secret mount. Wins over UNIFI_API_KEY when both are set. A controller configured this way verifies the gateway's TLS certificate unless UNIFI_VERIFY_SSL is set to false.
  • UNIFI_PINNED_CERTPath to a file inside the container that holds the gateway's own certificate in PEM, recorded with mcp-unifi-pin-cert. When set, that certificate is the only one the server accepts from the gateway, and a mismatch fails every request. Do not set UNIFI_VERIFY_SSL to false alongside it: the server refuses to start.
  • UNIFI_SITEUniFi controller site name. Defaults to 'default'.
  • UNIFI_VERIFY_SSLWhether to verify the gateway's TLS certificate. Defaults to false because most home gateways use a self-signed cert.
  • MCP_UNIFI_CONTROLLERS_FILEPath to a YAML file describing multiple named controllers for multi-site management. When set, the legacy UNIFI_HOST / UNIFI_API_KEY env vars are ignored. Each entry needs name, host, api_key, and optionally port, site, verify_ssl.
  • MCP_UNIFI_MODULES_ENABLEDComma-separated list of modules to load. Known values: 'network', 'protect', 'access'. Defaults to 'network'. Set to 'network,protect,access' to enable Protect and Access tools alongside Network. Access currently ships read-only; door unlocks and credential issuance require session-token auth and are deferred.
  • UNIFI_ACCESS_HOSTUniFi Access hub IP or hostname. Required when the access module is enabled and STUB_MODE=false. Often the same host as UNIFI_HOST.
  • UNIFI_ACCESS_API_KEYUniFi Access API key. Separate from the Network API key; generated on the Access controller's developer settings. Required when the access module is enabled and STUB_MODE=false.
  • UNIFI_ACCESS_PORTHTTPS port for the Access hub. Defaults to 12445 (the direct Access app port).
  • MCP_UNIFI_AUDIT_SINKAudit log sink. One of 'file' (default), 'stdout', or 'syslog'. Every tool call is recorded to a JSONL stream with secrets scrubbed.
  • MCP_UNIFI_AUDIT_PATHPath for the audit log file when MCP_UNIFI_AUDIT_SINK=file. Defaults to audit.jsonl in the process CWD.

About UniFi Gateway

Aimed at homelabs and small networks, this container manages a UniFi gateway across Network, Protect and Access, with multiple sites. Changes are previewed with dry runs, every action goes to a JSONL audit log, and composite changes can be rolled back.

It starts in stub mode with realistic mock data, so you can try it without UniFi hardware. For a real gateway set STUB_MODE=false with UNIFI_HOST and a local API key. The HTTP transport refuses to start without MCP_UNIFI_AUTH_TOKENS, MCP_UNIFI_READONLY=true hides all state-changing tools, and a pinned certificate can restrict TLS. The image is ghcr.io/pete-builds/mcp-unifi.

Tools this server provides (1)

Taken from the project documentation; the running server may differ.

From the tool list in its README, going by the names, 1 name doesn't say.

From the server's own tool labels and tool names; not verified by us.

name
description

What it does

Dry-run previews
See a change before it applies.
Audit log
Every action is written to a JSONL log.
Read-only switch
Hide state-changing tools entirely.
Stub mode
Try with mock data and no hardware.
Multi-site
Manage several controllers.
Network, Protect, Access
Covers three UniFi products.

Good for

  • Audit open ports on a gateway
  • Create a guest or IoT network
  • Review firewall policies
  • Provision a camera

UniFi Gateway FAQ

Can I test without hardware?

Yes, stub mode is the default.

Are auth tokens required?

Yes for HTTP transport.

How do I stop writes?

Set MCP_UNIFI_READONLY=true.

How do I add UniFi Gateway to Claude Code?

Run this command in your terminal: claude mcp add unifi --env MCP_UNIFI_AUTH_TOKENS='<MCP_UNIFI_AUTH_TOKENS>' --env UNIFI_API_KEY='<UNIFI_API_KEY>' --env UNIFI_ACCESS_API_KEY='<UNIFI_ACCESS_API_KEY>' -- docker run -i --rm -e MCP_UNIFI_AUTH_TOKENS -e UNIFI_API_KEY -e UNIFI_ACCESS_API_KEY ghcr.io/pete-builds/mcp-unifi:0.32.0

What are the best alternatives to UniFi Gateway?

The closest alternatives to UniFi Gateway are awslabs, kubeshark, Azure MCP Server, Pitot and Lightweight Agentic CMS on Cloudflare.

Where this comes from

  • Description: written from the project's README and the project's website.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers