CUT Clarity MCP Server
OfficialClick 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., "@CUT Clarity MCP Serverwhat are the live insights for my project?"
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.
CUT Clarity MCP Server
cut-clarity-mcp-server is a small, deployable, read-only Model Context Protocol server for exposing Microsoft Clarity export data to ChatGPT Agent Builder.
The intended architecture is:
ChatGPT Agent Builder
-> your public MCP server URL
-> Microsoft Clarity API/export dataThis is intentionally separate from the WordPress plugin AI Laser Studio. Do not put this server inside WordPress, and do not point ChatGPT Agent Builder at WordPress for Clarity data. WordPress can later show status or link to this external MCP server, but secrets and analytics middleware stay outside WordPress.
What It Exposes
The server registers five MCP tools:
list_available_exportsget_project_live_insightsexport_project_summaryexport_page_metricsexport_event_metrics
All tools are read-only. There are no write, mutation, CRUD, or frontend features.
Microsoft Clarity endpoint paths are centralized in src/config/clarityEndpoints.ts. The server uses the confirmed Microsoft Clarity Data Export API endpoint:
GET https://www.clarity.ms/export-data/api/v1/project-live-insightsClarity's Data Export API supports numOfDays=1, 2, or 3; it does not support arbitrary historical date ranges. Tools that accept start_date and end_date convert ranges ending today into numOfDays. Unsupported historical ranges return a structured unsupported_date_range error instead of pretending to fetch data.
Related MCP server: Search Console MCP
Transport
This project uses the official/broadly used Node MCP SDK package @modelcontextprotocol/sdk.
The remote transport endpoint is:
/mcpUse your own deployed MCP server URL in ChatGPT Agent Builder, for example:
https://cut-clarity-mcp.your-domain.com/mcpDo not enter https://www.clarity.ms in ChatGPT Agent Builder. ChatGPT Agent Builder should call your MCP server, and this server calls Clarity server-side with the Bearer token.
Environment Variables
Copy .env.example to .env for local development.
npm install
cp .env.example .env
npm run devVariables:
PORT: local/server port, default3000NODE_ENV:developmentorproductionCLARITY_API_TOKEN: Microsoft Clarity Bearer tokenCLARITY_BASE_URL: defaults tohttps://www.clarity.msCLARITY_HTTP_TIMEOUT_MS: timeout for each upstream Clarity HTTP request, default15000MCP_TOOL_TIMEOUT_MS: hard timeout for each MCP tool call, default20000MCP_TOP_PAGES_LIMIT: maximum page rows returned to the MCP client, default25MCP_TOP_SIGNALS_LIMIT: maximum signal/friction rows returned to the MCP client, default25MCP_SAMPLE_ROWS_LIMIT: maximum sample rows returned to the MCP client, default10MCP_INCLUDE_RAW_DEFAULT: whether bounded raw samples are included by default, defaultfalseMCP_MAX_RESPONSE_MODE: response mode, currentlycompactDEFAULT_PROJECT_ID: optional fallback project id for tool callsDEFAULT_TIMEZONE: defaults toEurope/AmsterdamLOG_LEVEL:debug,info,warn, orerrorMCP_SERVER_API_KEY: optional auth key for MCP requests
No secrets are committed. Tokens are only read from environment variables and are never returned in tool responses or logs.
Optional MCP Server Auth
If MCP_SERVER_API_KEY is set, every request to /mcp must include:
Authorization: Bearer <MCP_SERVER_API_KEY>GET /health remains public, but only returns boolean configuration status. If your ChatGPT Agent Builder setup cannot send an extra Authorization header, leave MCP_SERVER_API_KEY empty and avoid broadly sharing the MCP URL. The Clarity token still remains server-side.
Local Development
npm install
cp .env.example .env
npm run devHealth check:
curl http://localhost:3000/healthMCP endpoint:
http://localhost:3000/mcpProduction build:
npm run build
npm startTypecheck and smoke tests:
npm run typecheck
npm test
npm run smoke-testHealth Check
GET /health returns:
{
"ok": true,
"service": "cut-clarity-mcp-server",
"version": "0.1.0",
"clarity_configured": true,
"default_project_configured": true
}The health endpoint does not call Microsoft Clarity. It is intentionally fast and does not expose secrets.
Clarity Endpoint Configuration
Endpoint strings are defined only in src/config/clarityEndpoints.ts.
Each endpoint has:
enabledpathmethodconfirmednote
The current mappings are:
get_project_live_insights: confirmed endpoint withnumOfDays=1export_project_summary: confirmed endpoint without dimensionsexport_page_metrics: confirmed endpoint withdimension1=URLexport_event_metrics: confirmed endpoint withdimension1=URL, normalized for friction metrics
Endpoint strings should not be scattered through the codebase. If Microsoft adds more granular export endpoints later, update this single file and the matching tool handler.
Compact MCP Responses
The server fetches the full Clarity response from Microsoft and keeps it in memory long enough to normalize, aggregate, and build top lists. The default MCP response sent back to ChatGPT Agent Builder is compact and does not include full raw arrays.
Default tool responses include:
toolproject_idperiodwhen applicablerow_countsummarytop rows such as
top_pages,top_signals, ortop_friction_pagessample_rowsraw_retained: trueraw_included: falsewarnings such as
raw_not_included,limited_to_top_n, andsample_rows_limited
Every tool accepts optional include_raw: true. Even then, the server returns only a bounded raw_sample, not an uncontrolled multi-megabyte raw export. Full raw payloads are never logged.
Local Tool Smoke Checks
Run static checks and unit smoke tests:
npm run typecheck
npm test
npm run smoke-testnpm run smoke-test calls each MCP tool handler with the local environment and prints a compact table with status, duration_ms, and any structured error_code. It is designed to prove tools return quickly. If DEFAULT_PROJECT_ID or CLARITY_API_TOKEN is missing, the smoke test should show structured errors such as missing_project_id or missing_clarity_token, not hang.
When Clarity does not respond within CLARITY_HTTP_TIMEOUT_MS, tools return:
{
"ok": false,
"error": {
"code": "clarity_upstream_timeout",
"message": "The Clarity API did not respond within 15000 ms",
"status": 504
}
}To verify the deployed service is configured:
curl https://your-cloud-run-url/healthExpected:
{
"ok": true,
"clarity_configured": true,
"default_project_configured": true
}In ChatGPT Agent Builder, call list_available_exports first. It should show configured and confirmed exports, not placeholder not_configured mappings.
Deployment: Railway
Push this repository to GitHub.
Create a Railway project from the GitHub repo.
Set environment variables in Railway:
CLARITY_API_TOKENCLARITY_BASE_URLDEFAULT_PROJECT_IDif desiredDEFAULT_TIMEZONEMCP_SERVER_API_KEYif your MCP client supports it
Use start command:
npm startUse the public Railway URL plus
/mcpin ChatGPT Agent Builder.
Deployment: Render
Create a Render Web Service.
Use build command:
npm install && npm run buildUse start command:
npm startSet the same environment variables listed above.
Use the public Render URL plus
/mcpin ChatGPT Agent Builder.
render.yaml is included as a starting point. It does not contain secrets.
Deployment: Google Cloud Run
Build and push an image:
gcloud builds submit --tag gcr.io/PROJECT_ID/cut-clarity-mcp-serverDeploy:
gcloud run deploy cut-clarity-mcp-server \
--source . \
--region europe-west1 \
--allow-unauthenticated \
--set-env-vars NODE_ENV=production,CLARITY_BASE_URL=https://www.clarity.ms,CLARITY_HTTP_TIMEOUT_MS=15000,MCP_TOOL_TIMEOUT_MS=20000,MCP_TOP_PAGES_LIMIT=25,MCP_TOP_SIGNALS_LIMIT=25,MCP_SAMPLE_ROWS_LIMIT=10,MCP_INCLUDE_RAW_DEFAULT=false,MCP_MAX_RESPONSE_MODE=compact,DEFAULT_TIMEZONE=Europe/Amsterdam,DEFAULT_PROJECT_ID=YOUR_CLARITY_PROJECT_IDDo not pass PORT as an environment variable on Cloud Run; Cloud Run reserves and sets it automatically. Set CLARITY_API_TOKEN and optional MCP_SERVER_API_KEY with Google Cloud Secret Manager or your preferred Cloud Run secret workflow.
Use:
https://your-cloud-run-url/mcpin ChatGPT Agent Builder.
Safety Notes
All MCP tools are read-only.
Authorization headers and tokens are never logged.
Raw Clarity payloads can be returned by tools, but environment secrets are not included.
Logs contain only safe metadata such as tool name, project id, dates, status-like metadata, row count, and duration.
Inputs are validated with
zodplus explicit date range checks.Requests to Clarity use a timeout, limited retries, and exponential backoff for
429and5xxfailures.
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.
Latest Blog Posts
- 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/Creativeuseoftechnology/cut-clarity-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server