# Connect AI assistants (MCP)

> Connect Claude, ChatGPT, Cursor and other MCP clients to your Supametrics numbers, with a sign-in or an access token.

Source: https://supametrics.io/docs/mcp

Supametrics runs an MCP (Model Context Protocol) server, so AI assistants can answer questions about your
traffic, goals and revenue in plain language: "Which channel made the most money last month?" The assistant
calls Supametrics tools and reads the answers; it sees exactly the websites and permissions you allow.

Server address:

```
https://app.supametrics.io/mcp
```

Apps and tools already connected to `https://app.analyticsx.io/mcp`, our previous address, keep working with the
same sign-in or token. Change the address when convenient.

There are two ways to connect:

- **Sign in (OAuth).** Apps with a connector screen, like Claude and ChatGPT, need only the server address.
  They open Supametrics, you sign in and choose what the app may see, and it connects. No token to copy.
- **Access token.** Developer tools that let you set a request header (Claude Code, Cursor, your own agents)
  send a token you create in Supametrics.

## Connect with a sign-in

1. In the app, add a custom connector (or custom MCP server) with the address `https://app.supametrics.io/mcp`.
   Leave any client ID and secret fields empty: the app registers itself.
2. The app opens an Supametrics page. Sign in if you aren't already.
3. On the **Connect** page (titled with the app's name), check **Returns to**: it shows where the app gets its answer (for example
   `claude.ai` or `chatgpt.com`). Only allow apps you trust.
4. Pick **All websites** or specific websites you own, and the permissions: read for websites, analytics,
   goals and payments, and write for goals (creating goals). The app's request is ticked to start with.
5. Click **Allow access**. You're taken back to the app, which is now connected. **Cancel** sends it back
   without access.

Where to add the connector:

- **Claude** (claude.ai and the desktop app): **Settings › Connectors › Add custom connector**, then
  **Connect**.
- **ChatGPT**: **Settings › Apps & Connectors**, turn on developer mode under **Advanced settings** if your
  plan asks for it, then **Create** a connector with the address above and **OAuth** as the authentication.
- **Other apps** (Gemini, Perplexity, VS Code and more): any MCP client that supports the MCP authorization
  standard (OAuth 2.1) connects the same way. Look for "add MCP server" or "custom connector" and give it the
  address.

Each connected app is listed under **API & MCP › Connected apps** with its permissions, websites and when it
was last used. **Disconnect** ends its access right away. Connecting the same app again replaces its old
connection, with the choices you make that time.

The app's access lasts while you use it: it renews itself every hour, and stops if it goes unused for 90 days,
if you disconnect it, or if your account is deleted.

## Connect with an access token

Either kind of token works:

- An **account token** from **API & MCP** in the sidebar (`/account/api`): pick the websites and
  permissions the assistant should have.
- A **website key** from **Site settings › API / MCP** (`/settings/api`): one website, every permission,
  including creating goals.

