# MCP server for Claude and ChatGPT

> Connect Claude, ChatGPT or another AI assistant to Sporetag with a read key, then ask how your site did last week in plain words.

Source: https://sporetag.com/docs/mcp
Section: Developers

Sporetag has a remote MCP server. MCP (Model Context Protocol) is the open standard AI assistants use to read other tools. Once it is connected, ask your assistant things like:

- "How did shop.example.com do last week compared with the week before?"
- "Which campaigns brought sales this month?"
- "What is my ROAS on Meta for the last 30 days?"
- "Which short link got the most clicks this week?"

The assistant reads the numbers through Sporetag and answers from them. It can only read. It cannot change a site, a goal, a link or a setting.

The MCP server is on paid plans: Solo, Studio, Agency and Custom. [Sporetag for AI assistants](https://sporetag.com/ai) has the short version, more questions to ask, and where AI tools find Sporetag's docs as Markdown.

## 1. Make a read key

Open **Settings**, then **API**, and make a key. Pick **All sites**, or one site if the assistant should only see that one. Copy the key. It is shown once. See [Read API](https://sporetag.com/docs/api) for more on keys.

## 2. Connect your assistant

The server lives at:

```text
https://sporetag.com/mcp
```

It takes the key as `Authorization: Bearer st_rk_...`. Apps that only take an address can use the key in the address instead:

```text
https://sporetag.com/mcp/st_rk_...
```

Treat that address like a password. Anyone who has it can read what the key reads.

### Claude (claude.ai and the desktop app)

1. Open **Settings**, then **Connectors**.
2. Choose **Add custom connector**.
3. Name it **Sporetag**. For the URL, paste the address with your key: `https://sporetag.com/mcp/st_rk_...`
4. Leave the OAuth fields empty and press **Add**.
5. In a chat, turn on Sporetag from the tools menu, then ask a question.

On Team and Enterprise plans, an owner may need to add the connector for the organization first.

### Claude Code

```bash
claude mcp add --transport http sporetag https://sporetag.com/mcp \
  --header "Authorization: Bearer st_rk_..."
```

### ChatGPT

Custom MCP servers in ChatGPT need developer mode, which OpenAI offers on some plans. Turn it on under **Settings**, **Apps and Connectors**, **Advanced**. Then create a connector with the address that has your key in it, and choose no authentication. OpenAI may name these menus differently on your plan.

### Cursor, VS Code and other MCP clients

Most clients take a JSON entry like this:

```json
{
  "mcpServers": {
    "sporetag": {
      "url": "https://sporetag.com/mcp",
      "headers": { "Authorization": "Bearer st_rk_..." }
    }
  }
}
```

A client that only runs local servers can reach it through `mcp-remote`:

```json
{
  "mcpServers": {
    "sporetag": {
      "command": "npx",
      "args": ["mcp-remote", "https://sporetag.com/mcp", "--header", "Authorization: Bearer st_rk_..."]
    }
  }
}
```

## Tools

| Tool | What it reads |
|---|---|
| `list_sites` | Your sites: id, name, address and time zone |
| `get_stats` | Visitors, visits, pageviews, bounce rate, visit duration, conversions and conversion rate, with the span before; optionally per hour, day or month |
| `get_breakdown` | Top sources, referrers, UTM values, pages, countries, devices, browsers or goals |
| `get_goals` | Goals with conversions and conversion rate |
| `get_attribution` | Conversions and revenue credited by source, campaign, ad, ad set, platform or short link, first or last touch |
| `get_ad_spend` | Ad spend, credited revenue and ROAS by platform, campaign, ad set or ad |
| `get_links` | Short links with clicks |

Every tool is marked read-only. Dates work as in the [read API](https://sporetag.com/docs/api#dates-and-time-zones): whole local days in the site's time zone, unless the assistant passes another.

## Good to know

- Each request counts toward the key's 120 requests a minute, shared with the read API.
- Source names, page paths and campaign names come from visitors and ad platforms. The server tells the assistant to treat them as data, never as instructions.
- No visitor emails, names or phone numbers are ever sent to the assistant.
- To disconnect, remove the connector in your assistant and revoke the key in **Settings**, **API**.

## Docs your assistant can read

Sporetag's docs come as plain Markdown too, so an assistant can read them without a browser:

- [/llms.txt](https://sporetag.com/llms.txt): a short map of the site, linking to the Markdown copies.
- [/llms-full.txt](https://sporetag.com/llms-full.txt): every docs article, guide, platform page and glossary term in one file.
- Any docs, guide or glossary page with `.md` on the end, such as [/docs/mcp.md](https://sporetag.com/docs/mcp.md). A request that asks for `text/markdown` in its `Accept` header gets the same.

## For developers

The server speaks MCP over Streamable HTTP: JSON-RPC 2.0 in a `POST`, one JSON answer back, no server-sent events and no session. It supports protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05, and the methods `initialize`, `ping`, `tools/list` and `tools/call`. `GET` answers 405.

```bash
curl https://sporetag.com/mcp \
  -H "Authorization: Bearer $SPORETAG_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_stats","arguments":{"site_id":"8fK2pQ","period":"7d"}}}'
```
