# Connect Gemini CLI to xSpeed Hub MCP

> Add xSpeed Hub to Gemini CLI with gemini mcp add, authenticate with /mcp auth, and manage every WordPress site from your terminal.

- Category: AI & MCP
- Updated: 2026-10-06
- Canonical: https://xspeedcache.com/docs/hub-mcp-gemini-cli/

---

You add one remote MCP server, `xspeedhub`, to Gemini CLI and authenticate it once in a browser.

## Steps

### 1. Add xSpeed Hub to Gemini CLI

Run this once. --scope user writes the server to ~/.gemini/settings.json so it works in every project; without it Gemini CLI saves to the project's .gemini/settings.json, which is the default.

```bash
gemini mcp add --scope user --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp
```

### 2. Authenticate with /mcp auth

Start gemini and run /mcp auth xspeedhub. A browser page opens where you sign in to xSpeed Hub and approve access, and Gemini CLI receives the redirect on a local port. There is no token to paste, and the client keeps the credentials it receives. Run /mcp afterwards to check that xspeedhub shows as connected and lists its tools.

```
/mcp auth xspeedhub
```

### 3. Or use a connection token (optional)

If you cannot open a browser, for example over SSH, edit the settings file and send the connection token as a header. Copy it from Connect AI in the Hub; only the workspace owner sees it. The httpUrl field is the one Gemini CLI documents for streamable HTTP servers, and the same entry can be created with the --header flag on gemini mcp add.

File: `~/.gemini/settings.json`

```json
{
  "mcpServers": {
    "xspeedhub": {
      "httpUrl": "https://app.xspeedcache.com/xspeed/mcp",
      "headers": {
        "Authorization": "Bearer <your connection token>"
      }
    }
  }
}
```

## Sign-in

**OAuth sign-in or connection token.** Run /mcp auth xspeedhub and approve access in the browser; Gemini CLI registers itself, stores the tokens and refreshes them. If you prefer a header, pass the connection token from the Hub's Connect AI page with --header when you add the server.

## Check it worked

```
Use xSpeed Hub to list my sites and tell me which of them have the preloader stopped.
```

## A first prompt

```
With xSpeed Hub, show the page cache hit ratio for every site and flag any below 70%.
```

## If something does not work

- OAuth needs a browser on the same machine and a localhost redirect. In a headless shell, an SSH session or a container without a browser, use the connection token header instead.
- The default scope of gemini mcp add is project. Add --scope user, or the server will look missing when you start Gemini CLI in another folder.
- Keep underscores out of the server name. Gemini CLI documents that its policy parser splits tool names at the first underscore, so a name like xspeed_hub could make allow and deny rules fail silently. The name xspeedhub is safe.
- Do not add --trust to this server, and do not start Gemini CLI with --approval-mode=yolo (or --yolo) while the Hub is connected. Each bypasses tool confirmations, including the ones for purges and settings changes.

More about Gemini CLI with xSpeed, including approvals and example sessions: https://xspeedcache.com/agent/gemini-cli/

Sources checked: [Gemini CLI: MCP servers](https://geminicli.com/docs/tools/mcp-server/), [Gemini CLI: Policy engine](https://geminicli.com/docs/reference/policy-engine/), [Gemini CLI: Configuration reference](https://geminicli.com/docs/reference/configuration/)
