Communitygithub.com

amplitude/builder-skills

Instrument a Node/TypeScript MCP server with Amplitude's @amplitude/mcp-analytics SDK so tool calls, sessions, and rationale are tracked as Amplitude events. Use this skill whenever the user wants to add Amplitude analytics to their MCP server, mentions "MCP Analytics", "@amplitude/mcp-analytics", "instrument my MCP server", "track MCP tool calls", "add rationale to my MCP tools", or wants agent traffic (Claude, Cursor, ChatGPT) attributed back to Amplitude. Also use for adding UTM tagging to MCP-returned links, or for troubleshooting identity/user_id mismatches between MCP events and web/mobile Amplitude data.

¿Qué es builder-skills?

builder-skills is a Claude Code agent skill that instrument a Node/TypeScript MCP server with Amplitude's @amplitude/mcp-analytics SDK so tool calls, sessions, and rationale are tracked as Amplitude events. Use this skill whenever the user wants to add Amplitude analytics to their MCP server, mentions "MCP Analytics", "@amplitude/mcp-analytics", "instrument my MCP server", "track MCP tool calls", "add rationale to my MCP tools", or wants agent traffic (Claude, Cursor, ChatGPT) attributed back to Amplitude. Also use for adding UTM tagging to MCP-returned links, or for troubleshooting identity/user_id mismatches between MCP events and web/mobile Amplitude data.

Compatible con✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/amplitude/builder-skills/tree/HEAD/engineering-skills/skills/instrument-mcp-server

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Amplitude MCP Analytics Setup

Instruments an MCP server so every tool call becomes an Amplitude event, joinable with the rest of the product's Amplitude data (retention, revenue, web/mobile usage).

The authoritative SDK reference is the package README: https://github.com/amplitude/Amplitude-MCP-Analytics-Node (npm: @amplitude/mcp-analytics). The SDK is in preview and evolves quickly — always fetch the latest README and follow it for installation, API shapes, configuration, and default events. Do not rely on memorized snippets or this skill's summaries for SDK API details; the README wins on any conflict.

There are four steps. Steps 1–2 are required and are documented in the README — this skill tells you which sections to follow and which invariants to verify. Steps 3–4 are strongly recommended and are documented in full here, because they require changes outside the SDK (the server's tool schemas and the product's web app) that the SDK README intentionally does not cover.

Do them in order: Step 1 (tool calls) → Step 2 (identity) → Step 3 (rationale) → Step 4 (UTM, only if the server returns links). Get identity right before calling anything "done" — everything downstream depends on it.

Before you start

Confirm:

  1. This is a Node/TypeScript MCP server built on @modelcontextprotocol/sdk. This SDK doesn't support other languages/runtimes.
  2. The user has (or can get) an Amplitude API key for the project they want events to land in.
  3. Which package manager the repo uses (pnpm/npm/yarn) — adjust the install command accordingly.

Step 1 — Install the SDK and track tool calls (required)

Fetch the README and follow its Install and Quick start sections. Always install the latest published version (e.g. pnpm add @amplitude/mcp-analytics@latest) — never pin a version from memory, and don't reproduce install commands from this skill.

Invariants to verify once wired up (the README explains each):

  • analytics.instrumentServer(server, ...) runs before server.connect() — order matters.
  • Every tool handler is wrapped with analytics.instrumentTool(...). Unwrapped tools aren't tracked. The wrapper has the identical shape to the handler and is a no-op passthrough if the server was never bound, so it's safe to wrap defensively.
  • Default events all carry the [MCP] prefix, so they never collide with the product's existing Amplitude events. See the README's Default events table (and docs/events.md in the repo) for the current event set and properties.

Optional: attach stable custom dimensions (plan tier, team, feature flags) via extra on instrumentTool/instrumentServer — see the README's Custom event properties section.

Step 2 — Get identity right (required, do this before calling Step 1 "done")

MCP events must carry the same user_id the product already sends to Amplitude from web/mobile. Skip this and MCP usage shows up as a disconnected population that can't be joined to product data — this defeats most of the point of the integration.

