Skip to content
New Bring your history: import it from Google Analytics, Plausible, Simple Analytics, Umami, Matomo or GoatCounter, on every plan

MCP analytics

Count the calls AI assistants make to your own MCP server: which tools, from Claude, ChatGPT or Cursor, how they ended and how long they took.

If your product has its own MCP server, people reach it through Claude, ChatGPT, Cursor and other assistants, and none of that shows up as a page view. mettr's server SDKs count each call: the tool, resource or prompt, the client, how the call ended and how long it took, live on the dashboard beside your traffic. MCP analytics comes with the Pro plan.

This page is about your MCP server. To ask mettr itself about your sites from an assistant, see MCP server.

Add it to your server

Laravel

Put the mettr.mcp middleware first on your MCP route, before the auth middleware, so the 401 that sends a client to sign in is counted too. It works with laravel/mcp and any other MCP server on a Laravel route:

Mcp::web('/mcp', AppServer::class)->middleware(['mettr.mcp', 'auth:api']);

The signed-in user is the one auth knows, as for every other event. See Laravel.

Node.js

Wrap the transport of your @modelcontextprotocol/sdk server (Streamable HTTP, SSE or stdio) before you connect it:

import { trackMcp } from '@mettr/node/mcp';

const transport = trackMcp(mettr, new StreamableHTTPServerTransport({ sessionIdGenerator: () => crypto.randomUUID() }), {
    userId: (extra) => extra?.authInfo?.extra?.userId,
});
await server.connect(transport);

A request your auth refuses before the transport sees it is not counted here. An MCP server behind a fetch handler (Hono, a Worker, mcp-handler, Bun or Deno) is wrapped whole instead, outside its auth, so the 401 is counted too:

import { withMcp } from '@mettr/node/mcp';

const handler = withMcp(mettr, mcpHandler, { userId: (request) => userFromToken(request) });

See Node.js.

Next.js

Wrap the route handler that answers MCP (app/mcp/route.ts, Vercel's mcp-handler); the calls go after the response through after():

import { withMcp } from '@mettr/next/server';

export const POST = withMcp(handler, { userId: (request) => userFromToken(request) });

See Next.js.

Python

Wrap the ASGI app of your server (FastMCP's streamable_http_app() or sse_app(), or any other), outside its auth:

from mettr.mcp import McpMiddleware

app = McpMiddleware(mcp.streamable_http_app(), mettr=mettr, user=lambda scope: scope["state"].get("user_id"))

See Python.

Ruby

Rack middleware for the server's path, before its auth; in Rails, config.middleware.use:

config.middleware.use Mettr::Mcp, path: "/mcp"

See Ruby.

Go

Wrap the server's http.Handler outside its auth; under Gin or Echo, mount the wrapped handler:

mux.Handle("/mcp", client.Mcp(requireAuth(server), mettr.McpOptions{User: userID}))

See Go.

PHP

With any MCP server, hand each request and its answer to Mettr\Mcp once the answer has gone:

(new Mettr\Mcp($mettr))->record($requestBody, $status, $responseBody, $milliseconds, $userId, $requestHeaders, $responseHeaders);

See PHP.

WordPress and Statamic

The WordPress plugin counts the calls to the MCP Adapter, or any MCP server on the REST API, with nothing to set up. Statamic uses the Laravel middleware above.

What is sent

Each call is an event, so it shows in the feed as it happens:

Event When
mcp.connect A client connects: initialize, or server/discover since MCP 2026-07-28, or the 401 that sends it to sign in first
mcp.tool A tool is called (tools/call), its name in tool
mcp.resource A resource is read (resources/read), its address without the query in resource
mcp.prompt A prompt is fetched (prompts/get), its name in prompt

Lists, pings and notifications are not sent. Every call carries:

  • client and client_version: what the client says it is, named as people know it: claude-ai is Claude, cursor-vscode is Cursor, openai-mcp is ChatGPT. A client that never says is named by the first word of its user agent.
  • protocol: the MCP version it speaks.
  • outcome: ok; tool_error (the tool answered with an error); error (a JSON-RPC error, its code in error_code); sign_in (401); forbidden (403); throttled (429); or failed (any other HTTP failure). A failure carries its HTTP status.
  • duration_ms: how long the server took to answer.

What a call carried and what came back are never sent. A failed call's message is sent only if you ask (METTR_MCP_ERRORS=true in Laravel, errors: true in Node, Next.js and Ruby, errors=True in Python, Errors: true in Go, errors: true for Mettr\Mcp in PHP; never in WordPress), cut to 200 characters, as it may quote what the person's assistant sent.

Who called

A call comes from the assistant's servers (claude.ai, ChatGPT) or from the person's machine, so its address and user agent say nothing about who the person is. The SDKs do not send them, and mettr does not judge these calls as bots by them, nor place them on the map. A call counts as the signed-in user's: the same visitor as their other events that day. With no user, a client from before MCP 2026-07-28 is told apart by a hash of its session; the session itself never leaves your server. An assistant calling your server is never counted as online on your site.

Staff are left out as everywhere else: by your staff gate in Laravel, staff in Node, Next.js, Python and Ruby, Options.Staff in Go, "Leave out administrators" in WordPress, and the site's excluded user ids.

The MCP panels

Once your server sends calls, Add panel has an MCP group, and the default canvas has them at the bottom:

  • MCP tool calls, MCP users, MCP tool errors and MCP tool time (p75), each against the usual;
  • MCP tool calls by client: stacked bars, Claude, ChatGPT, Cursor and the rest;
  • MCP tools, MCP clients, MCP outcomes, Failing MCP tools and Slowest MCP tools (p75).

They are ordinary panels of the query model, so filters, the builder, widgets, alerts ("tool errors above 20 in an hour") and the MCP server read the same events: mcp.tool grouped by props.tool, props.client or props.outcome, and p75 of props.duration_ms.

On the Free plan

Calls are kept and shown in the feed on every plan, and count toward the plan's events like any other. Reading them (the MCP panels, or any panel, filter or query of mcp.* events) comes with Pro: on Free the dashboard says so, and once the team upgrades, everything already sent is there.

Updated · This page as Markdown · Something unclear? [email protected]

Search the docs, features, comparisons, blog and changelog