Microsoft Clarity logo

Microsoft Clarity MCP server for AI agents

Live

BEARER TOKEN

WEBSITE ANALYTICS

Analytics

Microsoft Clarity gives your agent website behavior analytics: export live insights for the last 24 to 72 hours, ask analytics questions in plain language, and list session recordings filtered by rage clicks, errors, device, or page.

  • Per-user credentials: each call uses the actual user's access token, never a shared bot.
  • Encrypted per-tenant vault: AES-256, resolved at request time, never in LLM context.
  • Scoped before every call: pre-call scope check, 90-day SIEM-exportable audit chain.
Microsoft Clarity logo
Microsoft Clarity
agent · Acme Q3
Run
Which countries had the most rage clicks on our site in the last 24 hours, split by device?
S
microsoftclarity_get_project_live_insights
212ms
Analytics agent
I exported the last 24 hours broken down by country and device. The United States had the most rage clicks, and most of them came from mobile sessions.
Sources: Clarity live insights, last 24 hours
microsoftclarity
1 insights export
18:29
Message Claude...

Tools your website analytics agent reaches for on Microsoft Clarity, scoped per user.

CALL ANY TOOL
3 read-only tools for Microsoft Clarity: export live insights for the last 24 to 72 hours, query the analytics dashboard in plain language, and list session recordings.
microsoftclarity_get_project_live_insights
Get project live insights
Export recent analytics for the Microsoft Clarity project the API token belongs to, covering the last 24, 48, or 72 hours, optionally broken down by up to three dimensions such as browser, device, country, or URL. Returns a JSON array of metric groups, each with a metric name and a list of rows. Metrics include traffic, engagement time, scroll depth, popular pages, dead clicks, rage clicks, quickback clicks, excessive scroll, script errors, and error clicks. Results are in UTC, capped at 1,000 rows, and not paginated. Use this for aggregate behavior and traffic insights. Each project is limited to 10 requests per day and further calls return a 429 error, so request the dimensions you need in a single call.
Parameters
Name
Type
Required
Description
numOfDays
integer
Required
Number of days of data to export, counted back from now. Must be 1 (last 24 hours), 2 (last 48 hours), or 3 (last 72 hours). Example: 1. One of: `1`, `2`, `3`.
dimension1
string
Optional
First dimension to break the insights down by. Must be one of Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, or URL. Leave empty for no breakdown. Example: Country/Region. One of: `Browser`, `Device`, `Country/Region`, `OS`, `Source`, `Medium`, `Campaign`, `Channel`, `URL`.
dimension2
string
Optional
Second dimension to break the insights down by, combined with dimension1. Must be one of Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, or URL. Set dimension1 first when using it. Leave empty for no second breakdown. Example: Device. One of: `Browser`, `Device`, `Country/Region`, `OS`, `Source`, `Medium`, `Campaign`, `Channel`, `URL`.
dimension3
string
Optional
Third dimension to break the insights down by, combined with dimension1 and dimension2. Must be one of Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, or URL. Set dimension1 and dimension2 first when using it. Leave empty for no third breakdown. Example: Browser. One of: `Browser`, `Device`, `Country/Region`, `OS`, `Source`, `Medium`, `Campaign`, `Channel`, `URL`.
microsoftclarity_list_session_recordings
List session recordings
microsoftclarity_query_analytics_dashboard
Query analytics dashboard
Build your Agent
Same auth pattern across LangChain, OpenAI, Anthropic, and Google ADK.
Python · LlamaIndex
import { ScalekitClient } from "@scalekit-sdk/node";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

// Microsoft Clarity tools scoped to this user
const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["microsoftclarity"], toolNames: [
    "microsoftclarity_get_project_live_insights",
    "microsoftclarity_list_session_recordings",
    "microsoftclarity_query_analytics_dashboard"] },
  pageSize: 100,
});