Follow the README's Identity section for the current API: it offers server-level binding, per-request setIdentity() inside a handler, and an opt-in resolveIdentity mapping from the request's authInfo claims. Pick whichever fits the server's auth model.

One behavior to surface to the user: fully anonymous, anchor-less events are dropped by default (not counted as users) unless explicitly opted in via emitAnonymousEvent: true for aggregate-only tracking — ask before turning this on, since it changes what gets counted.

Step 3 — Capture rationale (recommended)

Unlike a human clicking a button, an agent can tell you why it called a tool. Capturing this turns the data from "what happened" into "what the user was trying to do."

The SDK side is one call (analytics.setRationale(...) — see the README's Rationale section), but the SDK never reads rationale out of tool inputs itself: how the rationale reaches the server is a server-side convention this skill implements. The battle-tested pattern is schema injection — add an optional rationale field to every tool's input schema. Because the parameter is described in the schema agents already read, they fill it in unprompted, across all clients, with zero client-side changes:

// Add to every tool's input schema (zod example):
rationale: z
  .string()
  .optional()
  .describe(
    'Brief explanation of why you are calling this tool and what ' +
    'you expect to learn from the result.',
  ),

Then read it inside the instrumented handler and hand it to the SDK:

analytics.instrumentTool(async (args, extra) => {
  if (typeof args.rationale === 'string') {
    analytics.setRationale(args.rationale);
  }
  return doWork(args);
}, { name: 'search' });

Making the field optional means nothing breaks when an agent omits it. It is emitted as the reserved [MCP] Rationale property (truncated to 1,000 chars; last write wins). Worth doing on every tool, not just a sample.

Step 4 — UTM-tag outbound links (recommended, only if the server returns URLs)

This step is entirely outside the SDK — it changes how the server builds URLs and depends on the product's web-side analytics. It is not covered in the SDK README.

If any tool response includes a link (dashboard, doc, product page), tag it before it leaves the server so click-throughs are attributable to MCP/agent traffic instead of showing up as direct:

function addUtmParams(url: string, clientName?: string): string {
  const u = new URL(url);
  u.searchParams.append('utm_source', 'mcp');
  u.searchParams.append('utm_medium', 'referral');
  // The connected client (e.g. "Claude", "Cursor"), if you know it:
  u.searchParams.append('utm_content', clientName ?? 'unknown');
  return u.toString();
}

Route every URL-building path in tool responses through one central function like this — a single untagged link breaks the attribution story for that flow.

Prerequisite (tell the user this explicitly): this only works if their web analytics captures UTM params on page-view events (or whatever event their site fires on landing). Amplitude's Browser SDK 2 does this by default — see Track marketing attribution (UTM, referrer, and click ID parameters are captured out of the box). If they use a custom page-view tracker, they need to confirm UTM values land on those events too, or there's nothing to join the MCP-tagged clicks against.

Relevant Amplitude documentation:

After instrumenting

Once events are flowing, point a coding agent at Amplitude's published analyze-mcp-server skill to run intent clustering and surface tool-call error patterns by intent. (If this project has the mcp-intent-error-analysis skill installed, that's the one — use it once the user has data flowing and wants to analyze it, rather than duplicating that analysis here.)

Common mistakes to flag

  • Following stale API snippets instead of the current README — fetch it fresh; the SDK is in preview and moves fast.
  • Installing a pinned/older version instead of the latest release.
  • Calling instrumentServer() after server.connect() — must be before.
  • Wrapping some tool handlers but not others — every tool needs instrumentTool.
  • Sending a user_id that doesn't match the one used on web/mobile — breaks joinability, the whole point of the integration.
  • Turning on emitAnonymousEvent: true without the user understanding it inflates aggregate counts with anchor-less traffic.
  • Forgetting the UTM prerequisite (web-side capture) and assuming tagging links alone is sufficient.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

amplitude/builder-skills

Performs deep analysis of a specific Amplitude chart to explain trends, anomalies, and likely drivers. Use when a metric looks unusual, investigating a spike or drop, or understanding the "why" behind numbers.

