# UniFi Gateway

> UniFi Gateway is an MCP server for cloud and infrastructure. Safe-by-default UniFi MCP with dry runs, audit log and read-only mode. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Platforms:** Self-hosted, Linux, macOS, CLI
- **Website:** https://pete-builds.github.io/mcp-unifi/
- **Repository:** https://github.com/pete-builds/mcp-unifi
- **MCP Registry name:** io.github.pete-builds/unifi
- **Categories:** [cloud and infrastructure](https://ai-powered.com/categories/cloud-and-infrastructure)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
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.

### Claude Code: Or share it with your project (.mcp.json)

```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 Desktop (claude_desktop_config.json)

```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.

### Cursor (~/.cursor/mcp.json)

```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.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
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
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```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>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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.

### Devin Desktop (~/.config/devin/mcp_config.json)

```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.

### Cline (cline_mcp_settings.json)

```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.

### Zed (Zed settings.json)

```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.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```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>"
      }
    }
  }
}
```

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

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```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.

### Kiro (~/.kiro/settings/mcp.json)

```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.

### Other clients (your client's MCP settings (most use this shape))

```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>"
      }
    }
  }
}
```

## Tools

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

## 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.

## Alternatives

- [awslabs](https://ai-powered.com/mcp/awslabs): awslabs is an open-source MCP server for cloud and infrastructure.
- [kubeshark](https://ai-powered.com/mcp/kubeshark): kubeshark is an open-source MCP server for cloud and infrastructure.
- [Azure MCP Server](https://ai-powered.com/mcp/azure-mcp-server): Azure MCP Server is an open-source MCP server for cloud and infrastructure.
- [Pitot](https://ai-powered.com/mcp/pitot): Pitot is an open-source MCP server for cloud and infrastructure.
- [Lightweight Agentic CMS on Cloudflare](https://ai-powered.com/mcp/lightweight-agentic-cms-on-cloudflare): Lightweight Agentic CMS on Cloudflare is an open-source MCP server for cloud and infrastructure.
- [Runeward](https://ai-powered.com/mcp/runeward): Runeward is an open-source MCP server for developer tools.
- [Proxmox VE](https://ai-powered.com/mcp/proxmox-ve-2): Proxmox VE is an open-source MCP server for cloud and infrastructure.
- [KubeStellar MCP](https://ai-powered.com/mcp/kubestellar-mcp): KubeStellar MCP is an MCP server for cloud and infrastructure.

---
Source: https://ai-powered.com/mcp/unifi-gateway
