# Microsoft Clarity MCP server

> Query Clarity traffic and behavior metrics, list session recordings and search Clarity documentation in plain language.

- Listing: https://mcp.tc/i/clarity
- Connect: this is a local (stdio) server; install it on your machine (see Install). The listing link is a page, not an MCP endpoint.
- Type: local (stdio)
- Auth: API key
- Category: [Data & Analytics](https://mcp.tc/c/analytics)
- Vendor: Microsoft
- Verified: yes, mcp.tc checked that this is the official server (https://mcp.tc/verify). It says who runs the server, not that it is safe.
- Homepage: <https://github.com/microsoft/clarity-mcp-server>
- Docs: <https://github.com/microsoft/clarity-mcp-server>
- Repository: <https://github.com/microsoft/clarity-mcp-server>
- Package: npm `@microsoft/clarity-mcp-server`

## About

Connects an assistant to Microsoft Clarity through its data export API. You can ask natural language questions about traffic and user behavior metrics, list session recordings with timeline information, and pull snippets from the Clarity documentation.

Runs locally over stdio with npx (@microsoft/clarity-mcp-server) and needs Node.js. A Clarity data export API token is required, passed with the --clarity\_api\_token argument. The token is generated in the Clarity project settings under Data Export.

## What it can do

- Query traffic and behavior metrics with natural language
- Filter data by dimensions such as browser, device and country
- List session recordings with duration and interaction timeline
- Search Microsoft Clarity documentation for setup and troubleshooting answers

## Tools (3)

- `list-session-recordings`: List session recordings with session link, duration and a timeline of user interactions.
- `query-documentation-data`: Fetch Clarity documentation snippets for setup, features, usage and troubleshooting questions.
- `query-analytics-data`: Fetch Clarity analytics data using a focused natural language query with an explicit time range.

## Example prompts

- "How many Clarity sessions did we get from Egypt in the past 3 days?"
- "What are the most used browsers in my Clarity project?"
- "List the most recent Clarity sessions from mobile devices"
- "How do I track custom events using Microsoft Clarity?"

## Install

### Claude Code

1. Run this in a terminal, in your project folder:

```bash
claude mcp add --transport stdio clarity --env "CLARITY_API_TOKEN=<YOUR_CLARITY_API_TOKEN>" -- npx -y @microsoft/clarity-mcp-server
```

2. Start Claude Code and type `/mcp`. **clarity** should show as connected.

Add `--scope user` to make it available in every project. Replace the placeholders with your own values.

### Claude Desktop

1. Open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json`. Add:

`claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "clarity": {
      "command": "npx",
      "args": [
        "-y",
        "@microsoft/clarity-mcp-server"
      ],
      "env": {
        "CLARITY_API_TOKEN": "<YOUR_CLARITY_API_TOKEN>"
      }
    }
  }
}
```

2. Save the file and restart Claude Desktop. Replace the placeholders with your own values.

Needs Node.js on your computer. The file lives in `~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows.

### Cursor

[Add to Cursor](<https://cursor.com/install-mcp?name=clarity&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBtaWNyb3NvZnQvY2xhcml0eS1tY3Atc2VydmVyIl0sImVudiI6eyJDTEFSSVRZX0FQSV9UT0tFTiI6IjxZT1VSX0NMQVJJVFlfQVBJX1RPS0VOPiJ9fQ%3D%3D>) (opens Cursor)

Or add it by hand to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (this project):

`mcp.json`:

```json
{
  "mcpServers": {
    "clarity": {
      "command": "npx",
      "args": [
        "-y",
        "@microsoft/clarity-mcp-server"
      ],
      "env": {
        "CLARITY_API_TOKEN": "<YOUR_CLARITY_API_TOKEN>"
      }
    }
  }
}
```

Needs Node.js on your computer. Replace the placeholders with your own values.

### VS Code

Add it to `.vscode/mcp.json`. VS Code asks for the secret the first time and stores it securely:

`.vscode/mcp.json`:

```json
{
  "servers": {
    "clarity": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@microsoft/clarity-mcp-server"
      ],
      "env": {
        "CLARITY_API_TOKEN": "${input:clarity-api-token}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "clarity-api-token",
      "description": "CLARITY_API_TOKEN",
      "password": true
    }
  ]
}
```

Needs Node.js on your computer.

### Devin Desktop

1. Add it to `~/.config/devin/mcp_config.json` (macOS and Linux) or `%APPDATA%\devin\mcp_config.json` (Windows):

`mcp_config.json`:

```json
{
  "mcpServers": {
    "clarity": {
      "command": "npx",
      "args": [
        "-y",
        "@microsoft/clarity-mcp-server"
      ],
      "env": {
        "CLARITY_API_TOKEN": "<YOUR_CLARITY_API_TOKEN>"
      }
    }
  }
}
```

2. Refresh the MCP server list in Cascade. Replace the placeholders with your own values.

Devin Desktop is the new name for Windsurf.

### Codex

```bash
codex mcp add clarity --env "CLARITY_API_TOKEN=<YOUR_CLARITY_API_TOKEN>" -- npx -y @microsoft/clarity-mcp-server
```

Or edit `~/.codex/config.toml` directly:

`config.toml`:

```toml
[mcp_servers.clarity]
command = "npx"
args = ["-y", "@microsoft/clarity-mcp-server"]
env = { CLARITY_API_TOKEN = "<YOUR_CLARITY_API_TOKEN>" }
```

Needs Node.js on your computer. Replace the placeholders with your own values.

### Gemini CLI

```bash
gemini mcp add -e "CLARITY_API_TOKEN=<YOUR_CLARITY_API_TOKEN>" clarity npx -- -y @microsoft/clarity-mcp-server
```

This adds it to the current project. Add `-s user` to use it everywhere.

### Any client

Most clients that start local servers accept this shape:

```json
{
  "mcpServers": {
    "clarity": {
      "command": "npx",
      "args": [
        "-y",
        "@microsoft/clarity-mcp-server"
      ],
      "env": {
        "CLARITY_API_TOKEN": "<YOUR_CLARITY_API_TOKEN>"
      }
    }
  }
}
```

Zed puts servers under `context_servers` in its settings, with the same `command`, `args` and `env` fields.

Needs Node.js on your computer. Replace the placeholders with your own values.

## Details

- Server version: 2.0.1
- Last checked: 2026-10-03
- Listed: 2026-10-03
- Updated: 2026-10-03

---
Source: https://mcp.tc/i/clarity (mcp.tc is an independent directory, not affiliated with this server's publisher). Corrections: https://mcp.tc/report
