← All IntegrationsIntegration

Analytics for Claude Code

Claude Code connects to your MCP servers and invokes tools autonomously as it writes code, fixes bugs, and runs commands. Without analytics, you have no idea which tools it actually calls, how often they fail, or whether your server keeps up.

Wrap your MCP server in one line

BetterMeter wraps your MCP server's tool handlers transparently. Every time Claude Code invokes a tool, the call is logged with tool name, duration, success/failure, and client identifier — without touching your tool logic.

server.ts
import { BetterMeter } from "@bettermeter/node";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";

const server = new McpServer({ name: "my-server", version: "1.0.0" });
const bm = new BetterMeter({ siteId: "my-mcp-server", apiKey: "bm_..." });

// Define your tools as normal
server.tool("search_docs", { query: z.string() }, async ({ query }) => {
  return { content: [{ type: "text", text: await searchDocs(query) }] };
});

// One line — every tool call is now tracked
bm.wrapMcpServer(server);

What Claude Code tells your MCP server

Claude Code identifies itself in the MCP client metadata. BetterMeter extracts this automatically, so you can filter analytics specifically to Claude Code sessions versus other MCP clients like Cursor or Windsurf.

Metrics that matter for tool authors

  • 01 Invocation count per tool — Which tools does Claude Code actually use vs. ignore?
  • 02 Success rate — Are tools returning errors that cause Claude Code to retry or give up?
  • 03 Latency distribution — Slow tools block Claude Code's agentic loop. Find bottlenecks.
  • 04 Token tracking — Optional input/output token counts per invocation for cost estimation.
  • 05 Daily trends — See if tool usage grows as your team adopts Claude Code for more workflows.
  • 06 Error breakdown — Categorize failures by error type to prioritize fixes.

Built for the agentic workflow

Claude Code runs in a tight loop: read code, plan, invoke tools, verify. A single coding session can generate dozens of MCP tool calls. BetterMeter batches these events efficiently and gives you a timeline view of how Claude Code interacts with your server across an entire session. No sampling, no data loss.

Tool Ranking
Most invoked tools
Client Filter
Claude Code vs others
Error Rates
Per tool, per day
Latency P95
Spot slow handlers
Session Timeline
Tool call sequence
Privacy First
No tool inputs logged