> ## 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.

# Connect an MCP client that only runs local servers

> Some MCP clients only start local stdio servers. Bridge them to the CrispStats MCP server with mcp-remote and send your API key as a header.

The CrispStats MCP server runs at `https://crispstats.com/api/mcp` and speaks Streamable HTTP. Most clients connect to it directly, either [by signing in](https://docs.crispstats.com/mcp/connect-with-sign-in.md) or [with an API key](https://docs.crispstats.com/ai/connect-ai-assistants.md). Some clients, and older versions of others, can only start a local program and talk to it over standard input and output (stdio). For those, run [mcp-remote](https://www.npmjs.com/package/mcp-remote): a small open-source bridge that the client starts like any local server, and that forwards every message to the remote server.

> [!NOTE]
>
> mcp-remote is a third-party package, not part of CrispStats. It needs Node.js 18 or later on the machine that runs the client.

## Before you start

Create a secret key under **API keys** on the [API and MCP page](https://docs.crispstats.com/account/api-keys.md#create-a-key). The **Read only** preset is enough to ask questions; tick **Visitor details** only if the assistant should read visitor profiles. See [authentication](https://docs.crispstats.com/api-reference/authentication.md) for every permission.

## Add the server

Add an entry like this to the client's MCP configuration, for example `claude_desktop_config.json` for Claude Desktop, and put your key in `CRISPSTATS_AUTH`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "mcpServers": {
    "crispstats": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://crispstats.com/api/mcp",
        "--header",
        "Authorization:${CRISPSTATS_AUTH}"
      ],
      "env": {
        "CRISPSTATS_AUTH": "Bearer cs_sk_your_key"
      }
    }
  }
}
```

The key goes in `env` and is referenced from `args` because some clients split arguments on spaces, which would break `Bearer cs_sk_…` in two. Write `Authorization:${CRISPSTATS_AUTH}` with no space after the colon.

Restart the client. It starts the bridge, and the CrispStats tools appear in its tool list. Try asking which pages got the most visitors in the last 7 days.

## Try it with the demo site

To test the bridge before you create a key, connect to the demo site, which needs no key:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "mcpServers": {
    "crispstats-demo": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://crispstats.com/api/mcp?demo"]
    }
  }
}
```

## When it does not connect

| What you see | Cause | Fix |
| - | - | - |
| The bridge opens a browser to sign in | The `Authorization` header did not reach the server, so it offered sign-in instead. | Check the `--header` argument and the `env` name match, with no space after `Authorization:`. Or finish signing in: that works too. |
| `401` in the client's log | The key is unknown, revoked, expired, or its secret was replaced. | Use the current secret, or create a new key. |
| Tools are missing | The key lacks the permission those tools need. The server lists only the tools a key may call. | Edit the key and tick the permission. |
| `npx: command not found` | Node.js is not installed, or the client does not see it on its `PATH`. | Install Node.js, or set `command` to the full path of `npx`. |

The client's MCP log shows what the bridge printed; in Claude Desktop it is under **Settings**, **Developer**.

## Next steps

> [card] [MCP server reference](https://docs.crispstats.com/api-reference/mcp.md)
>
> Tools, prompts, limits and errors.

> [card] [Connect with sign-in](https://docs.crispstats.com/mcp/connect-with-sign-in.md)
>
> Clients that support remote servers need no key at all.

> [card] [API keys](https://docs.crispstats.com/account/api-keys.md)
>
> Create, limit and rotate keys.


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