# Connect Claude Code to xSpeed Hub MCP

> Add xSpeed Hub to Claude Code with one command, sign in with /mcp, and manage every WordPress site you connected to the Hub from the terminal.

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

---

You add one remote MCP server, `xspeedhub`, to Claude Code. It points at xSpeed Hub, so Claude Code reaches every site in your Hub workspace through it.

## Steps

### 1. Add xSpeed Hub to Claude Code

Run this once. --scope user makes the server available in every project; leave it off and it applies to the current project only, which is Claude Code's default.

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

### 2. Sign in with /mcp

Start Claude Code, run /mcp, pick xspeedhub and finish the sign-in in your browser. You approve access on an xSpeed Hub page; there is no token to paste, and Claude Code keeps the credentials it receives and refreshes them.

```
/mcp
```

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

If you prefer a header to a browser sign-in, copy the connection token from Connect AI in the Hub (only the workspace owner sees it) and pass it with --header. A rejected header shows as a failed connection rather than falling back to sign-in.

```bash
claude mcp add --transport http --scope user xspeedhub https://app.xspeedcache.com/xspeed/mcp \
  --header "Authorization: Bearer <your connection token>"
```

## Sign-in

**OAuth sign-in or connection token.** Run /mcp and approve access in the browser; Claude Code stores the tokens and refreshes them. If you would rather not use a browser, add the connection token from the Hub's Connect AI page with --header instead.

## Check it worked

```
Use xSpeed Hub to list my sites and tell me which ones have page caching turned off.
```

## A first prompt

```
Use xSpeed Hub to show the cache hit ratio for every site and flag anything under 70%.
```

## If something does not work

- Without --scope user the server is added to the current project only, so it will look missing when you start Claude Code in another folder.
- If you add the same server name in two scopes with different URLs, Claude Code warns about the conflict and stores a separate sign-in per URL. Keep one entry.
- In claude -p and other non-interactive runs there is no /mcp panel, so sign in first with /mcp in an interactive session or with claude mcp login xspeedhub.

More about Claude Code with xSpeed, including approvals and example sessions: https://xspeedcache.com/agent/claude-code/

Sources checked: [Claude Code: Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp), [Claude Code: Configure permissions](https://code.claude.com/docs/en/permissions)
