mcplytics — Usage, Health and Security for a Remote MCP Server
Open-source wrapper for a remote MCP server: which tools get called, which apps call them, how each call ended, how long it took, and the signs of an attack. Plus a check that tells you what to fix. No SDK, no backend, and it never stores what people asked.
Overview
In plain terms: you built an MCP server and put it online. AI apps now call it: Claude, Cursor, ChatGPT, scripts. So do scanners, and sometimes people looking for a way in. mcplytics answers the plain questions about that traffic:
- Which tools are used, and which never are?
- Which apps call, and how often?
- How many calls fail, and do they fail because a tool broke or because the request was wrong?
- How fast is it? Median and slowest 5%.
- Is anyone probing it?
And one command looks at your server from outside, the way a stranger would, and tells you what to fix.
It wraps the one function that answers your server's HTTP requests. You don't change your tools, add an SDK or run a backend. It never stores what people asked: no arguments, no answers, no error text, no IP addresses.
What the report looks like
mcplytics: 21 calls, 2026-10-20 19:05 to 2026-10-20 19:05 UTC
failed 4.8% · p50 1 ms · p95 4 ms
Tools
name calls failed p50 p95
search 12 0% 2 ms 11 ms
get_item 6 0% 1 ms 2 ms
delete_everything 1 100% 0 ms 0 ms
list_categories 1 0% 2 ms 2 ms
Apps calling (client name)
name calls failed p50 p95
claude-code 9 11% 1 ms 11 ms
cursor 7 0% 1 ms 4 ms
openai-mcp 4 0% 1 ms 4 ms
python-httpx 1 0% 2 ms 2 msA test run. delete_everything doesn't exist; someone tried anyway.
Which app, checked
Any app can call itself anything. If your server signs callers in with OAuth, it already knows something better: the client ID on the token it accepted. Hand mcplytics that ID and it records the app behind it.
| The client ID is | mcplytics records |
|---|---|
| a web address the app publishes about itself | that address's domain, e.g. app.example.com. The sign-in server fetched it and checked it, so the domain is the app's own |
| an ID you gave out yourself | the name you gave it |
| any other ID, usually one the app made for itself | (unlisted), because it points to one install, not an app |
The ID itself is never stored. How to set it up is in the README.
Is anyone probing it?
Each call can carry a short warning code. mcplytics stores the code, never what was in the request.
| Code | What happened |
|---|---|
unknown_tool |
someone called a tool your server never listed, like delete_everything |
foreign_origin |
a web page on another site sent the request |
token_in_url |
a password or token was put in the web address, where logs keep it |
hidden_text |
your tool list contains characters a person can't see but an AI reads |
tools_changed |
your tool list changed. Was that your deploy? |
The report counts each code and shows which apps raised it.
Check your server
npx mcplytics check https://your.server/mcpIt sends about a dozen small, harmless requests and prints what to fix. It never runs one of your tools. It checks sign-in, requests from other websites, error messages that show your code, session IDs, and the tool list itself: hidden characters, text that gives the AI orders, and tools that say "read-only" but are named delete_….
We pointed it at a server built with the official MCP SDK on Express, with no extra settings. It found two things to fix: the server answers requests from any website, and its error messages show stack traces.
It can only see what a stranger sees. Passing it is a good start, not a guarantee.
Install
npm install mcplyticsOn Cloudflare Workers, wrap your handler and bind an Analytics Engine dataset named MCPLYTICS:
import { mcplytics, analyticsEngine } from 'mcplytics';
const handler = async (request, env, ctx) => { /* your MCP endpoint */ };
export default { fetch: mcplytics(handler, { sink: analyticsEngine() }) };On Node with Express (the official SDK's usual setup), add one line after express.json():
import { mcplyticsNode, jsonl } from 'mcplytics/node';
app.use('/mcp', mcplyticsNode({ sink: jsonl('mcplytics.jsonl') }));A server in Python, Go or another language: put mcplytics in front of it with proxy(). The README shows how.
On Deno or Bun, write events to a local file:
import { mcplytics } from 'mcplytics';
import { jsonl } from 'mcplytics/node';
Bun.serve({ fetch: mcplytics(handler, { sink: jsonl('mcplytics.jsonl') }) });Then read the report:
npx mcplytics report mcplytics.jsonl --days 7How a call can end
A tool that fails still answers with HTTP 200, so status codes alone can't tell you much. mcplytics reads the answer:
| Outcome | Meaning |
|---|---|
ok |
a result |
tool_error |
the tool ran and failed (isError: true) |
protocol_error |
a JSON-RPC error: unknown tool, bad arguments |
http_error |
refused before any answer, e.g. 401 sign-in required |
no_response |
a stream that closed before answering |
unread |
a stream over 8 MB: mcplytics stopped reading before the answer, so it doesn't guess |
crash |
your handler threw |
A call for a method your server doesn't have (error -32601) is listed apart, not counted as a failure. Directory scanners send lots of them to learn what a server speaks; on one public server they made a 7.8% failure rate out of 0.3%.
The full list is in the README.
What it can't tell you
- App names are what apps send. A client names itself in the request, and any name can be claimed. Good enough for counting traffic, never for deciding who gets in. With OAuth, the checked client ID above is the better tell.
- It watches; it doesn't block. It never changes or delays an answer, so a warning code tells you something happened, not that it was stopped.
- Remote servers only. A local server talks to its app over stdio, with no HTTP request to wrap.
- No intent. It doesn't ask the model why it called a tool. That would mean adding a field to every tool.
Tech Stack
- Language: JavaScript, zero dependencies, web APIs only
- Runs on: Cloudflare Workers and Pages, Deno, Bun, Node
- Works with: any Streamable HTTP MCP server: the official SDK (Express or web-standard), another framework, by hand, or another language through a proxy
- Storage: Cloudflare Analytics Engine, a JSONL file, or your own callback