Pulling insights from Microsoft Clarity doesn’t have to be a manual, time-consuming process. By connecting Clarity to an MCP (Model Context Protocol) server via Cursor, you can automatically generate detailed monthly reports, visualize key metrics, and save professional PDFs—without writing extensive code.
Here’s a step-by-step guide to setting it up and getting your first automated report.
Step 1: Generate Your Clarity API Token
Before connecting Clarity to Cursor, you’ll need an API token:
- Log into your Microsoft Clarity account.
- Select a project you want to export data from.
- Navigate to Settings > Data Export.
- Click Generate New API Token, name it for your project, and copy it to a secure location.
Keep this token secure. Anyone with access can pull data from your account.
Step 2: Set Up an MCP Server in Cursor
Cursor makes it easy to connect to Clarity with minimal coding. Here’s how:
- Open Cursor and go to Settings > MCP.
- Click Add New MCP Server.
- Paste the following configuration, replacing placeholders with your project name and API token:
{
"mcpServers": {
"clarity-[yourprojectname]": {
"command": "npx",
"args": ["-y", "@microsoft/clarity-mcp-server"],
"env": {
"CLARITY_API_TOKEN": "[YOUR_API_TOKEN]"
},
"autoStart": true
}
}
}
- Save and enable the MCP server.
- For multiple websites, create separate MCP servers to avoid data conflicts. (Use the same code as above, but use a different name and the proper API Token. Cursor will likely replace the one you used before if you do this.)
- Run a test prompt and verify the answer to ensure that it is running properly. E.g. “Show me dead clicks on November 8th, 2025”
Step 3: Create a Monthly Performance Report Prompt
Cursor uses prompts to generate reports. A well-structured prompt ensures that all metrics, comparisons, and visualizations are captured.
Here’s a comprehensive example for a month-over-month report:
Metrics to Include:
- Scroll Depth (%)
- Time on Page (active and total minutes)
- Pages per Session
- Dead Clicks (%)
- Quick Backs (%)
- Rage Clicks (if available)
- Excessive Scrolling (if available)
Visualizations Required:
- Month-over-month bar charts
- Trend indicators (↑/↓)
- Color coding (green = improvement, red = decline, yellow = neutral)
- High-resolution PNG charts (300 DPI)
Report Structure:
- Executive Summary: Key highlights and findings
- Detailed Findings: Scroll depth, time on page, dead clicks, quick backs
- Top 5 Pages Analysis: Current and previous month metrics with comparisons
- Top Pages Comparison Table: Side-by-side comparison, highlighting improvements and declines
- Additional Metrics: Rage clicks, excessive scrolling
- Next Steps & Recommendations
- Methodology: Data sources and calculation methods
Technical Requirements:
- Python libraries: matplotlib, reportlab, pandas, requests
- Output: A4-sized, professional PDF with embedded charts and formatted tables
- Save markdown version for reference
Step 4: Run Your Monthly Report
- Install the required libraries:
pip3 install matplotlib requests reportlab pandas
- Configure the date ranges in your prompt. For example: current month = October 2025, previous month = September 2025.
- Input your API token and run the Cursor prompt.
- Cursor will generate all charts and compile a PDF report in your designated folder.
Step 5: Analyze and Share Insights
Your report will include:
- Metric comparisons month-over-month
- Top pages’ performance cards with color-coded indicators
- Recommendations for pages with high dead clicks or quick backs
- Visual trend indicators for each key metric
Tip: Fine-tune your prompts to adjust visualizations and colors or focus on specific pages for your clients or stakeholders.
Step 6: Output Files
All generated files should be saved in a dedicated folder, e.g., clarity_report_output/:
- Clarity_Report_[MONTH]_[YEAR].pdf — Complete report with embedded charts
- Clarity_Report_[MONTH]_[YEAR].md — Markdown version for reference
- *.png — Individual chart files for presentations or client sharing
Best Practices to Follow
To get the most out of your Clarity MCP setup and ensure accurate, reliable reporting, it’s important to follow a few best practices:
- Ensure the right API token is used for your MCP server when working with different websites.
- Regularly check Microsoft Clarity’s documentation for API updates and limits.
- Use AI tools like Copilot or Claude to help refine your prompts for more accurate reports.
- Keep your API tokens secure and never share them publicly.
- Make sure you’re using the latest version of Cursor.
Why This Workflow Matters
Automating Clarity reporting with MCP and Cursor saves hours of manual work, reduces human error, and ensures stakeholders get timely, actionable insights. You can focus on interpreting trends and improving your website rather than manually gathering data.
By following these steps, anyone—regardless of coding experience—can generate professional, automated reports that make Clarity data actionable and easy to share.
Celeste Gonzalez is a recognized thought leader in local SEO and testing. As the Director of RooLabs, the experimental SEO testing division at RicketyRoo, she pioneers data-driven strategies that push the boundaries of “traditional SEO.” A passionate advocate for advancing the SEO industry, Celeste is a writer, speaker, and Course Creator for the Local SEO curriculum on the Wix SEO Hub, empowering businesses and professionals with actionable strategies for local search success.
