CUT Clarity Server
БесплатноНе проверенRead-only MCP server exposing Microsoft Clarity analytics data as tools for ChatGPT Agent Builder.
Описание
Read-only MCP server exposing Microsoft Clarity analytics data as tools for ChatGPT Agent Builder.
README
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 data
This 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-insights
Clarity'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.
Transport
This project uses the official/broadly used Node MCP SDK package @modelcontextprotocol/sdk.
The remote transport endpoint is:
/mcp
Use your own deployed MCP server URL in ChatGPT Agent Builder, for example:
https://cut-clarity-mcp.your-domain.com/mcp
Do 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 dev
Variables:
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 dev
Health check:
curl http://localhost:3000/health
MCP endpoint:
http://localhost:3000/mcp
Production build:
npm run build
npm start
Typecheck and smoke tests:
npm run typecheck
npm test
npm run smoke-test
Health 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_countsummary- top rows such as
top_pages,top_signals, ortop_friction_pages sample_rowsraw_retained: trueraw_included: false- warnings 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-test
npm 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/health
Expected:
{
"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 start
- Use the public Railway URL plus
/mcpin ChatGPT Agent Builder.
Deployment: Render
- Create a Render Web Service.
- Use build command:
npm install && npm run build
- Use start command:
npm start
- Set 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-server
Deploy:
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_ID
Do 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/mcp
in 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.
from github.com/Creativeuseoftechnology/cut-clarity-mcp-server
Установка CUT Clarity Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/Creativeuseoftechnology/cut-clarity-mcp-serverFAQ
CUT Clarity Server MCP бесплатный?
Да, CUT Clarity Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для CUT Clarity Server?
Нет, CUT Clarity Server работает без API-ключей и переменных окружения.
CUT Clarity Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить CUT Clarity Server в Claude Desktop, Claude Code или Cursor?
Открой CUT Clarity Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare CUT Clarity Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
