# MCP for AI agents

> Let coding agents read your reports and build funnels, insights and dashboards over MCP.

Connect AI coding agents (Claude Code, Codex, Cursor, VS Code, Claude.ai and any other client that speaks the Model Context Protocol) to your analytics. Ask them about your numbers, or have them build what you need: a signup funnel, a retention insight, a dashboard for the launch, conversion goals.

> **On every plan**
>
> MCP is included in every plan. Agents can read reports and build insights, but they can never send, change or delete tracked events: your data only comes from your own SDKs.

## Connect an agent

The MCP server lives at `https://api.anyanalytics.org/mcp`. Agents sign in with OAuth: the first time, a browser tab opens where you choose what the agent may do.

### Claude Code

`terminal`:

```sh
claude mcp add --transport http anyanalytics https://api.anyanalytics.org/mcp
```

Then run `/mcp` in Claude Code, pick **anyanalytics** and **Authenticate**.

### Codex

`terminal`:

```sh
codex mcp add anyanalytics --url https://api.anyanalytics.org/mcp
codex mcp login anyanalytics
```

### Cursor

`.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "anyanalytics": {
      "url": "https://api.anyanalytics.org/mcp"
    }
  }
}
```

Cursor shows **Needs login** next to the server: click it to authorize.

### VS Code

`.vscode/mcp.json`:

```json
{
  "servers": {
    "anyanalytics": {
      "type": "http",
      "url": "https://api.anyanalytics.org/mcp"
    }
  }
}
```

### Claude.ai and Claude Desktop

Open **Settings → Connectors → Add custom connector**, paste `https://api.anyanalytics.org/mcp` and click **Connect**.

## Choosing what an agent may do

When an agent connects, you pick:

1. **The organization**

   Its sites are the only ones the agent can see.
2. **An access level**

   | Level | The agent can |
   | --- | --- |
   | **Read only** | Read reports, saved insights, dashboards and the list of events your sites receive. |
   | **Can build** | Also create and edit funnels, insights, dashboards and conversion goals. |
   | **Full control** | Also delete them. |

3. **Which sites**

   All sites (including ones you add later), or a list of sites.

An agent acts as you and never gets more than your own role allows. As a member (not an owner or admin), your agents can change only what you created and can't manage goals. If you leave the organization, your agents lose access too. See [Team and roles](https://anyanalytics.org/docs/team.md).

## Managing connections

Every connection is listed under **MCP** in your organization's sidebar, with its access level, its sites, when it was last used and how many calls it made. From there you can:

- **Activity**: see every tool call (what, on which site, whether it worked), kept 90 days.
- **Edit access**: change the level or the sites. It applies from the agent's next request.
- **Disconnect**: its tokens stop working at once.

Owners and admins see everyone's connections. They can lower another member's access or disconnect it, but only the person who connected an agent can give it more.

Funnels, insights, dashboards and goals an agent creates show a badge with the agent's name, so you always know where they came from.

## What agents can do

| Tool | Access | What it does |
| --- | --- | --- |
| `list_projects` | Read | The sites the connection can see. |
| `describe_project` | Read | The events a site receives (with counts), their properties, goals, saved insights and dashboards. |
| `get_overview` | Read | The overview report for a range. |
| `run_query` | Read | Runs a trends, funnel, retention or paths query without saving it. |
| `list_insights`, `get_insight` | Read | Saved insights, and one insight with its current result. |
| `list_dashboards`, `get_dashboard` | Read | Dashboards and their tiles. |
| `create_funnel` | Build | Saves a funnel and returns its first result. |
| `save_insight`, `update_insight` | Build | Saves or edits any insight. |
| `create_dashboard`, `update_dashboard`, `add_dashboard_tile` | Build | Builds dashboards from saved insights. |
| `create_goal` | Build | Adds a conversion goal (owners and admins). |
| `delete_insight`, `delete_dashboard`, `remove_dashboard_tile`, `delete_goal` | Full | Deletes them. Clients ask you before running these. |

Every answer includes links to open the result in the dashboard. Queries use the same shapes as the [Read API](https://anyanalytics.org/docs/read-api.md).

### Only real events

Before an agent saves a funnel, an insight or an event goal, the events it uses are checked against what your site received in the last 90 days. A typo or an invented event is refused with suggestions, like `No events named "sign_up" (did you mean "signed_up"?)`. For tracking you are shipping right now, the agent can say so explicitly (`allowUnseenEvents`).

## Access tokens

For clients without OAuth sign-in (CI jobs, scripts), create a personal access token under **MCP → Connect another client → Access token**. It starts with `vxm_`, is shown once, acts as you with the access you chose, and works until you disconnect it.

`terminal`:

```sh
claude mcp add --transport http anyanalytics https://api.anyanalytics.org/mcp \
  --header "Authorization: Bearer vxm_YOUR_TOKEN"
```

> **Heads up**
>
> Tokens read your data: keep them secret, like a password.

## Limits

- 300 requests per minute and 8 at once per connection.
- Report results are cached for a minute, like in the dashboard.
- If your free trial has ended, report tools answer with an error until you choose a plan.

Looking for the report on AI crawlers visiting your site instead? That's [AI agents](https://anyanalytics.org/docs/ai-agents.md).

---

Web version: https://anyanalytics.org/docs/mcp. All docs: https://anyanalytics.org/docs.md
