
mcpwatch
io.github.Sreelal727由 GitHub 帳號 Sreelal727 發布v0.4.1更新於 Nov 3, 2026
Records MCP tool calls and itemises the token cost each server adds to your context.
概覽
本機 MCP 記錄器,記錄編碼代理與各 MCP 伺服器之間的流量,並列出每個伺服器為上下文增加的 token 成本。
- 可以做什麼
- 查詢帳單:各伺服器的 token 成本、可節省項目排序與建議移除的伺服器
- 排查故障與健康狀態:最近的失敗呼叫及其參數,以及崩潰、緩慢或破壞協定的伺服器
- 檢索歷史:查找某工具過去的呼叫,並取出單次呼叫的完整請求與回應 JSON
- 本機記錄流量:透過 stdio 代理或 HTTP 反向代理錄製,並提供即時 tail、本機儀表板與 HTML 工作階段匯出
- 適用情境
- 當代理上下文很快被佔滿,或懷疑已安裝的 MCP 伺服器佔用 token 卻未被使用時適用。也可用來判斷該移除哪些伺服器、把哪些限定在特定專案,以及診斷出錯或行為異常的伺服器。
- 執行需求
- 以本機程序執行,透過 npx 或全域 npm 安裝(需要 Node.js)。初始化會改寫用戶端的 MCP 設定,把 stdio 伺服器改為經由代理,並需重新啟動用戶端。不需帳號、API 金鑰或網路服務;資料保存在本機 SQLite 檔案中。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 mcpwatch,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
👁 mcpwatch
Every MCP server you've installed is charging you tokens on every single session. See the bill — then cut it.
mcpwatch records the real traffic between your coding agent (Claude Code, Codex, Cursor, Claude Desktop) and your MCP servers, then itemises what that setup actually costs you in context — and tells you exactly what to delete.
One command. All local. Zero config. No account, ever.
Here's what nobody tells you when you install an MCP server: its tool definitions get injected into your agent's context at the start of every single session, whether you use that server or not. A big vendor integration with 50 tools can cost you 15,000+ tokens before you type a word. You pay it again on the next session, and the next.
On top of that you're paying for tool responses that return 200 kB when you needed one row, calls that fail and get retried, and agents re-fetching things they already had.
None of it shows up anywhere. mcpwatch records the actual bytes on the wire and turns them into an itemised bill.
See your number in ten seconds
No setup, no restart, no waiting. This starts each MCP server you already have configured, asks it for its tool list the way your client does, measures it, and shuts it down:
That's the fixed cost, and it's knowable without recording anything.
Then find out what you actually use
Which of those tools you call does need real traffic. Instrument once, work normally for a day, and ask:
Look at those first two numbers together: $21.81 of that $24.70 monthly bill is tool definitions — the cost of merely having servers configured, before your agent does a single useful thing. And the largest one has never been called.
That's the point of the whole tool. Not "here is a dashboard, go find something," but delete this one line from your config and stop paying 10,762 tokens every session for a server you have never once used.
The projection uses your observed startup rate from your recording — it isn't a guess, and it doesn't appear at all until there's enough history to be honest about.
(Install once with npm i -g @sreelal727/mcpwatch and every command is just mcpwatch ….)
Your agent can read the bill too
init also registers mcpwatch as an MCP server, so your agent gets these tools with no
extra setup:
So you can just ask, in the client you already use:
You: my context keeps filling up, what's eating it?
Agent: (calls
token_costs) Yourgithubserver loads 46 tool definitions — 10,762 tokens — into every session, and you haven't called it once in the last 30 days. That's about 1.4M tokens over the window. Your filesystem server also re-read identical files 132 times. Want me to take github out of your config?
The descriptions are written as trigger conditions, so the agent reaches for them on its
own — recent_failures after a failed tool call, token_costs when you mention context
or cost — instead of waiting to be told they exist.
It also tells you what's broken
The same recording answers the reliability questions, in one command:
mcpwatch tail streams calls live, one line each. Everything takes --json, so agents
with only shell access (Codex in a VS Code terminal, hooks, CI) can read it too. And
mcpwatch ui opens a local dashboard on 127.0.0.1 when you'd rather look yourself.
What you get
- A number in ten seconds —
mcpwatch auditprices your configured servers with no instrumentation, no client restart, and no waiting for traffic. - An itemised token bill —
mcpwatch costprices every server's per-session tax, projects it forward from your own usage, and ranks what to remove: unused servers, bloated tool lists, oversized responses, repeated calls, failed calls. - Agent-readable recording —
token_costs,recent_failures,server_health,find_calls,get_callas MCP tools, plus--jsonon everything for agents that only have a shell. Your agent stops guessing about its own tool calls. - Live dashboard — sessions stream in as your agent works: call timeline, status dots, latency bars, full request/response JSON inspection, filtering, dark/light.
- Every call recorded — paired request/response with duration and status
(
ok/rpc_error/tool_error), including in-band tool failures that clients often swallow silently. - Misbehaving-server detection — servers that write logs to stdout corrupt the MCP protocol; mcpwatch records those lines and flags them instead of breaking.
- Secret redaction, on by default — API keys, bearer tokens, JWTs, and
password-shaped JSON fields are scrubbed from the stored copy (never the live
stream).
--no-redactto disable,MCPWATCH_REDACT_EXTRAto add patterns. - Session export —
mcpwatch export <id>produces one self-contained HTML file: a shareable, scriptless bug report of exactly what happened. - HTTP servers too —
mcpwatch http <url>is a recording reverse proxy for Streamable HTTP servers (SSE responses included). - Your data, your disk —
mcpwatch gcfor retention; delete~/.mcpwatchand it's gone. No SaaS, no accounts, no telemetry, ever.
How it works
mcpwatch init rewrites each stdio server entry in your client's config to route
through mcpwatch run. The proxy pipes bytes through untouched and parses a copy of
the stream — capture is wired independently of passthrough, so even if recording fails,
your agent keeps working. Passthrough is sacred is design principle #1, enforced in
code and covered by end-to-end tests that drive a real MCP client through the proxy.
init also adds mcpwatch itself to your client as an MCP server, which closes the loop:
the recorder becomes a tool the agent can call. It is never wrapped by its own proxy —
otherwise every question the agent asked about the traffic would become more traffic.
How it compares
(All good tools — this is about which job each one is for. Inspector is great for poking a server you're developing; mcpsnoop is a solid terminal viewer; SaaS platforms add fleet features on their infrastructure.)
Commands
FAQ
How accurate are the token numbers? They're estimated from the recorded byte counts
at roughly 4 characters per token, not run through a real tokenizer — shipping one would
mean a native dependency in a CLI people install globally. They're precise enough to
rank what's expensive and to compare servers against each other, which is what you act
on. Don't reconcile an invoice with them. The dollar figures apply a rate you can set
with --rate (default $5 per million tokens), and the assumed rate is always printed.
Will this lower my hosting or database bill? Not directly — mcpwatch is a local recorder, not infrastructure. What it does show is redundant work hitting your backends: repeated identical calls, oversized queries, retry loops. Fixing those cuts API quota and database load. But the honest headline is context tokens, and that's where the savings actually are.
Does the recording itself cost tokens? No. Capture is a byte-level tee on your machine; nothing is added to any prompt. The agent tools only enter context when the agent actually calls one, and their answers are capped and summarised rather than dumped.
Overhead? The proxy is a byte-level tee; parsing and storage happen on copies, off the protocol's critical path. If capture ever fails (full disk, whatever), it disables itself and traffic keeps flowing.
Is my data safe? It never leaves your machine: SQLite in ~/.mcpwatch, dashboard
bound to 127.0.0.1, secrets redacted at write time by default. The agent tools read
that same redacted local database — giving your agent the recording doesn't send it
anywhere it wasn't already going.
My client wasn't auto-detected. Run mcpwatch connect for a copy-paste snippet for
Claude Code (claude mcp add), Codex (~/.codex/config.toml), Cursor, or any other MCP
client. Nothing about the agent tools is Claude-specific — it's a plain MCP server.
Does the agent read my whole history every time? No. The tools return capped, summarized answers (a dozen rows, previewed arguments) and default to a recent time window. Full payloads only come back when the agent asks for one specific call.
What about guardrails? That's v1.0: allow/deny rules per server/tool, confirmation prompts for dangerous calls, and tool-description drift alerts (the "rug pull" attack). The recorder you're using today is the foundation for it. See ROADMAP.md.
Development
Monorepo: packages/cli (proxy + CLI + dashboard server),
packages/ui (React dashboard, builds into the CLI package).
Demo data for hacking on the UI:
Contributions welcome — see the roadmap for where things are headed.
License
來源:README.md,提交 5d0b03e
工具
0版本歷史
1- v0.4.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分