How to create, roll and delete tokens: [REST API and access tokens](https://supametrics.io/docs/rest-api#access-tokens).

The server signs in with that token sent as an HTTP header:

```
Authorization: Bearer ax_YOUR_TOKEN
```

## Copy the config from the app

**API & MCP** in the sidebar has an **MCP server** section with the server URL (**Copy URL**) and a ready
client config (**Copy config**). Right after you create or roll a token, the config already contains it.

```json
{
  "mcpServers": {
    "supametrics": {
      "type": "http",
      "url": "https://app.supametrics.io/mcp",
      "headers": {
        "Authorization": "Bearer ax_YOUR_TOKEN"
      }
    }
  }
}
```

## Claude Code

Run once in your terminal:

```bash
claude mcp add --transport http supametrics https://app.supametrics.io/mcp \
  --header "Authorization: Bearer ax_YOUR_TOKEN"
```

Or paste the config above into a `.mcp.json` file in your project. Then ask Claude Code a question about
your analytics; it lists the Supametrics tools under `/mcp`.

## Cursor

Open **Cursor Settings › MCP** and add a new server, or edit `~/.cursor/mcp.json` (all projects) or
`.cursor/mcp.json` (one project):

```json
{
  "mcpServers": {
    "supametrics": {
      "url": "https://app.supametrics.io/mcp",
      "headers": {
        "Authorization": "Bearer ax_YOUR_TOKEN"
      }
    }
  }
}
```

## Claude Desktop with a token

The simplest way is **Connect with a sign-in** above. To use a token instead, connect through the open-source
`mcp-remote` bridge, which needs Node.js on your computer. In Claude Desktop open
**Settings › Developer › Edit Config** and add:

```json
{
  "mcpServers": {
    "supametrics": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://app.supametrics.io/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Bearer ax_YOUR_TOKEN"
      }
    }
  }
}
```

Restart Claude Desktop. The token goes in `env` because some systems split arguments on spaces.

## Other MCP clients

Any client that supports the **Streamable HTTP** transport and either OAuth sign-in or a request header can
connect:

- URL: `https://app.supametrics.io/mcp`
- Header: `Authorization: Bearer ax_YOUR_TOKEN`

Technical details for client authors:

- The server is stateless and answers JSON-RPC over `POST` only, with JSON responses (no event stream and
  no session ID). `GET` and `DELETE` answer `405`.
- Protocol versions `2025-11-25`, `2025-06-18`, `2025-03-26` and `2024-11-05` are supported. An unknown
  version in `initialize` is answered with the newest; an unsupported `MCP-Protocol-Version` header answers
  `400`.
- Batches of up to 20 messages are accepted.
- A missing or invalid token answers `401` with a `WWW-Authenticate: Bearer` header whose
  `resource_metadata` points to `/.well-known/oauth-protected-resource/mcp` (RFC 9728); an expired or wrong
  token adds `error="invalid_token"`.
- OAuth 2.1 follows the MCP authorization spec. Authorization server metadata (RFC 8414) is at
  `https://app.supametrics.io/.well-known/oauth-authorization-server`. Clients register with Dynamic Client
  Registration (`POST /oauth/register`, RFC 7591) or a Client ID Metadata Document (an `https` `client_id`).
  `/oauth/authorize` takes the code flow with PKCE `S256` only; `/oauth/token` takes `authorization_code` and
  `refresh_token` (refresh tokens rotate on every use); `/oauth/revoke` (RFC 7009) ends the connection.
- Scopes are the token permissions: `websites:read`, `analytics:read`, `goals:read`, `goals:write`,
  `payments:read`. No scope asks for read on everything. Access tokens last an hour.

## Tools

The server offers six tools. A tool is listed only when the token has its permission, so a read-only token
never sees `create_goal`.

| Tool | Permission | What it returns |
|---|---|---|
| `list_websites` | Websites: read | The websites the token can reach: id, name, domain, timezone, currency, first event time. |
| `get_overview` | Analytics: read | Key figures for a period and the period before (visitors, visits, pageviews, bounce rate, revenue, conversion rate, revenue per visitor), the chart series, and visitors online now. |
| `get_breakdown` | Analytics: read | Visitors and revenue split by one dimension, largest first. |
| `list_goals` | Goals: read | Goals with completions and unique visitors over the last 30 days. |
| `create_goal` | Goals: write | Adds a goal. The only tool that changes anything. |
| `get_revenue` | Payments: read | Stripe revenue over the last 30 days: total, unattributed share, connection status and the 10 latest payments. |

Each tool calls the matching [REST API](https://supametrics.io/docs/rest-api#endpoints) endpoint, so permissions, website scope,
the rate limit (300 requests per minute per token) and **Last used** work exactly as they do there.

### list_websites

No parameters. Assistants call this first to get each website's `site_id`.

### get_overview

| Parameter | Required | Values |
|---|---|---|
| `site_id` | yes | From `list_websites`. |
| `period` | no | `now`, `today`, `yesterday`, `24h`, `48h`, `7d`, `30d` (default), `90d`, `3m`, `6m`, `12m`, `wtd`, `mtd`, `ytd`, `all`, `custom`. |
| `from`, `to` | no | `YYYY-MM-DD`, with `period: "custom"`. `to` is included. |
| `filters` | no | Up to 10 filters; see below. |

### get_breakdown

The same parameters as `get_overview`, plus:

| Parameter | Required | Values |
|---|---|---|
| `dimension` | yes | `channel`, `source`, `campaign`, `keyword`, `utm_source`, `utm_medium`, `utm_content`, `ref`, `hostname`, `entry_page`, `exit_page`, `country`, `region`, `city`, `browser`, `os`, `device`, `page`, `goal`, `exit_link`. |
| `limit` | no | Rows to return, 1 to 100. Default 50. |

### Filters

Each filter is an object:

| Field | Values |
|---|---|
| `dimension` | Any breakdown dimension above, or `visits` (the visit's number for its visitor; 1 is a first visit). |
| `operator` | Text: `is` (default), `is_not`, `contains`, `not_contains`. For `visits`: `is`, `is_not`, `gte`, `lte`. |
| `value` | Up to 500 characters. For `visits`, a whole number. |

Only visits matching every filter, and their revenue, are counted. Example: channel is `Organic Search`.

### list_goals

| Parameter | Required |
|---|---|
| `site_id` | yes |

### create_goal

| Parameter | Required | Values |
|---|---|---|
| `site_id` | yes | |
| `name` | yes | 1 to 64 characters. |
| `type` | yes | `path` (completes on a pageview of a URL path) or `event` (completes on a custom event). Click goals can't be made here; use the **Goals** screen. |
| `match` | yes | For `path`, a path starting with `/`, like `/thank-you`. For `event`, the event name your code sends, up to 64 characters. |

A website can have up to 50 goals. New goals count visits from the moment they are created. See
[Goals](https://supametrics.io/docs/goals).

### get_revenue

| Parameter | Required |
|---|---|
| `site_id` | yes |

### Reading the answers

- Money amounts are whole numbers in the minor unit of the website's currency (cents for USD); `decimals`
  says how many decimal places. Assistants are told this when they connect.
- Periods and dates are in the website's timezone.
- Errors (a missing permission, an unknown website, a bad argument) come back as a tool error with a short
  message, for example `This token needs goals:write` or `site not found`.

## Discovery for agents

Agents and registries can find the server on their own: its server card is at
`https://supametrics.io/.well-known/mcp/server-card.json` (name, version, address and tools), and
`https://supametrics.io/.well-known/ai-catalog.json` lists it with the REST API and the help center.

## Example questions

- "How many visitors did example.com get this week compared with last week?"
- "Which traffic sources brought the most revenue in the last 90 days?"
- "What are my top 10 landing pages this month, and their bounce rates?"
- "How much revenue came from Organic Search visitors in October?" (a custom period with a channel filter)
- "Which countries convert best into paying customers?"
- "How are my goals doing? Which one has the most completions?"
- "Create a goal called Signup that completes on the custom event signup."
- "How much of last month's Stripe revenue couldn't be attributed, and what were the latest payments?"
- "How many people are on the site right now?"

## Common questions

**Which assistant can I use?** Claude and ChatGPT connectors, and any other MCP client that supports OAuth
sign-in, connect with just the address. Clients that send an `Authorization` header (Claude Code, Cursor,
your own agents) connect with an access token.

**Can the assistant change my data?** Only `create_goal` writes anything, and only with **Goals: write**.
For a read-only assistant, untick **Goals** write on the consent screen, or create a token without it.

**Does the assistant see websites shared with me?** No. Tokens reach only websites you own.

**How do I disconnect an assistant?** For an app you connected by signing in, click **Disconnect** under
**API & MCP › Connected apps**. For a token, delete or roll it. Either way it loses access immediately.
