# Connect Claude or ChatGPT to X-Hub (MCP)

> For AI tools: this is the Markdown copy of https://xproxy.io/document/xproxy-hub-ai-assistants. Every XProxy guide has one at its URL + `.md`; the index of all guides is https://xproxy.io/llms.txt.

Let an AI assistant read your fleet and act on it. Sign in from Claude or ChatGPT, or use an API key. Roles, safety checks and how to disconnect.

Connect Claude, ChatGPT or another AI assistant to your X-Hub. It can then answer questions about your boxes and, with your approval, do what the box panel can do.

**You need:** an [X-Hub](https://xproxy.io/document/xproxy-hub-setup) with boxes, and an account in the AI app. X-Hub is an MCP server (Model Context Protocol), the standard way AI apps talk to tools.

## How do I connect an app?

**Step 1: Copy your X-Hub address ending in /mcp**

In X-Hub, open **AI Assistants** under **Integrations**. The **MCP endpoint** box shows your address, for example `https://hub.example.com/mcp`. Click **Copy**.

> Claude on the web, Claude Desktop, Claude on mobile and ChatGPT connect from their own servers. They need X-Hub on a public **https** address, which means [X-Hub on a VPS](https://xproxy.io/document/xproxy-hub-setup). X-Hub on your box only answers your own network.

**Step 2: Add the connector in Claude (Claude)**

1. Open **Settings → Connectors → Add custom connector**.
2. Paste the address.
3. Click **Connect**. Your browser opens X-Hub.

**Step 3: Add the server in Claude Code (Claude Code)**

Run this once in a terminal on your computer (use your own address):

Terminal

```
claude mcp add --transport http xproxy-hub https://hub.example.com/mcp
```

Then in Claude Code run `/mcp`, pick **xproxy-hub** and choose **Authenticate**.

> Claude Code runs on your computer, so it also works with X-Hub on your box when your computer is on the same network.

**Step 4: Add the connector in ChatGPT (ChatGPT)**

1. Open **Settings → Apps &amp; Connectors → Advanced** and turn on **Developer mode**.
2. Click **Create**, paste the address and choose **OAuth**.

**Step 5: Sign in to X-Hub and click Allow**

X-Hub shows **Connect... to XProxy Hub**. Check the name of the app and where you return to. Choose what it may do, then click **Allow**.

- **Read only (viewer):** read the fleet, proxies, incidents and settings. Cannot change anything.
- **Read and act (operator):** also rotate IPs, reboot and reset modems, run diagnostics, acknowledge incidents.
- **Owner:** also risky changes (settings, software updates, rebooting a box). They still follow your [passkey](https://xproxy.io/document/xproxy-hub-passkeys) rules.

![The X-Hub page asking to connect an app, with the app name, the return address, the role choice and the Allow button marked (demo)](https://media1.xproxy.io/docs/hub/ai-3-consent.webp)

> The app can never do more than your own role allows. Pick the lowest role that does the job.

**Step 6: Ask it something**

In the app, ask in plain words: *"Which modems are offline?"*, *"Show me the open incidents."*, *"Rotate the IP of modem 3 on Office box."*

For anything that changes something, the assistant first shows you a **preview** (which modem, which IP). It must ask you before it goes on. A rotation needs two calls: the preview returns a one-time confirmation that works once, only for that modem, for 2 minutes.

## How do I disconnect an app?

Open **AI Assistants**. **Connected apps** lists each app with its role, when it connected and when it was last used. Click **Disconnect**: the app loses access at once. Owners see everyone's apps. Disabling a user in X-Hub also ends their apps.

## Can I use an API key instead?

Yes, for Cursor, VS Code, Codex, n8n, scripts and apps that cannot sign in. An owner opens **AI Assistants** (or **Users &amp; Access → API keys**), gives the key a name, picks a role, and clicks **Create key**. The key starts with `xph_` and is shown **only once**. The app sends it as `Authorization: Bearer YOUR_KEY`.

The page **Set up your app** fills in ready-made settings for Claude Code, Claude Desktop (JSON), Cursor, VS Code, Codex and a bridge for apps that only run local servers. Use one key per app or computer, so you can revoke one without touching the others.

## What can the assistant use?

| Tool | What it does | Needs |
| --- | --- | --- |
| `fleet_summary`, `list_servers`, `list_proxies`, `list_incidents`, `recent_events` | Read the state of your boxes, modems, problems and events. | viewer |
| `server_operations`, `server_read` | List what a server can do through its panel, and read settings, DNS, rotation, VPS forwarding and logs. Passwords come back hidden. | viewer |
| `acknowledge_incident` | Mark a problem as handled. | operator |
| `rotate_ip`, `reboot_modem` | Rotate or reboot after a preview and your OK. | operator |
| `server_call`, `approval_status` | Act on one server. Everyday actions run after a preview. Risky changes (settings, updates, rebooting a box) need your passkey approval. | operator (owner for risky changes) |

## Is it safe?

- **You approve changes.** Previews first, one-time confirmations, and passkey approval for risky changes.
- **Read only by default.** A viewer connection cannot change anything.
- **Every action is recorded** in the audit log with the app or key name and the word "MCP".
- **It cannot reach your secrets.** Passwords, tokens and keys are hidden before they leave the box.
- **It cannot change your license** or your X-Hub users, keys and Telegram settings. Those need you in the browser.

## FAQ

### Claude says it cannot connect

Claude and ChatGPT reach your X-Hub from the internet. X-Hub needs a public **https** address. X-Hub on your box is not reachable, so use Claude Code on your network, or move to a VPS. If you firewall X-Hub, allow Anthropic's addresses `160.79.104.0/21` and `153.61.208.0/20`.

### Do I have to sign in again?

Sign-in tokens last 1 hour and refresh by themselves for up to 30 days. After that, connect again.

### Can the assistant change my box settings?

Yes, as an owner connection, through `server_call`, exactly what the box panel allows and refusing what your license does not include. Risky changes wait for your passkey. See [Passkeys](https://xproxy.io/document/xproxy-hub-passkeys).

## What next?

Lock down risky changes, and review who has access.

[Passkeys →](https://xproxy.io/document/xproxy-hub-passkeys) [Users and API keys →](https://xproxy.io/document/xproxy-hub-users)

---

Source: https://xproxy.io/document/xproxy-hub-ai-assistants
