CrispStats

Ask your AI about your website. CrispStats gives it live visitors, sources, revenue by channel, funnels, web vitals, errors and AI-bot traffic. Privacy-first, no cookies. Remote server with OAuth sign-in: https://crispstats.com/api/mcp

託管 MCP 伺服器

npx add-mcp 'https://crispstats.com/api/mcp'

可安裝到 Claude Code、Codex、Cursor 等客戶端

文件

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.

Connect Claude and other AI assistants to your analytics

Connect Claude Code, claude.ai, Cursor, VS Code, Codex or Windsurf to the CrispStats MCP server by signing in, which reaches every workspace and can make changes you confirm, or with a read-only API key, then ask about your numbers or let a coding agent check its install.

CrispStats runs a remote MCP server at https://crispstats.com/api/mcp. Connect your AI client by signing in, or with a Read only secret API key, and the assistant can answer questions from the same reports as the dashboard, give a coding agent the exact install code for your project and check that the install works. Signed in, it can also change what your role allows, after showing you a preview. With a Read only key it cannot change anything.

The server uses the Streamable HTTP transport. There are two ways to give the assistant access:

  • Sign in. Clients that support MCP sign-in, such as claude.ai, open a CrispStats page where you allow the assistant. One connection reaches every workspace you belong to, never above your role in each. No key to copy. See connect by signing in.
  • An API key. The client sends an Authorization: Bearer cs_sk_… header with a secret key for one workspace. A Read only key only reads. This works in every client, and the rest of this page sets it up.

Connect by signing in

Add https://crispstats.com/api/mcp to your client as a remote MCP server without a request header. When the client signs in, it opens a CrispStats page in your browser that asks you to connect the app:

1. Sign in to CrispStats

If you are signed out, you sign in first and come back to the same page.

2. Review what it can do

The page lists what the app can do, all of it allowed, across every workspace you belong to and every site you can open in each, workspaces and sites added later included. It never goes above your role: where you are a viewer it only reads, and members, admins and owners can have it change what they can change in the dashboard. A tool that changes something answers a preview first, and the server tells the app to show it to you and make the change only after you agree.

3. Choose read only, or read and write

At the top of the list, choose Read only to let the app read and change nothing, or Read and write (chosen at first) to let it do everything your role allows, deleting sites, managing people and API keys included.

4. Allow

Allow sends you back to the app, which can now use the tools. Cancel sends it back with nothing.

Anyone can register an app, so allow one only if you started connecting from that app yourself: the page names it and its client ID. To see the apps you connected, or to cut one off, open API and MCP, Connected apps and select Disconnect. Each client's steps are in connect with sign-in.

Connect with a key from the dashboard

1. Open the connect screen

Open the site's Settings, Tracking code and scroll to Connect an AI assistant.

2. Create a read-only key

Owners and admins select Create read-only key. It has only the Read scope and reads only the current site. It is shown once and fills in every setup below it. To cover every site instead, create a key under API keys on the API and MCP page with Read checked and Every site in your workspace.

3. Add the server to your client

Pick your client. Copy the command or config with its copy button, or use Add to Cursor. The setups are the same as on this page.

Each client

Replace cs_sk_your_read_key with your key. Where a client can read the key from an environment variable, the config does, so the key never sits in a file you might commit.

[tab] Claude Code

Run once in a terminal. --scope user makes the server available in every project:

claude mcp add --transport http --scope user crispstats https://crispstats.com/api/mcp \
  --header "Authorization: Bearer cs_sk_your_read_key"

Run claude mcp list: crispstats shows as connected. In a session, /mcp lists its tools, and the prompts appear as slash commands such as /mcp__crispstats__install_crispstats.

For a project's shared .mcp.json, read the key from the environment instead:

{
  "mcpServers": {
    "crispstats": {
      "type": "http",
      "url": "https://crispstats.com/api/mcp",
      "headers": { "Authorization": "Bearer ${CRISPSTATS_API_KEY}" }
    }
  }
}

[tab] claude.ai

In claude.ai, open Customize, Connectors, select Add and Add custom connector, and enter:

FieldValue
NameCrispStats
Remote MCP server URLhttps://crispstats.com/api/mcp
AuthenticationNo sign in
Request headersAuthorization: Bearer cs_sk_your_read_key

Claude Desktop and the mobile apps use the same connector. On Team and Enterprise plans an owner adds it under Organization settings, Connectors, and everyone who uses it reads with that one key. Free plans allow one custom connector.

[tab] Cursor

Use Add to Cursor on the connect screen, or add the server to ~/.cursor/mcp.json for every project (.cursor/mcp.json for one), with the key in the CRISPSTATS_API_KEY environment variable:

{
  "mcpServers": {
    "crispstats": {
      "url": "https://crispstats.com/api/mcp",
      "headers": { "Authorization": "Bearer ${env:CRISPSTATS_API_KEY}" }
    }
  }
}

Restart Cursor and open Cursor Settings, MCP: crispstats is listed with its tools.

[tab] VS Code

Add the server to .vscode/mcp.json. VS Code asks for the key the first time the server starts and stores it securely:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "crispstats-key",
      "description": "CrispStats API key (cs_sk_…)",
      "password": true
    }
  ],
  "servers": {
    "crispstats": {
      "type": "http",
      "url": "https://crispstats.com/api/mcp",
      "headers": { "Authorization": "Bearer ${input:crispstats-key}" }
    }
  }
}

