> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing and no data import except a site's history from a Plausible export (Settings, Import and export). Websites use the script. iOS, Android, React Native and Flutter use the mobile SDKs in the install guides. Those SDKs are source files, not a published package, and they do not read an advertising id.
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> The script tag is the main install; the npm package @crispstats/tracker does the same from code, never alongside the tag. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# MCP workspace tools

> The CrispStats MCP tools beyond the reports: workspaces, sites and their settings, goals, errors, uptime, payments, sharing, notes, funnels, alerts, channels, e-mail reports, the team, API keys and billing. How a sign-in connection reaches every workspace, how changes preview first, and the permission and role each tool needs.

Next to the reports listed in the [MCP server reference](https://docs.crispstats.com/api-reference/mcp.md), the server offers 65 tools for the rest of what the dashboard does: 19 that read and 46 that change something. They cover workspaces and the account, sites and their settings, AI crawler traffic and the live map, goals, errors, uptime monitors and the status page, payments and payment connections, public sharing, notes, funnels, alerts, notification channels, e-mail reports, the team, API keys and billing. Where a tool has a [REST API](https://docs.crispstats.com/api-reference/introduction.md) endpoint, it calls the same code with the same permission, role and site checks. Every answer about a site carries a `site` field.

## Which tools a connection sees

`tools/list` only lists the tools the connection can use. A key without **Notes: write** never sees `create_note`; calling it by name anyway is refused with the permission it needs. Without a key, at `/api/mcp?demo`, the live map and the crawler reports read the demo site.

### Sign-in connections

An app connected by [signing in](https://docs.crispstats.com/mcp/connect-with-sign-in.md) reaches every workspace you belong to, and every site you can open in each, workspaces and sites added later included. It can read and change what you can in the dashboard, never more than your role in each workspace allows:

* Where you are a viewer, it only reads.
* Where you are a member, it also changes goals, funnels, notes, alert rules, e-mail reports, uptime monitors and the status of errors.
* Where you are an owner or admin, it also changes sites and their settings, sharing, notification channels, people and API keys, and deletes sites.
* Only an owner makes, unmakes or removes an owner.

Each call is narrowed to one workspace. A tool about a site uses the site's workspace. A tool about the workspace takes `workspace`, a workspace id from `list_workspaces`; leave it out when you are in one workspace. `list_sites` names the workspace of each site. `tools/list` follows what you allowed on the consent screen, and your role is checked when a call reaches a workspace, so a listed tool can still be refused in a workspace where your role does not allow it.

Five permissions exist only for sign-in connections, never for API keys: **Delete sites and their data** (`sites:delete`), **Manage people** (`members:write`), **Uptime monitors: write** (`uptime:write`), **Errors: write** (`errors:write`) and **Billing: read** (`billing:read`). The tables below mark the tools that need them **sign-in only**.

### API keys

An API key belongs to one workspace and acts for the person who created it, with their role there today. Leave `workspace` out; another workspace's id answers not found. A key reaches the tools its [permissions](https://docs.crispstats.com/account/api-keys.md#permissions) allow. With the extras ticked, it lists the team (**Team members**), renames the workspace or creates a new one (**Workspace name**), and lists and manages API keys (**See API keys**, **Manage API keys**). It never reaches a sign-in only tool: a key cannot invite, change or remove people, read billing, triage errors, manage uptime monitors or the status page, or delete a site.

Tools that change something also need the person behind the key or connection to hold the role the dashboard asks for, listed with each tool below. The public demo site cannot be changed.

## Write tools preview first

Every tool that changes something takes two more arguments:

| Argument | Type | What it does |
| - | - | - |
| `confirm` | boolean, default `false` | Without it, the tool checks the input, writes nothing and answers a preview: `preview: true`, `changed: false`, what would change (before and after for an update, the row for a delete), and for a bulk delete the number of rows that match. Call again with `confirm: true` to make the change. |
| `idempotencyKey` | string, 1 to 200 printable characters | Optional. The same key from the same connection within 24 hours answers the first call's result with `replayed: true` instead of writing again. The same key with different input, for another site or in another workspace, is refused. Use one per change, such as a deploy id, so a retried call never adds a second note or deletes a second batch. |

A confirmed call answers `changed: true` and the change's JSON. Read tools refuse both arguments.

A secret is answered once. `create_api_key` and `roll_api_key` put the new secret in the confirmed answer only, and `invite_member` and `resend_invite` add the invitation link only when no e-mail went out. A replay with the same `idempotencyKey` answers `null` in its place, with a note.

Hints on every tool follow MCP's [tool annotations](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#tool-annotations): read tools are `readOnlyHint: true`; tools that update or delete are `destructiveHint: true`; tools that create are neither. `idempotentHint` is `true` where calling twice with the same input changes nothing more: every update except `resend_invite` and `roll_api_key`, every delete except `delete_events` and `delete_payments`, and `create_note` and `record_payment`. It is `false` for those four and for every other tool that creates: `create_site`, `create_goal`, `create_funnel`, `create_alert`, `create_uptime_monitor`, `create_channel`, `test_channel`, `create_email_report`, `invite_member`, `create_workspace` and `create_api_key`. `openWorldHint` is `false` on all of them.

## Tools

In **Needs**, a permission is named as in the key dialog and on the consent screen. A role means the person's role in the workspace the call is about.

### Workspaces and account

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `list_workspaces` | None | Any working key or connection | The workspaces the connection reaches: id, name, your role there, plan, and whether you see every site or only some. A key answers its own workspace. Takes no arguments. |
| `get_account` | `GET /account` | Any working key or connection | A workspace, its plan and trial, this month's usage against the plan's limits, and the key's own sites and permissions. Takes `workspace`; left out on a connection to several workspaces, it answers every one. |

### Sites

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `get_site` | `GET /sites/{siteId}` | Sites: read | One site with its settings, exclusions and bot settings |
| `create_site` | `POST /sites` | Sites: write, owner or admin, every site of the workspace | Adds a site within the plan's site limit and answers its public key. Takes `workspace`. The preview checks the domain and the limit. A key or person limited to some sites cannot add one. |
| `update_site` | `PATCH /sites/{siteId}` | Sites: write, owner or admin | Changes only the settings sent: name, domain, timezone, currency, hostnames, excluded paths, kept query parameters, returning visitors, bot filter, pausing, the live count badge, excluded hostnames, countries and IP addresses. The preview lists each setting before and after. |
| `get_bot_settings` | `GET /sites/{siteId}/bot-settings` | Sites: read | Which crawlers are hidden from reports and which are not recorded |
| `update_bot_settings` | `PUT /sites/{siteId}/bot-settings` | Sites: write, owner or admin | Replaces the hidden and excluded crawler lists and the verified-only switch |
| `update_sharing` | None | Sites: write, owner or admin | Turns the read-only [public dashboard](https://docs.crispstats.com/share/public-dashboard.md) on or off and sets its link name, whether it shows revenue and whether search engines may index it. Send only the fields to change. |
| `delete_site` | None | Delete sites and their data (sign-in only), owner or admin | Deletes the site with everything recorded for it, its settings and the API keys made only for it. `domain`, the site's domain typed exactly, is required to confirm which site goes. The preview names the site and counts the pageviews, events, visits and payments that would be lost. It cannot be undone. |
| `get_search_queries` | `GET /sites/{siteId}/search-keywords` | Analytics: read | The Google searches that showed the site, from its connected [Search Console](https://docs.crispstats.com/integrations/google-search-console.md) property: clicks, impressions, click-through rate, average position and a revenue estimate per query. `connected: false` when Search Console is not connected. |

### Crawlers and the live map

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `get_bot_traffic` | `GET /sites/{siteId}/bot-traffic` | Analytics: read | AI crawler hits by crawler, with operator, purpose (training, search or user), change and top paths. Filters: `category`, `operator`, `crawler`, `verified`, `includeHidden`, and the usual period. |
| `get_bot_traffic_pages` | `GET /sites/{siteId}/bot-traffic/pages` | Analytics: read | The pages crawlers read most. `search`, `limit` (1 to 200, default 50) and `offset`. |
| `get_realtime_map` | `GET /sites/{siteId}/realtime/map` | Analytics: read | Everyone on the site now, up to 200, placed at coordinates rounded to 0.1 degrees, and the latest payments. Visitor ids and lifetime revenue need **Visitor details**. |

### Goals and errors

| Tool | Needs | What it does |
| - | - | - |
| `create_goal` | Goals and events: write, member | Creates a goal: a page (`{ "kind": "page", "pathPattern": "/pricing" }`) or a custom event (`{ "kind": "event", "event": "signup" }`), with an optional fixed `value` per completion in minor units. Names are unique on a site, whatever their case. `paused: true` creates it paused. |
| `update_goal` | Goals and events: write, member | Changes a goal's name, match or value, by `goalId`. Send only the fields to change. |
| `pause_goal` | Goals and events: write, member | Pauses a goal (`paused: true`, the default) or resumes it (`paused: false`). A paused goal stops counting from that moment and keeps its figures up to then. |
| `delete_goal` | Goals and events: write, member | Deletes one goal, by `goalId`. The pageviews and events it counted stay; its figures leave the reports. |
| `set_error_status` | Errors: write (sign-in only), member | Marks one JavaScript error group, by `errorId`, as `resolved`, `ignored` or `open`. A resolved error opens again if it happens again. |

Goals are read with the existing `list_goals` tool. None of these has a REST endpoint.

### Uptime

| Tool | Needs | What it does |
| - | - | - |
| `list_uptime_monitors` | Analytics: read | The site's monitors as they are set up: URL, method, interval, thresholds, whether paused, status now, last check and certificate expiry, plus how many monitors the workspace uses against its plan. Uptime figures and incidents are in `get_uptime`. |
| `create_uptime_monitor` | Uptime monitors: write (sign-in only), member | Adds a monitor for a public `url`, every `intervalSeconds` (30 to 86400, default 300), within the plan's monitor limit across the workspace. Two monitors of a site cannot check the same URL. |
| `update_uptime_monitor` | Uptime monitors: write (sign-in only), member | Changes a monitor, by `monitorId`. `paused: true` stops the checks and keeps the history; `paused: false` resumes them. |
| `delete_uptime_monitor` | Uptime monitors: write (sign-in only), member | Deletes one monitor with its check history and incidents. It cannot be undone. |
| `update_status_page` | Uptime monitors: write (sign-in only), owner or admin | Turns the site's public [status page](https://docs.crispstats.com/share/status-page.md) on or off, at `/status/<slug>`. The public dashboard is not touched. |

None of these has a REST endpoint.

### Payments and payment connections

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `record_payment` | `POST /sites/{siteId}/payments` | Revenue and payments: write | Records a payment, renewal, refund or free trial, with the same body as the [payments API](https://docs.crispstats.com/revenue/payment-api.md). `amount` is in minor units. The same `transactionId` again records nothing new. |
| `delete_payments` | `DELETE /sites/{siteId}/payments` | Revenue and payments: write | Removes payments recorded through the API, never a connected provider's, by `transactionId`, `visitorId` or a range. Free trials recorded through the API that match go too. Up to 1,000 a call; `more: true` means call again with a new `idempotencyKey`. The preview counts the sales, refunds and free trials. |
| `remove_test_payments` | None | Revenue and payments: write, owner or admin | Deletes the payments a connected provider labelled as test mode, with their refunds, and takes their amounts off the visits they were credited to. `provider` limits it to one provider. Real payments are never touched. The preview counts them. |
| `list_integrations` | `GET /sites/{siteId}/integrations` | Revenue and payments: read | The payment providers connected to the site, with status, the last payment event and the last error. Never secrets or keys. |
| `disconnect_integration` | None | Sites: write, owner or admin | Disconnects one payment provider, by `integrationId`, and deletes its stored signing secret. Recorded payments stay. A connection made with an API key is disconnected in the dashboard, which also removes its webhook. |

### Events

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `delete_events` | `DELETE /sites/{siteId}/events` | Goals and events: write, owner or admin | Removes custom events of one `name`, or the event of one `goalId`, between `from` and `to`. Pageviews and errors are never touched. Up to 1,000 a call; `more: true` means call again with the same input and a new `idempotencyKey` (the same key replays the earlier batch's answer). The preview counts what matches. |

### Notes, funnels and alerts

| Tool | REST endpoint | Needs |
| - | - | - |
| `list_notes` | `GET /sites/{siteId}/notes` | Notes: read |
| `create_note`, `update_note`, `delete_note` | `POST /notes`, `PATCH` and `DELETE /notes/{noteId}` | Notes: write, member |
| `create_funnel`, `update_funnel`, `delete_funnel` | `POST /funnels`, `PATCH` and `DELETE /funnels/{funnelId}` | Funnels: write, member |
| `list_alerts`, `get_alert`, `get_alert_history` | `GET /alerts`, `GET /alerts/{alertId}`, `GET /alerts/history` | Alerts: read |
| `create_alert`, `update_alert`, `delete_alert` | `POST /alerts`, `PATCH` and `DELETE /alerts/{alertId}` | Alerts: write, member |

A note with the same text on the same day is added once: `create_note` then answers the existing note with `created: false`. Funnels are read with the existing `list_funnels` and `get_funnel` tools; each step has a `name` and a `match`, either `{ "kind": "page", "pathPattern": "/pricing" }` or `{ "kind": "event", "event": "signup" }`.

### Notification channels and e-mail reports

Channels belong to the workspace, so the channel tools take `workspace`, not `site`. Only people and keys with every site of the workspace can see or manage them, and viewers never see them.

| Tool | Needs | What it does |
| - | - | - |
| `list_channels` | Alerts: read, member | The workspace's channels: kind (`email`, `slack`, `discord`, `telegram` or `webhook`), name, destination as the dashboard shows it (a webhook URL only as its host), enabled, verified, and how many alert rules send to it |
| `create_channel` | Alerts: write, owner or admin | Adds a channel, checked as the dashboard checks it: a public `https` webhook URL, a Slack or Discord webhook, an e-mail address or a Telegram chat. A webhook's signing secret is shown only in the dashboard. |
| `update_channel` | Alerts: write, owner or admin | Renames a channel, points it somewhere else of the same kind, or switches it off or on |
| `delete_channel` | Alerts: write, owner or admin | Removes a channel. The preview names every alert rule that sends to it and says which have no other channel. |
| `test_channel` | Alerts: write, member | Sends a fixed test message to a channel that is switched on, within about a minute. At most one test per channel a minute and 20 per workspace an hour. |
| `list_email_reports` | Alerts: read | The site's weekly and monthly [e-mail reports](https://docs.crispstats.com/alerts/email-reports.md): recipients, schedule, whether paused, next and last send |
| `create_email_report`, `update_email_report`, `delete_email_report` | Alerts: write, member | Adds, changes or deletes a report. A site has at most one weekly and one monthly report, each to 1 to 25 addresses. `enabled: false` pauses one. |

None of these has a REST endpoint.

### Team and workspace

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `list_team` | None | Team members | The people of the workspace with role, join date and whether they are limited to some sites. Owners and admins also get the pending invitations. |
| `invite_member` | None | Manage people (sign-in only), owner or admin | Invites an `email` as `admin`, `member` (the default) or `viewer`, to every site or to `siteIds` (members and viewers only). The link works for 14 days. Nobody is invited as an owner. |
| `resend_invite` | None | Manage people (sign-in only), owner or admin | Sends a pending invitation again with a new link; the old link stops working |
| `cancel_invite` | None | Manage people (sign-in only), owner or admin | Cancels a pending invitation and frees its seat |
| `update_member` | None | Manage people (sign-in only), owner or admin | Changes a person's `role`, their `siteIds`, or both. Limiting someone revokes the API keys they made in the workspace. Only an owner makes, unmakes or changes an owner, and a workspace keeps one owner. |
| `remove_member` | None | Manage people (sign-in only), owner or admin | Removes a person, by `userId`, and revokes the API keys they made there. Removing yourself leaves the workspace. The only person of a workspace cannot be removed. |
| `rename_workspace` | `PUT /account` | Workspace name, owner or admin | Renames the workspace, up to 80 characters |
| `create_workspace` | None | Workspace name | Creates a new, empty workspace with you as its owner. It shares your trial. One account owns at most 10 workspaces. With several workspaces, pass any one you belong to as `workspace`. |

### API keys and billing

| Tool | REST endpoint | Needs | What it does |
| - | - | - | - |
| `list_api_keys` | `GET /keys` | See API keys, owner or admin | The workspace's keys within the caller's own sites: name, first characters, sites, permissions, created, last used and expiry. Never a secret. `includeRevoked: true` adds revoked keys. |
| `create_api_key` | `POST /keys` | Manage API keys, owner or admin | Creates a key with a `name`, `permissions` and optionally `siteIds` and `expiresAt`. Never with a permission or a site the caller does not hold in the workspace, and never with a sign-in only permission. The secret is in the confirmed answer once. |
| `update_api_key` | `PATCH /keys/{keyId}` | Manage API keys, owner or admin | Renames a key or replaces its permissions or sites. The secret stays the same. |
| `roll_api_key` | `POST /keys/{keyId}/roll` | Manage API keys, owner or admin | Gives a key a new secret, answered once; the old secret stops working at once |
| `revoke_api_key` | `DELETE /keys/{keyId}` | Manage API keys, owner or admin | Revokes a key: anything using it stops at once. It stays in the list as a record. |
| `get_billing` | None | Billing: read (sign-in only) | The plan, its status and period, the trial, whether the workspace is paused or locked, this month's usage against the plan, and for owners and admins the latest invoices. Never card details. Nothing changes the plan: `changePlanUrl` opens the billing page. |

**Manage people**, the API key permissions and **Delete sites and their data** come with **Read and write** on the consent screen; choose **Read only** and the app can change nothing. A key made through `create_api_key` outlives the conversation, so read the preview before you confirm one.

## Example: a deploy note an agent can retry

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "create_note",
    "arguments": { "site": "quillbook", "label": "Deployed v2.3.1", "confirm": true, "idempotencyKey": "deploy-2026-12-03-v2.3.1" }
  }
}
```

Sent again within 24 hours with the same key, the answer is the first one with `replayed: true`, and no second note is added.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.