Microsoft Clarity MCP
Microsoft Clarity MCP Server enables natural language queries to access Clarity analytics, session recordings, and documentation seamlessly. It integrates with MCP clients for real-time data insights and flexible filtering.
How to Install and Use Microsoft Clarity MCP
Microsoft Clarity MCP is a server tool that helps you use Microsoft Clarity analytics through a simple protocol called MCP. It lets you access session recordings, analytics data, and documentation using plain English questions. Below, you will find easy steps to install and run the Microsoft Clarity MCP server, along with how to connect it to clients like Claude for Desktop.
Step 1: Get Ready with the Prerequisites
Before installing Microsoft Clarity MCP, make sure you have a few things ready:
- You need Node.js version 16 or higher installed on your computer.
- Have a Microsoft Clarity account with your project set up.
- Generate an API token in your Clarity project to allow access to your data.
- Optionally, have an MCP-compatible client like Claude for Desktop if you want to connect to the server.
Once you have these, you’re ready to install.
Step 2: Install Microsoft Clarity MCP Server
You have three ways to install and run Microsoft Clarity MCP. Here are the easiest options:
Option 1: Install via npm (Recommended)
This option installs the MCP server globally on your machine:
npm install -g @microsoft/clarity-mcp-server
After installation, start the server with:
clarity-mcp-server
If you want to provide your Clarity API token right away, add this option when running the server:
clarity-mcp-server --clarity_api_token=your-token-here
Option 2: Run with npx Without Installing
If you don’t want to install anything permanently, you can run the server directly without installation:
npx @microsoft/clarity-mcp-server
To include your API token, use:
npx @microsoft/clarity-mcp-server --clarity_api_token=your-token-here
Option 3: Manual Installation
You can also manually install the tool if you prefer:
-
Clone or download the repository.
-
Install the needed packages by running:
npm install -
Build the project with:
npm run build -
Finally, start the server by running:
npm run start
Step 3: Connect MCP Clients to the Server
After the server is running, you need to configure MCP clients to use it. Here’s a general example of the configuration for any MCP client:
{
"mcpServers": {
"@microsoft/clarity-mcp-server": {
"command": "npx",
"args": [
"@microsoft/clarity-mcp-server",
"--clarity_api_token=your-api-token-here"
]
}
}
}
For Claude for Desktop, follow these steps:
- Open your Claude for Desktop config file:
- Windows:
%AppData%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
- Add the above JSON config to the file.
- Save and restart Claude.
Step 4: Using Microsoft Clarity MCP Server
The server offers multiple useful tools that you can ask through your MCP client, such as:
- Query Analytics Dashboard: Ask questions like “How many Clarity sessions did we get from Egypt in the past 3 days?”
- List Session Recordings: Request filtered lists, e.g., “List the most recent Clarity sessions from mobile devices.”
- Query Documentation Resources: Get instructions like “How to track custom events using Microsoft Clarity?”
Use these simple commands naturally to explore your Clarity data and documentation.
By following these steps, you can easily install and run Microsoft Clarity MCP. This makes your Microsoft Clarity data accessible with natural language through any MCP-compatible tool.