clarity-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@clarity-mcpshow me traffic for the last 48 hours by device"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
clarity-mcp
An MCP (Model Context Protocol) server that bridges the Microsoft Clarity Data Export API to MCP clients over HTTP (JSON-RPC 2.0).
The architecture mirrors a single-route React Router server: one POST /mcp
endpoint, a static bearer secret for auth, and Prisma/Postgres for a
cache + quota ledger + snapshot history layer that exists because the
Clarity API is heavily rate limited.
Why the database layer
The Clarity project-live-insights endpoint has hard limits:
Limit | Value |
API calls | 10 per project per UTC day (429 after that) |
Date range | rolling 1–3 days only (last 24 / 48 / 72 h) |
Response size | 1,000 rows, no pagination |
Dimensions | max 3 per request |
Payload | all metrics returned in one response |
So this server:
Caches every response keyed by
(numOfDays + dimensions).Tracks usage per UTC day and refuses / serves stale before hitting a 429.
Snapshots every live response into an append-only table so you can query ranges wider than Clarity's 3-day window from local data.
Serves the metric-specific tools (
get_traffic,get_rage_clicks, …) from a single shared cached fetch — asking for 10 metrics costs 0 extra API calls.
Quota policy
forceRefresh: false(default): if anything is cached for that exact(numOfDays + dimensions)combo, it is served — fresh or stale — with no API call.forceRefresh: true: calls the API if the daily quota remains; otherwise falls back to stale cache, or errors if there is none.CLARITY_CACHE_TTL_MS(default 6 h) only controls thestaleflag in the responsemeta; it does not by itself trigger an API call.
There is no scheduled/cron pull — every API call is initiated by a client request, by design, to protect the 10/day budget.
Related MCP server: DB Analytics & Query Platform
Tools
Tool | API cost | Notes |
| cache, or 1 call with | raw full payload |
| shared cache | Traffic metric |
| shared cache | |
| shared cache | |
| shared cache | |
| shared cache | Dead Click Count |
| shared cache | Rage Click Count |
| shared cache | Quickback Click |
| shared cache | Excessive Scroll |
| shared cache | Script Error Count |
| shared cache | Error Click Count |
| none (local DB) | snapshots by date range |
| none | calls used today (UTC) + reset time |
| none | valid dimension names |
All insight tools accept: numOfDays (1–3, default 3), dimension1,
dimension2, dimension3 — from
Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, URL.
Setup
Requires Node 20 (.nvmrc) and a Postgres database.
npm install
cp .env.example .env # then fill in the values.env:
CLARITY_API_TOKEN— Clarity project → Settings → Data Export → Generate new API token. A long-lived JWT; keep it out of git.MCP_BRIDGE_SECRET— shared secret clients send asAuthorization: Bearer <secret>. Generate withopenssl rand -hex 32.DATABASE_URL— Postgres connection string.CLARITY_CACHE_TTL_MS— optional, default21600000(6 h).
Create the schema:
npx prisma migrate dev --name init # local dev
# or, for an existing/managed database:
npx prisma migrate deployRun:
npm run dev # http://localhost:3000 (endpoint: POST /mcp)
npm run build && npm startDocker
export CLARITY_API_TOKEN=...
export MCP_BRIDGE_SECRET=...
docker compose up --buildBrings up Postgres + the app; the app container runs prisma migrate deploy
on start.
Calling it
SECRET=your_mcp_bridge_secret
# list tools
curl -s localhost:3000/mcp \
-H "Authorization: Bearer $SECRET" -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq
# traffic for the last 48h, broken down by OS and Country/Region
curl -s localhost:3000/mcp \
-H "Authorization: Bearer $SECRET" -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_traffic","arguments":{"numOfDays":2,"dimension1":"OS","dimension2":"Country/Region"}}}' | jq
# how much of today's quota is left
curl -s localhost:3000/mcp \
-H "Authorization: Bearer $SECRET" -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"clarity_quota_status"}}' | jqNotes / limitations
Single Clarity project per deployment (one
CLARITY_API_TOKEN).Clarity returns data in UTC;
numOfDaysis a rolling window, not calendar days.The Dockerfile is single-stage (dev deps kept for the build). Switch to a multi-stage build to slim the image if needed.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
Access New Relic observability data through MCP - query metrics, logs, traces, entities, and more
Related MCP Servers
- AlicenseAqualityFmaintenanceA Model Context Protocol server that lets you fetch Microsoft Clarity analytics data through Claude for Desktop or other MCP-compatible clients, with support for filtering by dimensions and retrieving various metrics.36,277114MIT
- FlicenseNot gradedqualityDmaintenanceA FastAPI-based server that enables executing SQL queries, managing database connections, and retrieving analytics reports through MCP-integrated endpoints. It allows users to interact with database schemas, performance metrics, and access logs using structured queries.-
- FlicenseNot gradedqualityCmaintenanceRead-only MCP server exposing Microsoft Clarity analytics data as tools for ChatGPT Agent Builder.-
- AlicenseNot gradedqualityCmaintenanceMCP server for Microsoft Clarity Data Export API, providing tools to retrieve traffic, popular pages, engagement metrics, and user behavior insights such as dead clicks, rage clicks, and script errors. Supports multiple projects with daily quota management and shared caching.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Biz2Gig/clarity-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server