Or add it to your user profile for every workspace with one command:

code --add-mcp '{"name":"crispstats","type":"http","url":"https://crispstats.com/api/mcp","headers":{"Authorization":"Bearer cs_sk_your_read_key"}}'

Start the server from the MCP servers list, then use it from Copilot Chat in agent mode.

[tab] Codex

Add the server to ~/.codex/config.toml. Codex sends the key from the environment variable named in bearer_token_env_var:

[mcp_servers.crispstats]
url = "https://crispstats.com/api/mcp"
bearer_token_env_var = "CRISPSTATS_API_KEY"

Then set the variable in your shell profile and start Codex:

export CRISPSTATS_API_KEY="cs_sk_your_read_key"

Run /mcp in Codex: crispstats is listed.

[tab] Windsurf

In Cascade, open Manage MCPs, then View raw config, and add the server to mcp_config.json:

{
  "mcpServers": {
    "crispstats": {
      "serverUrl": "https://crispstats.com/api/mcp",
      "headers": { "Authorization": "Bearer ${env:CRISPSTATS_API_KEY}" }
    }
  }
}

Set CRISPSTATS_API_KEY in your shell profile, then refresh the MCP list. On Teams and Enterprise plans an admin may need to allow remote MCP servers.

[!WARNING]

The key reads every site it covers until you revoke it. Keep config files that contain it out of version control, and revoke it under API keys on the API and MCP page when you stop using the assistant.

Check the connection with curl

To confirm the key works before you configure a client, call list_sites directly:

curl https://crispstats.com/api/mcp \
  -H "Authorization: Bearer cs_sk_your_read_key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_sites","arguments":{}}}'

The response's structuredContent.sites lists the sites the key can read, with each site's id, name, domain, timezone, currency, createdAt and installed.

Example prompts

  • "Which sources brought the most revenue in the last 30 days?"
  • "Compare this week's visitors with last week's and tell me what changed."
  • "Which landing pages do ChatGPT and Perplexity send people to?"
  • "Where do people drop off in my signup funnel?"
  • "Which pages have the worst LCP on mobile?"
  • "Install CrispStats in this project, then check that events arrive."
  • "Wire the CrispStats visitor id into our Stripe checkout."

The server also offers three ready prompts: install_crispstats, connect_payments and explain_last_week. Clients show them as slash commands or in a prompt menu. See install with an AI agent for the install flow.

What the assistant can do

With a Read only key, every tool the assistant sees only reads; these are the ones it uses most. Each one except list_sites takes an optional site id, which can be left out when the key can read exactly one site. A sign-in connection also gets the tools that change sites, goals, funnels, notes, alerts, uptime, errors, the team and API keys, as far as your role allows; a key with write permissions gets the ones its permissions allow. See MCP workspace tools.

ToolWhat it returns
list_sitesThe sites this key can read.
get_stats, get_timeseries, get_breakdown, get_realtimeTraffic: key metrics, over time, by dimension, and right now.
get_revenue_summary, list_paymentsRevenue totals and individual payments.
list_goals, list_events, get_event_propertiesGoals, custom events and their properties.
list_funnels, get_funnel, get_retentionFunnels and retention cohorts.
get_web_vitals, get_errors, get_uptimeSite health.
get_ai_trafficVisitors from AI assistants and AI crawler hits.
list_visitors, get_visitorAnonymous visitors and a visitor's journey.
get_install_guideThe script element and proxy handler for a framework and host, with this site's values.
check_installationWhether events arrive, from which hostnames, and whether the proxy forwards the visitor's address without cookies.
get_revenue_setupThe checkout wiring for a payment provider and whether it is connected.

Money is integer minor units in the stated currency, rates are numbers from 0 to 1 and durations are seconds. The MCP reference documents every tool's inputs and the error codes.

Limits and errors

  • Rate limits. MCP requests count against the same limits as the REST API: your plan's daily API requests per key, a workspace ceiling of five times that across all keys, plus a burst limit of 20 requests in 10 seconds. Each request in a POST counts once, including initialize and tools/list; a batch may hold at most 20 requests. See rate limits. MCP requests do not use Ask AI messages.
  • Bad or revoked key. HTTP 401 with JSON-RPC error code -32001. Create a new key under API keys on the API and MCP page.
  • Key that cannot read. A key with no read permission gets HTTP 403, also with code -32001. A tool the key has no permission for is left out of tools/list, and calling it answers with the permission it needs.
  • Over a rate limit. HTTP 429 with code -32002 and a Retry-After header.
  • A tool fails, for example on an invalid range. The tool result has isError: true and a message the assistant can read and correct.

Without an Authorization header the server only reads the public demo site, demo, under a lower limit of 500 requests a day and 10 in 10 seconds. If list_sites returns only that site, your client is not sending the header.

Learn more on crispstats.com

  • Glossary: MCP. Feature: Ask AI, the read-only reports inside the dashboard.

Next steps

[card] Install with an AI agent

One prompt for the whole install.

[card] MCP reference

Transport, tools, prompts and error codes.

[card] API keys

Create, limit, revoke and delete secret keys.

This documentation is built and hosted on Mintlify, a developer documentation platform.