const agent = createReactAgent({ llm, tools });
await agent.invoke({ messages: [{ role: "user", content: "Which pages had the most rage clicks in the last 24 hours?" }] });
import OpenAI from "openai";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const openai = new OpenAI();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["microsoftclarity"] }, pageSize: 100,
});

const res = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "Which pages had the most rage clicks in the last 24 hours?" }],
  tools,
});

// Execute the tool call with the user's vaulted Microsoft Clarity access token
await sk.tools.executeTool(res.choices[0].message.tool_calls[0], "user_123");
import Anthropic from "@anthropic-ai/sdk";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const anthropic = new Anthropic();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["microsoftclarity"] }, pageSize: 100,
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Which pages had the most rage clicks in the last 24 hours?" }],
  tools,
});

// Tool call runs with the user's vaulted Microsoft Clarity access token
await sk.tools.executeTool(msg.content, "user_123");
import { Agent } from "@google/adk/agents";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["microsoftclarity"] }, pageSize: 100,
});

const agent = new Agent({
  name: "analytics_agent",
  model: "gemini-2.5-pro",
  instruction: "Microsoft Clarity tools scoped to this user",
  tools,
});

await agent.run("Which pages had the most rage clicks in the last 24 hours?");
Try these prompts
Copy any prompt into your agent. Each maps directly to a Microsoft Clarity tool. Click to copy, paste into your agent, done.
Live insights
Copy the prompt
Copied
Show traffic and engagement time for the last 24 hours, broken down by device.
Copy the prompt
Copied
Which URLs had the most dead clicks in the last 72 hours?
Copy the prompt
Copied
Break down scroll depth by country and browser for the last 48 hours.
Analytics questions
Copy the prompt
Copied
What were the top browsers on our site in the last 3 days?
Copy the prompt
Copied
Show active time for mobile devices in the United States last week.
Copy the prompt
Copied
Which traffic channels sent the most sessions last month?
Session recordings
Copy the prompt
Copied
List 50 sessions from yesterday with rage clicks on the checkout page.
Copy the prompt
Copied
Find the longest mobile sessions from the last 24 hours.
Copy the prompt
Copied
Show sessions from returning users with JavaScript errors this week.
SEE HOW AUTH WORKS
Each user connects their own Microsoft Clarity access token once; Scalekit sends it with every call. Tokens stay vaulted, every call is scope checked, and every action is logged.
1
Authorize
Your user connects
Microsoft Clarity
once. We tie it to their identity and the meetings they approved — no shared bot account, no org-wide access
Who:
user ‘A’
when:
Once per user
access:
Limited to user
2
Store
Their
Microsoft Clarity
token lives in a vault scoped to them. User A's meetings are never reachable by an agent acting for user B, even on the same connection
vault:
encrypted
scope:
per-user
tokens:
auto-refreshed
3
Resolve
When your agent calls a
Microsoft Clarity
tool, we fetch the right token server-side. It never touches your agent, never appears in the LLM context, never shows up in your logs
speed:
~40ms
check:
before every call
seen by:
nobody
4
Audit
Every
Microsoft Clarity
tool call is logged — who triggered it, which meeting was fetched, what came back. 90 days of history, tied to the user who authorized it
history:
90 days
export:
SIEM-ready
logged:
every call
Test other agents
See the same per-user auth pattern across other analytics connectors.
Engineering Teams
DevOps assistant agent
Polls GitHub for failing checks and stale PRs, opens Linear issues for the ones that need work, and posts a daily digest to Slack. It acts as the engineer, not a shared service account.
Engineering Teams
Engineering standup agent
Pulls commits from GitHub and GitLab, tracks issue movement in Jira, and posts a per-engineer standup brief to Slack. Each engineer's activity is read on their own delegated OAuth.
Engineering Teams
Slack triage
Polls Slack for new messages, classifies bugs and support requests with a LangGraph router, files GitHub issues or Zendesk tickets, and confirms in the thread.
GTM and RevOps Teams
Competitive intelligence briefing agent
Scans Gong calls for competitor mentions, matches each one to its Notion battlecard, and DMs every affected rep a single Slack digest per cycle. Every call runs as the PMM who owns the briefing, never a shared bot.
Test other agents
See the same per-user auth pattern across other analytics connectors.
ENGINEERING
DevOps assistant agent
Poll GitHub for failing checks and stale pull requests, open Linear issues for the ones that need work, and digest to Slack.
ENGINEERING
Engineering standup agent
Pull commits from GitHub and GitLab, track Jira issue movement, and post a per-engineer standup brief to Slack.
ENGINEERING
Slack triage agent
Classify new Slack messages as bugs or support requests, file the GitHub issue or Zendesk ticket, and reply in the thread.
GTM
Competitive intelligence briefing agent
Scan Gong calls for competitor mentions, match each one to its Notion battlecard, and DM every affected rep a single Slack digest.
Why Scalekit
Secure your agent's access. Connectors ship in minutes
01.
Shared tokens break per-user analytics
A shared Microsoft Clarity access token looks fine in a demo. In production every insights export looks like one service account, and you cannot tell which user triggered it. Scalekit resolves the credential of the actual user who triggered the agent, never a shared bot.
// shared key
audit → bot_service_account