amplitude/builder-skills

Deeply analyze Amplitude dashboards by analyzing key charts, surfacing top areas for concern and takeaways, identify anomalies, then explain changes using customer feedback trends.

amplitude/builder-skills

Designs A/B tests with proper metrics and variants, analyzes running or completed experiments, and interprets results with statistical rigor. Use when setting up experiments, checking experiment status, analyzing results, or making ship decisions.

amplitude/builder-skills

Synthesizes customer feedback into actionable themes including feature requests, bugs, pain points, and praise. Use when planning product roadmap, understanding user sentiment, investigating specific issues, or preparing voice-of-customer reports.

amplitude/builder-skills

Analyze MCP server usage instrumented with Amplitude's MCP Analytics SDK: break usage and errors down by tool, read the rationales within each tool to see what callers are trying to do, and produce a prioritized write-up of actionable fixes. Use this skill whenever the user asks to understand how their MCP server is being used, what agents/users are trying to do with it, why tool calls are failing, what to fix or improve in their MCP server, or asks for an "MCP usage report", "tool error analysis", "intent analysis", "rationale clustering", or "MCP insights". Also trigger when the user mentions [MCP]-prefixed events, tool rationale, tool call errors, or just finished instrumenting their MCP server and wants to see what the data says. Requires the Amplitude MCP connector.

amplitude/builder-skills

Read lost deals and churned accounts from your CRM, extract reasons clustered by theme (missing features, pricing, competitors, UX), and write a prioritized weekly analysis with product improvement recommendations. Use before roadmap planning or to build the case for prioritizing retention work.

amplitude/builder-skills

Creates Amplitude charts from natural language descriptions, handling event selection, filters, groupings, and visualization choices. Use when you know what you want to measure but prefer not to build the chart manually.

amplitude/builder-skills

Guide an Amplitude user through building a custom agent by suggesting use cases grounded in their role and data, shaping the idea into a well-formed spec, and generating a ready-to-run Global Agent deeplink that creates it. Use to create, build, or set up a custom agent, automate a recurring analysis, or put a repeated report on a schedule.

amplitude/builder-skills

Builds comprehensive Amplitude dashboards from requirements or goals, organizing charts into logical sections with appropriate layouts. Use when creating a complete dashboard from scratch or assembling existing charts into a cohesive view.

amplitude/builder-skills

Monitors all active and recently completed experiments across Amplitude projects, triages them by importance, then runs deep analysis and reporting on the most impactful ones. Use when the user asks to "check on experiments", "experiment status", "experiment review", "what experiments are running", or wants a periodic experiment health report.

amplitude/builder-skills

Pull Intercom tickets and Slack support messages from the past 7 days, classify each signal, enrich with CRM data (ARR, plan, renewal), score by customer value and churn risk, and output a tiered priority report saved to Drive. Use when you need a fast, data-driven view of what support signals matter most.

amplitude/builder-skills

Use this skill whenever a user wants to improve existing pages on their website to get cited more by AI models — whether they say "our pages aren't getting cited", "improve this page for AI visibility", "which of our pages should we update", "make this article more cite-worthy", "our competitors are getting cited instead of us", "update our content for AI search", or any variation where the goal is improving an existing asset rather than creating something new. This skill pulls owned pages from AI Visibility, identifies which ones have citation potential but are underperforming, compares them against the external pages that are winning citations on the same topics, and produces section-level rewrites or a full-page update — then pushes the revision to the CMS as a draft. Trigger even if the user just says "help me get cited more" or "why is [competitor] getting cited instead of us".

amplitude/builder-skills

Use this skill whenever a user wants to win AI citations on prompts that competitors currently dominate — whether they say "competitors are getting cited instead of us", "we're losing on these prompts", "how do I outrank [competitor] in AI answers", "find prompts where we should be winning", "create content to beat [competitor]", or any variation where the goal is capturing AI share on prompts a competitor currently owns. This skill pulls competitor visibility data from AI Visibility, identifies the specific prompts where competitors win and Amplitude is absent, clusters them by intent, and produces targeted comparison pages, alternatives content, or rebuttal assets — then pushes drafts to CMS. Trigger on any mention of competitor, prompt hijack, outrank, or "why is [competitor] getting cited instead of us".

