Skip to content
measure

How to add analytics to your MCP server in 5 minutes

Your MCP server ships to registries and Claude Desktop — but do you know if anyone's actually using it? Add Measure in minutes.

Guides3 min readBy Measure team

You published your MCP server to Smithery or the official registry. Maybe you got listed in awesome-mcp-servers. But here’s the question nobody talks about: is anyone actually using it?

GitHub stars tell you interest. Downloads tell you installs. Neither tells you which tools are getting called, how often, or whether users are hitting errors.

Here’s how to instrument your MCP server with lightweight analytics in about 5 minutes.

What you’re tracking

For an MCP server, the useful signals are:

  • Tool invocations — which tools are called, how often
  • Tool errors — which tools are failing and why
  • Active sessions — unique agents using your server over time

You don’t need a 200-line observability setup. A simple event ping on each tool call is enough to get visibility.

The pattern: event pings on tool calls

Measure’s REST API lives at https://lets.measure.events/api/v1 and authenticates with an API key (keys start with mk_). Events go to POST /api/v1/events as JSON with your site key and a path. Here’s a minimal wrapper that sends one per tool call:

TypeScript
// analytics.ts
const MEASURE_API_KEY = process.env.MEASURE_API_KEY; // mk_...
const MEASURE_SITE_KEY = process.env.MEASURE_SITE_KEY; // your site's tracking ID
const MEASURE_URL = "https://lets.measure.events/api/v1/events";

export function trackTool(toolName: string, success: boolean) {
  if (!MEASURE_API_KEY || !MEASURE_SITE_KEY) return; // graceful no-op if not configured

  fetch(MEASURE_URL, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${MEASURE_API_KEY}`,
    },
    body: JSON.stringify({
      site_key: MEASURE_SITE_KEY,
      path: `/tools/${toolName}`,
      referrer: success ? "success" : "error",
    }),
  }).catch(() => {}); // fire and forget, never block tool execution
}

Each tool call is recorded as a hit on /tools/<name>. If you’re sending a lot of them, POST /api/v1/events/batch takes {"events": [...]} so you can buffer and flush.

Wrap your tool handlers

TypeScript
// In your MCP server's tool handler:
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { name, arguments: args } = request.params;

  try {
    const result = await handleTool(name, args);
    trackTool(name, true); // async, non-blocking
    return result;
  } catch (error) {
    trackTool(name, false);
    throw error;
  }
});

That’s it. Every tool call logs to your Measure dashboard — async, non-blocking, zero impact on tool latency.

What you see in the dashboard

After a few hours of usage, you’ll have:

  • Top pages = top tools by call count (/tools/search, /tools/create, etc.)
  • Referrers = success vs error split, so you can see error rate at a glance
  • Traffic series = daily/weekly usage trends

It’s not a full observability platform. But it answers the question “are people actually using this?” — which is the question that matters most when you’ve just shipped.

Using the MCP server for agent-native queries

Measure also ships a native MCP server at https://lets.measure.events/mcp that lets Claude query your analytics directly:

Code
User: "Which of my MCP tools has the highest error rate this week?"

Claude: [calls get_breakdown]
→ "Your /tools/search tool had 47 calls with a 12% error rate.
   /tools/create had 23 calls with 2% error rate."

No dashboard required. Your agent can query its own analytics — and agents can log events too, with the track_event tool.

Get started

  1. Sign up at Measure — 14-day trial, then $29/month for up to 40 sites
  2. Create a site and an API key
  3. Add the wrapper above to your MCP server
  4. Deploy — data starts flowing immediately

The whole thing takes under 10 minutes for an existing MCP server. No SDK, no dependencies, no configuration files.

Let your agent read the numbers.

$29 a month covers 40 sites, then $0.50 a site. 14-day trial.