Field notes, logs
Your MCP server already logs every tool call
You shipped an MCP server and listed it in a directory. Requests come in. Which tools do they call, from which clients, and how many of them are real? The answer is already passing through your web server.
. 7 min read.
You put an MCP server online a few weeks ago. It has six tools, a page in two directories and a line in your README. The access log grows every day. Each line says the same thing: POST /mcp 200, sometimes 401. Is anyone using it? Which tool? Is it Claude, Cursor or a script?
Until recently a log could not tell you, because everything an MCP request does is inside its JSON body. That changed with the revision of the protocol published on 28 July 2026.
The short answer
Every MCP request over Streamable HTTP now names its method and its tool in HTTP headers, so adding two fields to your access log turns it into a log of tool calls. You get calls, errors and duration per tool, without an SDK and without touching the server's code. What the log cannot see, the client's exact name, tool errors that return HTTP 200 and the signed-in user, takes a few lines in your code. And once you can see callers, you will find that a large share of them are not users at all.
What changed in the MCP spec?
The 2026-07-28 revision of the Streamable HTTP transport mirrors selected fields of the JSON-RPC body into headers, "so that intermediaries (load balancers, gateways, observability tooling) can route and inspect requests without parsing the body". Three of them matter here:
MCP-Protocol-Version, on every request: the revision the client speaks, such as2026-07-28.Mcp-Method, on every request: the JSON-RPC method, such astools/callorresources/read.Mcp-Name, ontools/call,resources/readandprompts/get: the tool name, resource URI or prompt name.
The headers are required, not optional, and a server has to reject a request whose headers disagree with its body. That makes them trustworthy enough to count. One detail: a name that is not safe in a header, such as one with non-ASCII characters, is sent base64 wrapped as =?base64?...?=. Whatever reads the log has to decode it.
How do you log MCP tool calls in nginx?
Add the headers to your log format. nginx exposes any request header as $http_ followed by its name in lowercase with underscores, so this is the usual combined format with four fields on the end:
log_format statsraven '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" '
'rt=$request_time mcp_method="$http_mcp_method" mcp_name="$http_mcp_name" mcp_protocol="$http_mcp_protocol_version"';
access_log /var/log/nginx/access.log statsraven;
A line now reads like this:
203.0.113.24 - - [22/Nov/2026:09:14:02 +0000] "POST /mcp HTTP/1.1" 200 1843 "-" "Claude-User" rt=0.412 mcp_method="tools/call" mcp_name="search" mcp_protocol="2026-07-28"
- Status
- 200, the call went through
- User agent
- Claude-User, a person in Claude
- rt
- 0.412 seconds
- mcp_method
- tools/call, a tool was used
- mcp_name
- search, the tool
- mcp_protocol
- 2026-07-28, a current client
That one line holds most of what MCP analytics needs: who called (the address and user agent), which tool, whether it worked (the status), and how long it took (rt, in seconds). Because the format still starts as the combined format, every other tool that reads your access log keeps working.
Apache, Caddy and Traefik can do the same. Caddy's JSON log already includes request headers, so it needs nothing beyond turning the log on; Traefik needs to be told to keep the three headers. The MCP servers page in our docs has each of them, ready to paste.
What can't the access log tell you?
Three things, and it is worth being clear about them before you rely on the numbers.
The client's own name. The client names itself in the request body, under _meta as io.modelcontextprotocol/clientInfo, not in a header. The log has the user agent, which for some clients is the app (Claude-User) and for many others is the HTTP library underneath (node, python-httpx).
Tool errors. A tool that fails returns a normal result with isError: true, and HTTP 200. The log sees a success. Protocol errors and crashes show up as 4xx and 5xx; a tool that politely says "rate limited" does not.
The person. The log knows an address and maybe an OAuth token it does not log. It cannot tell you which of your users made the call.
All three live in your server's code, where the request has been read. A short wrapper around your tool handlers can time each call, check isError, read the client info and your user id, and send one small JSON event per call. The docs have one for the official TypeScript SDK, for FastMCP and for the official Python SDK. A stdio server, which has no HTTP request and therefore no log, can only be measured this way. Pick one path per server, the log or the events, or every call is counted twice.
The access log
- Method and tool name
- HTTP status
- Duration
- User agent
- Protocol version
Your code adds
- The client's own name and version
- Tool errors returned with isError
- The signed-in user
- Never the arguments or results
What about clients on older MCP versions?
They do not send the headers. A client on a revision before 2026-07-28 still hits /mcp, so its requests count as calls to your MCP endpoint by their path, but there is no method and no tool name. How many of your callers are like that changes week by week as clients update. It is worth watching rather than guessing: the share of calls that carry a tool name tells you how complete your per-tool numbers are, and the protocol version field tells you who is behind.
Who is actually calling your MCP server?
Here is the part that surprises people. Put these fields into the log of a public MCP server and look at a couple of weeks, and most requests to /mcp are often not use. They come from MCP directory crawlers and liveness probes: indexers that list servers, checkers that confirm a server answers, ranking services that test it. They call without signing in, get a 401, and come back a few minutes later. Their user agents say so, with names like mcpbeat, EveryMCP-Probe, AgentRankProbe and a long tail of others.
Real use looks different: fewer requests, signed in, from Claude-User, from node and from curl, calling actual tools.
None of the probes are a problem. A directory that checks your server is doing its job. But if you count them, a server nobody uses looks busy, and a server with five real users looks like it has fifty. So the first thing an MCP analytics tool has to do is sort callers:
- AI apps: Claude, ChatGPT, Cursor and other clients a person sits behind.
- SDKs and scripts: node, python, curl. Often a developer testing, sometimes an agent you built.
- Directories and probes: crawlers, indexers and uptime checks.
- Never signed in: callers that only ever got a 401 or 403.
Then look at real use by default, and at the probes when you want to know who is indexing you.
What is the strongest case for an MCP SDK instead?
A dedicated MCP analytics service with an SDK in your server sees things a log never will. It can record whole sessions, show the arguments an agent sent and the result it got back, group sessions by what the agent was trying to do, and replay them. Services such as AgentCat (formerly MCPcat) and PostHog's MCP Analytics are built around that, and if you are tuning tool descriptions for agents, seeing the arguments is genuinely useful.
The costs are real too. An SDK is another dependency in every server, in every language you write servers in. Arguments and results are often your users' data, and they go to a third party. The hosted services meter usage, AgentCat by session. And a separate tool sees your MCP calls without your website, your sign-ups or your server errors, so "did the people who read our docs page start using the tool?" becomes an export.
Both approaches are reasonable. Many servers will want the cheap, complete answer first: what gets called, by whom, how fast and how often it fails. The access log already has it.
What StatsRaven does with this
StatsRaven reads the log, or the events, or OpenTelemetry spans that follow the MCP conventions, and gives you an MCP page: calls, tool calls, callers, people, error rate, calls refused at sign-in, and p50 and p95 duration, each against the previous period. Tools with their calls, errors, p95 and callers. Clients in the four groups above. Servers, methods and protocol versions. It opens on real use, with tabs for probes and for everything. The landing page shows what it looks like.
When calls carry your user id, they land on the same person as their website visits and sign-up, and a person's card shows the tool calls next to the pages they read. You can ask in chat, or from Claude over StatsRaven's own MCP server: "which tool failed most this week, and with what error?" And with the Alerts add-on, you hear when one tool's errors climb.
It runs on your server, keeps no arguments or results, and is part of StatsRaven Core, $49 once. If you already follow your nginx log with it, as in analytics from nginx logs, the MCP page needs only the new log format.
Your MCP server has been writing this down all along. Now it can say which tool.
Questions
How do I see which tools of my MCP server are called?
Log the Mcp-Method and Mcp-Name request headers in your web server's access log. Since the MCP revision 2026-07-28 every Streamable HTTP request carries them, so each log line names the method and the tool. StatsRaven reads such a log and shows calls, errors and duration per tool.
Do I need an SDK for MCP server analytics?
Not for counts, tools, status and duration: the access log has those. An SDK or a short wrapper in your code adds what the log cannot see: the client's exact name, tool errors returned as HTTP 200 with isError, and the signed-in user.
Why does my MCP server get so many 401 responses?
Directory crawlers and liveness probes call public MCP servers without signing in, often every few minutes. They are turned away at sign-in. On our own servers they were most of the requests to /mcp.
Do older MCP clients send the Mcp-Name header?
No. The headers became required in the 2026-07-28 revision. Calls from older clients still show up by their path, without a method or tool name.
Can I track tool calls of a stdio MCP server?
Not from a log, because a stdio server has no HTTP request. The server can send one small event per call to your analytics instead, from a wrapper around its tool handlers.
Is the client name in an HTTP header?
No. The client sends its name and version in the request body, under _meta as io.modelcontextprotocol/clientInfo. From a log you get the user agent, which is often the HTTP library rather than the app.