Microsoft Clarity MCP Server (microsoft-clarity-mcp)
FastMCP server exposing Microsoft Clarity's Data Export API for behavioral UX analysis, rage clicks, dead clicks, quick backs, excessive scrolling, and JavaScript runtime errors.
Companion behavioral diagnostics engine to Google Analytics and Search Console for AI agents.
1. Quickstart
Run directly without installing via uvx (Python) or npx (Node):
Via Python (uvx)
Via Node (npx)
2. MCP Client Configuration
Add to your MCP client config (claude_desktop_config.json, cursor.json, or Antigravity/OpenCode):
Or using npx:
3. Authentication & API Tokens
Microsoft Clarity secures data export via static JWT Bearer tokens:
- Log in to Microsoft Clarity.
- Open your project dashboard.
- Navigate to Settings -> Data Export.
- Click Generate new API token (provide a name between 4 and 32 alphanumeric characters, e.g.
clarity-agent).
- Copy the generated token and configure
CLARITY_API_TOKEN.
4. Rate-Limit Defense & Persistent Caching
- Daily Quota: Microsoft Clarity strictly allows 10 requests per project per day.
- Automatic Cache: To safeguard user quota from runaway agent loops, all responses are cached locally on disk at
~/.clarity_mcp/cache.json with a 1-hour TTL (configurable via CLARITY_CACHE_TTL).
- Stale Cache Fallback: If the daily 10-request quota is reached, the server automatically serves stale cached data with an explicit warning, ensuring your agents remain operational without hard crashing.
- Quota Transparency: Every tool response includes metadata detailing
calls_used_today, remaining_today, and daily_limit.
5. Tools
6. Telemetry & Privacy
This package includes anonymous usage telemetry to ensure reliability and detect runtime bugs across different client harnesses. Telemetry adheres strictly to Schema v2:
- Opt-Out: Strictly respects
DO_NOT_TRACK=1, DISABLE_TELEMETRY=1, or CLARITY_TELEMETRY=false.
- Zero PII: No user URLs, personal identifiers, or authentication tokens are ever captured.
License
MIT License. Copyright (c) 2026 Surendran B.