amplitude/builder-skills

Use this skill whenever a user wants to turn AI Visibility data into published content — whether they say "find content gaps", "what should we write about", "which topics have low visibility", "help me get cited by AI models", "create a blog post from our AI Visibility gaps", "we're losing to competitors on these prompts", or any variation where they want to go from AI visibility weakness to a draft article, landing page, or FAQ. This skill connects directly to Amplitude AI Visibility data (topics, prompts, visibility scores, citations, competitor data, full LLM responses and sources) and produces a publish-ready content brief plus full article draft. If the user mentions CMS (WordPress, Webflow, Contentful, Sanity, HubSpot, Ghost, Shopify), also trigger this skill to push the draft directly. Trigger even if they just say something vague like "what content should we create?" in an AI Visibility context.

amplitude/builder-skills

Use this skill whenever a user wants to test content variants before publishing to find which one will get cited most by AI models — whether they say "which version of this content will perform better", "test this article before we publish", "simulate how AI will respond to this content", "which angle should we use", "generate content variants and pick the winner", "run a simulation before publishing", or any variation where the goal is data-driven content selection rather than gut-feel publishing. This skill takes an identified content opportunity, generates 2–3 distinct variants with different angles or structures, scores them against actual AI model responses from AI Visibility, references the Simulate Changes feature for pre-publish validation, and produces a clear recommendation on which variant to publish — then pushes the winner to CMS. Trigger on any mention of "simulate", "test variants", "which performs better", "A/B content", or "before we publish".

amplitude/builder-skills

Use this skill whenever a user wants to understand which external sources are being cited by AI models on topics relevant to their brand, and wants to create content that will outrank those sources — whether they say "what sources are AI models citing", "why is [third-party site] being cited instead of us", "we want to be the definitive source on X", "build something that gets cited more than G2 or TechRadar", "create an authoritative asset", or any variation where the goal is producing a new reference asset (definition page, benchmark, methodology, glossary, comparison hub) designed to beat existing top-cited sources. This skill analyzes AI Visibility source data, reverse-engineers what makes top-cited pages authoritative, and produces a superior source asset — then pushes it to CMS as a draft. Trigger on any mention of "sources", "third-party citations", "authoritative content", "definitional pages", or "outrank".

amplitude/builder-skills

Instruments a pull request with Amplitude analytics that conform to the project's existing taxonomy. Reads the tracking plan via the Amplitude MCP server (events, properties, naming conventions), analyzes the PR diff to find the few user actions genuinely worth tracking, detects the codebase's SDK and tracking patterns, and adds instrumentation that matches both. Optionally (opt-in) stages new events and properties on an Amplitude tracking-plan branch for data-governance review. Use when asked to "instrument this PR", "add analytics to this change", "add tracking", "add Amplitude events", "instrument this feature", or "what should I track here".

amplitude/builder-skills

Diagnoses product health by cross-referencing Amplitude analytics (dashboards, charts, funnels, feedback, AI agent analytics), optionally Datadog (errors, latency, stack traces), and optionally Slack (qualitative feedback, bug reports, feature requests). Identifies what's broken, what's working, and what to do about it — with root causes, not just symptoms. Use when asked to "diagnose my product", "what's going on", "product health check", "what's broken", "where are users struggling", "give me a product diagnosis", or "what should I focus on".

amplitude/builder-skills

Turn one or more meeting transcripts, notes, or Slack threads into concise takeaways and clear action items with DRIs. Works with a single meeting or a batch from the whole week.

amplitude/builder-skills

Summarizes B2B account health by analyzing usage patterns, engagement trends, risk signals, and expansion opportunities. Use for customer success reviews, renewal preparation, QBRs, or account prioritization.

Skills relacionados