@clamp-sh/mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Analytics MCP server for Clamp Analytics. Gives Claude, Cursor, VS Code Copilot, Windsurf, Cline, and any other Model Context Protocol client live access to your traffic, pages, events, revenue, errors, funnels, cohorts, and alerts — and the tools to create funnels and metric alerts from the conversation.
> **Using Cursor, VS Code, Claude Code, or Claude Desktop?** Install the hosted Remote MCP from your Clamp dashboard in one click — auth happens automatically, no API key to paste, no config files to edit. Open a project, go to the Installation tab, and pick your editor. This npm package is the stdio path for CI, headless agents, custom clients, and self-hosted Clamp instances.
What your agent can do
Once connected, your agent can answer questions like:
- "How's traffic this week?"
- "Why did pageviews drop on Tuesday?"
- "Which referrers drove the most signups?"
- "Compare US vs Germany conversion this month"
- "Create a funnel from /pricing to signup to purchase"
- "Alert me when bounce rate on /pricing goes above 70%"
- "What did Hacker News visitors actually read?"
- "Run the weekly report"
Each question maps to one or two MCP tool calls. The agent picks the right tool, runs the query, and returns the answer in chat — no dashboard tab, no copy-paste.
Why an MCP server for analytics
A dashboard answers the questions you anticipated when you built it. An MCP server lets the agent answer the ones you didn't. Same data, different access pattern: the agent can compose tools, follow up on its own answers, and run the diagnostic queries you'd manually click through.
Tools are typed (outputSchema per MCP protocol 2025-06-18), so client-side validation works before any call lands. Per-tool descriptions name the use case and a representative example, so agents pick the right tool on the first try.
Setup
For one-click install in Cursor / VS Code / Claude Code / Claude Desktop, use the Clamp dashboard. For stdio (CI, headless agents, custom clients, self-hosted instances), pick your client below.
VS Code / Copilot
Add to .vscode/mcp.json in your project:
Claude Code
Claude Desktop and Cursor
Both clients use the same shape — drop this into claude_desktop_config.json or .cursor/mcp.json:
API key
Get your API key from the Clamp dashboard under **Settings → API Keys**. Keys are scoped to a project and start with sk_proj.
Tools
Free (all plans)
| Tool | What it does |
|---|---|
| traffic.overview | Pageviews, visitors, sessions, bounce rate, avg duration. Period comparison included. |
| traffic.timeseries | Any core metric over time with automatic granularity (visitors, sessions, bounce rate, avg duration, or event counts). |
| traffic.compare | Compare any metric across two arbitrary periods. Returns absolute and percent delta. |
| traffic.live | Visitors active in the last N minutes plus their top pages, referrers, and countries. |
| breakdown | Group visitors and pageviews by any dimension: pathname, referrer_host, country, city, region, device_type, browser, browser_version, os, os_version, entry_page, exit_page, channel, or any UTM field. |
| pages.engagement | Per-page metrics with view: summary, engagement (adds engagement seconds and bounce rate), sections (per-section view counts for one pathname; needs the section-views SDK extension). |
| events.list | Custom event counts with property filtering and grouping. |
| events.observed_schema | The actual fired-event signature with per-property type observations. Diff against a local event-schema.yaml to surface schema drift. |
| events.property_values | Top distinct string-typed values a property has taken on a specific event. Use to discover the value space before defining a cohort filter or running events.list with property=. |
| revenue.sum | Sum Money-typed event properties. Split by currency, group by any dimension, switch to first-touch via attribution_model. Drill-in filters: plan, product, first_touch_dim + first_touch_value. |