Skip to main content

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)

uvx microsoft-clarity-mcp

Via Node (npx)

npx microsoft-clarity-mcp

2. MCP Client Configuration

Add to your MCP client config (claude_desktop_config.json, cursor.json, or Antigravity/OpenCode):

{
  "mcpServers": {
    "microsoft-clarity": {
      "command": "uvx",
      "args": ["microsoft-clarity-mcp"],
      "env": {
        "CLARITY_API_TOKEN": "your_clarity_api_token_here"
      }
    }
  }
}

Or using npx:

{
  "mcpServers": {
    "microsoft-clarity": {
      "command": "npx",
      "args": ["-y", "microsoft-clarity-mcp"],
      "env": {
        "CLARITY_API_TOKEN": "your_clarity_api_token_here"
      }
    }
  }
}

3. Authentication & API Tokens

Microsoft Clarity secures data export via static JWT Bearer tokens:

  1. Log in to Microsoft Clarity.
  2. Open your project dashboard.
  3. Navigate to Settings -> Data Export.
  4. Click Generate new API token (provide a name between 4 and 32 alphanumeric characters, e.g. clarity-agent).
  5. 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

Tool Parameters Description
get_ux_insights project_id, num_of_days=3, token High-level behavioral friction metrics: session counts, rage clicks, dead clicks, quick backs, excessive scroll, and JS errors.
get_frustration_breakdown project_id, dimension="URL", num_of_days=3, token Ranks friction severity broken down across URL paths, devices, browsers, operating systems, or countries.
get_js_errors project_id, num_of_days=3, token JavaScript runtime exceptions and error clicks grouped across browsers and operating systems.
doctor project_id, token Diagnostic utility checking token format, cache integrity, and remaining daily API quotas.
skills_list (none) Lists dynamic skill playbooks bundled with the server.
skill_read name Fetches operational playbooks (e.g. ux-triage, setup-clarity-token, frustration-audit).
check_for_updates (none) Queries PyPI for newer versions and upgrade commands.

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.

Metadata

Release files for microsoft-clarity-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microsoft-clarity-mcp 0.1.1
File Size Uploaded
microsoft_clarity_mcp-0.1.1.tar.gz 25.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for microsoft-clarity-mcp 0.1.1
File Interpreter ABI Platform
microsoft_clarity_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.8 kB

Release files / microsoft_clarity_mcp-0.1.1.tar.gz

Download URL microsoft_clarity_mcp-0.1.1.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fb924f5f5bc45b863f91de27dc47419c0598500f4535c30efaf76dffdb9b6e54
BLAKE2b-256 checksum
How to use checksums
88826c11dcd86f25c875b6fd106b3805b36df89ecd4cbf053dc6f4e24414902f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / microsoft_clarity_mcp-0.1.1-py3-none-any.whl

Download URL microsoft_clarity_mcp-0.1.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d96497a8b2add524715bc50ee089c810c3436c57c9f4ebdff84a9b997be68580
BLAKE2b-256 checksum
How to use checksums
1388e69f8bfcb6b6c045ebb5e83e9a18c8b157b1806f726aa7a8bf4747d7c203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page