This Microsoft Clarity MCP Server provides natural language access to Clarity analytics data, session recordings, and documentation through MCP-compatible clients like Claude Desktop and VS Code.
Key Capabilities:
Query Analytics Dashboard: Retrieve analytics data and metrics using natural language queries, including traffic metrics, user behavior insights, and performance statistics for 1-3 days of historical data
Access Multiple Metrics: Fetch metrics such as Scroll Depth, Engagement Time, Traffic, Popular Pages, Browser usage, Device types, Operating Systems, and Country/Region statistics
Filter by Dimensions: Apply up to 3 dimensions to filter data including Browser, Device, Country/Region, OS, Source, Medium, Campaign, Channel, and URL
List Session Recordings: Browse and filter session recordings by URLs, device types, browser, OS, country, city, and user interactions (e.g., JavaScript errors or high click counts)
Query Documentation: Search Microsoft Clarity documentation for setup guides, features, usage instructions, troubleshooting tips, and integration guidance with step-by-step screenshots
Natural Language Interface: Ask questions in plain English without needing to learn complex API syntax or query languages
Real-Time Data Access: Fetch the latest analytics data and insights from your Clarity projects on-demand
Flexible Authentication: Provide API tokens via command line arguments, environment variables, or tool parameters
Supports configuration with Claude for Desktop on macOS systems, using a specific configuration file path at ~/Library/Application Support/Claude/claude_desktop_config.json.
Runs as a Node.js application, using the Microsoft Clarity data export API to fetch analytics data with customizable filters and metrics.
Available as an npm package for easy installation and execution, with support for providing API credentials through command line arguments.
Built with TypeScript, providing type-safe interaction with the Microsoft Clarity analytics data export API.
Microsoft Clarity MCP Server
This is a Model Context Protocol (MCP) server for the Microsoft Clarity. It allows you to access your session recordings, project analytics, and documentation from Clarity using Claude for Desktop or other MCP-compatible clients.
Key Features
Analytics Data Access: Query your Microsoft Clarity analytics data including traffic metrics, user behavior insights, and performance statistics
Session Recording Retrieval: Access and analyze session recordings to understand user interactions and identify optimization opportunities
Natural Language Querying: Ask questions in plain English to get insights from your data - no need to learn complex query syntax or API endpoints
Flexible Data Filtering: Filter results by various dimensions such as browser, device, country, and many more
Real-Time Data Access: Fetch the latest analytics data and insights from your Clarity projects on-demand
Documentation Integration: Get quick answers and guidance from Microsoft Clarity documentation directly within your workflow
Seamless MCP Integration: Works natively with Claude for Desktop, Visual Studio Code, and other Model Context Protocol (MCP) compatible clients
Setup and Installation
Prerequisites
Node.js v16 or higher
A Microsoft Clarity account and API token
Any MCP-compatible client (Claude for Desktop, etc.)
Installation
Option 1: Install via npm (recommended)
You can install and run this package directly using npm:
Option 2: Run with npx without installing
You can run the server directly using npx without installing:
With either option, you can provide your Clarity API token using the --clarity_api_token parameter:
Option 3: Manual Installation
Clone or download this repository
Install dependencies:
npm installBuild the TypeScript code:
npm run buildRun the server:
npm run start
Extension/Plugin Installation
Visual Studio Code Extension
Click the button above to install the Microsoft Clarity MCP server directly in Visual Studio Code.
Claude Desktop Plugin
Install from Claude's extension gallery:
Open Claude Desktop
Navigate to File → Settings → Extensions
Search for Microsoft Clarity
Click Install to add the extension
Configure your API Token: Follow the instructions in the API Token section to retrieve and set it up correctly.
Configuration
You can provide the Clarity data export API token in two ways:
Command Line Arguments:
npx @microsoft/clarity-mcp-server --clarity_api_token=your-tokenTool Parameters: Provide
tokenas a parameter when calling theget-clarity-datatool
Configuring MCP Clients
Generic MCP Client Configuration
MCP clients typically require configuration to connect to the server. Here's a general example of how to configure an MCP client:
The specifics of where and how to add this configuration will depend on your specific MCP client.
Claude for Desktop Configuration
To configure Claude for Desktop to use this server:
Open your Claude for Desktop configuration file:
Windows:
%AppData%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the configuration shown in the generic example above
Save the configuration file and restart Claude for Desktop
Server Usage
The server exposes various tools that you can call from any MCP client. Just ask naturally and keep each request focused on one thing.
Query Analytics Dashboard
Name:
query-analytics-dashboardDescription: Retrieves analytics data and metrics from your project's dashboard using a simplified natural language search query.
Examples:
How many Clarity sessions did we get from Egypt in the past 3 days?
What are the most used browsers in my Clarity project?
Show me traffic metrics from my Clarity project for the last week
List Session Recordings
Name:
list-session-recordingsDescription: Lists your project's session recordings based on a specified filtering criteria. The filters allow you to narrow down the recordings by various fields such as URLs, device types, browser, OS, country, city, and more.
Examples:
List the most recent Clarity sessions from mobile devices
Show the top 5 Clarity sessions with the highest number of user clicks
Get Clarity recordings where users encountered JavaScript errors
Query Documentation Resources
Name:
query-documentation-resourcesDescription: Retrieves snippets from Microsoft Clarity documentation to find answers to user questions including step-by-step screenshots for setup guides, features, usage, troubleshooting, and integration instructions.
Examples:
How to track custom events using Microsoft Clarity?
How many labels can I add to a recording in Microsoft Clarity?
API Token
Getting Your API Token
To generate an API token:
Go to your Clarity project
Select Settings → Data Export → Generate new API token
Provide a descriptive name for the token
Save the generated token securely
Privacy Policy
For information about data privacy and usage, please refer to the Microsoft Clarity Privacy Policy.
License
This project is licensed under the MIT License.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server built with mcp-framework that allows users to create and manage custom tools for processing data, integrating with the Claude Desktop via CLI.Last updated -225
- AsecurityAlicenseAqualityModel Context Protocol server that enables Claude Desktop (or any MCP client) to fetch web content and process images appropriately.Last updated -1169MIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables Claude to load CSV files and execute JavaScript data analysis scripts for advanced data exploration and insights generation.Last updated -28MIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that allows integration with Claude Desktop by creating and managing custom tools that can be executed through the MCP framework.Last updated -31