// scalekit
audit → user_abc ✓
02.
Authentication is not authorization
03.
Multi-tenancy is architectural
04.
Microsoft Clarity today. Ten connectors tomorrow.
“Our agents act across Salesforce, Gong, Google Drive, and more, on behalf of every customer. Scalekit behind the scenes meant we can keep adding tools without ever rebuilding how credentials or tool calling work.”
Venu Madhav Kattagoni
Head of Engineering / Von
FAQs
Frequently Asked Questions
Does the agent access Microsoft Clarity as the user or as a shared key?
As the user. Each user connects their own Microsoft Clarity access token once, and Scalekit sends it with every call. Audit logs attribute every action to that user, not a shared service account.
Where is the Microsoft Clarity access token stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. To rotate it, the user reconnects with a new access token. Revocation is a single dashboard action. Credentials never appear in prompts, logs, or LLM context.
Can I limit what the agent does in Microsoft Clarity?
Yes. Filter by tool name in listScopedTools to expose only what you want. Scalekit also enforces scope checks before every API call.
What happens when a user revokes Microsoft Clarity access?
The connection is invalidated on the next tool call. Subsequent requests for that user fail closed with a clear error. Other users in the tenant remain unaffected. The event is logged for audit.
Which Microsoft Clarity tools should an agent use?
Microsoft Clarity has 3 read-only tools. Use microsoftclarity_get_project_live_insights for traffic, scroll depth, and click metrics over the last 24 to 72 hours, with up to three dimension breakdowns. Each project allows 10 of these requests per day, so ask for every dimension in one call. Use microsoftclarity_query_analytics_dashboard for plain-language questions over a time range you name, and microsoftclarity_list_session_recordings to sample up to 250 individual sessions by filter.
Start in your coding agent
Up and running in one command
Install the Scalekit skill in your editor of choice. Connector, auth, tools, prompt, all wired up
Claude Code REPL
/plugin marketplace add scalekit-inc/claude-code-authstack
/plugin install agentkit@scalekit-auth-stack
Cursor Code REPL
# ~/.cursor/mcp.json
{
""mcpServers"": {
""microsoftclarity"": {
""url"": ""https://mcp.scalekit.com/microsoftclarity"",
""headers"": { ""Authorization"": ""Bearer $SCALEKIT_TOKEN"" }
}
}
}
Codex Code REPL
# ~/.codex/config.toml
[mcp_servers.microsoftclarity]
url = ""https://mcp.scalekit.com/microsoftclarity""
auth_env = ""SCALEKIT_TOKEN""
Copilot Code REPL
# .vscode/mcp.json
{
""servers"": {
""microsoftclarity"": {
""url"": ""https://mcp.scalekit.com/microsoftclarity"",
""type"": ""http""
}
}
}