mcp-usage

io.github.Rixtayz由 GitHub 帳號 Rixtayz 發布v0.1.1更新於 Nov 5, 2026

Find out which MCP servers you actually use: local, read-only audit of Claude Code transcripts.

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

唯讀的 MCP 伺服器兼命令列工具,稽核本機 Claude Code 工作階段紀錄,顯示已連線的 MCP 伺服器中哪些真正被使用、閒置、連線失敗或等待授權。

可以做什麼
  • 彙總 MCP 伺服器使用情況:每個伺服器一列,含狀態、提供的工具、工作階段數、呼叫次數、錯誤率、預估結果 token 與最近使用時間
  • 列出已連線但從未被呼叫、連線失敗或等待授權的伺服器
  • 檢視單一伺服器詳情,包括各工具呼叫次數、錯誤與結果大小
  • 提供依優先順序排列的清理建議:中斷連線、修復或移除、授權或移除、排查錯誤、結果過大
適用情境
當你在 Claude Code 中累積了大量 MCP 伺服器、想決定保留或中斷哪些時使用;也適合在某個伺服器表現不穩定時查看各工具的錯誤證據。只適用於存放 Claude Code 工作階段紀錄的同一台機器。
執行需求
需要 Node.js 22 或更新版本,透過 npx 從 npm 套件 @rixtay/mcp-usage 在本機執行(stdio 傳輸)。需要本機已有 Claude Code 工作階段紀錄。無需帳號、API 金鑰或設定;Claude 設定目錄預設為 $CLAUDE_CONFIG_DIR 或 ~/.claude,可用 --dir 覆寫。
安裝前請注意
會讀取本機 Claude Code 工作階段紀錄,但輸出僅限伺服器名稱、工具名稱、計數、位元組總量與時間戳記。它不會修改你的 MCP 設定,中斷伺服器仍需手動操作。token 數字為粗略估算,工作階段紀錄格式並非公開 API 可能失效,且 Claude Code 會刪除舊紀錄,較長的回溯期間只能看到磁碟上仍保留的部分。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 mcp-usage,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-usage

[CI] [npm] [Node] [License: MIT] [MCP Registry]

[mcp-usage: find out which of your MCP servers you actually use]

A small, focused MCP server and CLI that reads your local Claude Code transcripts and tells you, for every MCP server you have connected, whether it is actually used, sits idle in every session, fails to connect, or has been waiting for authorization for weeks — and what to disconnect.

Built for one job: answer "which of my MCP servers should I keep?" — locally, read-only, without ever exposing a word of your conversations.

Tools

Four tools, all read-only:

ToolWhat it does
usage_summaryOne row per server: status, tools exposed, sessions, calls, error rate, estimated result tokens, last use
unused_serversServers that were connected but never called, failed to connect, or are waiting for authorization
server_detailsOne server in full, with per-tool calls, errors and result size (accepts the id or the label, case-insensitive)
recommendationsA prioritized action list: disconnect, fix or remove, authorize or remove, investigate errors, heavy results

Design choices:

  • Exact, not guessed. Claude Code already records, in every session, which MCP tools were available and which servers failed or needed auth. "Available but never used" is a set difference over your own logs, not a heuristic.
  • Private by construction. No network code at all. The output holds server names, tool names, counts, byte totals and timestamps — never prompts, responses, tool inputs, tool outputs, file paths or error messages. The test fixtures plant SECRET_* markers everywhere private content lives in a real transcript, and the tests assert none of them reach the library, the CLI or the MCP output.
  • Fast on big histories. Transcripts are streamed line by line and lines that cannot matter are skipped before JSON.parse: ~360 MB of history (including a 90 MB session) scans in about 3 seconds.
  • Hygiene, not billing. Cost analyzers (ccusage, agent-cost-mcp, …) tell you how many tokens and dollars you spent. This tells you which servers earn their place.
  • Every tool ships a strict input schema and MCP annotations (readOnlyHint, idempotentHint) so hosts can auto-approve them.

[How mcp-usage works: local transcripts are streamed through a parser into per-server stats, shown as a CLI report or MCP tools]

Requirements

  • Node.js 22 or newer.
  • Claude Code (CLI, desktop app or IDE extension) with some session history on this machine. Nothing else: no account, no API key, no configuration.

1. Run the report

No install needed, npx fetches the package from npm (@rixtay/mcp-usage, the installed command is mcp-usage):

bash
npx -y @rixtay/mcp-usage

Or from a clone:

bash
git clone https://github.com/Rixtayz/mcp-usage.gitcd mcp-usagenpm install && npm run buildnode dist/bin/cli.js
OptionPurpose
--since <days>Look back this many days (default 30)
--project <path>Only scan projects whose path contains this text
--min-sessions <n>Sessions before an unused server is flagged (default 5)
--dir <path>Claude config directory (default: $CLAUDE_CONFIG_DIR or ~/.claude)
--jsonPrint the full report as JSON, including per-tool stats

Text output truncates long lists; --json always contains everything.

2. Connect to Claude Code

bash
claude mcp add --scope user --transport stdio mcp-usage -- npx -y @rixtay/mcp-usage serve

3. Connect to Claude Desktop / Cowork / any MCP client

mcp-usage is listed in the official MCP Registry as io.github.Rixtayz/mcp-usage, so clients that browse the registry can install it by name. Otherwise, configure it by hand:

Edit ~/Library/Application Support/Claude/claude_desktop_config.json on macOS (or %APPDATA%\Claude\claude_desktop_config.json on Windows), reachable through Settings → Developer → Edit Config.

json
{  "mcpServers": {    "mcp-usage": {      "command": "npx",      "args": ["-y", "@rixtay/mcp-usage", "serve"]    }  }}

If the host cannot find npx (it may not inherit your shell PATH), use absolute paths instead: "command": "/absolute/path/to/node", "args": ["/absolute/path/to/mcp-usage/dist/bin/cli.js", "serve"].

The server reads Claude Code's transcripts wherever it runs, so it only makes sense in local sessions, on the machine where you use Claude Code.

4. Example prompts

  • "Which of my MCP servers should I disconnect?"
  • "Which servers have been waiting for authorization the longest?"
  • "Playwright seems flaky. Which of its tools fail the most?"
  • "Did I use anything other than Context7 in the last 7 days?"

Typical flow: recommendations → the assistant proposes a cleanup list, you confirm → server_details on anything surprising → you disconnect the servers yourself. The tools never touch your MCP configuration.

What it reports

Each server gets one status:

StatusMeaning
usedCalled at least once in the window
unusedIts tools were available, but nothing ever called them
failedNever exposed a tool; Claude Code reported a connection failure
needs-authNever exposed a tool; waiting for authorization

Recommendations, in priority order:

ActionRule
disconnectUnused, and available in ≥ 5 sessions (--min-sessions)
fix-or-removeFailed to connect in ≥ 3 sessions
authorize-or-removeWaiting for authorization in ≥ 3 sessions
investigate-errors≥ 5 calls and ≥ 30 % of them failed
heavy-resultsResults average ≥ 10,000 estimated tokens per call

Development

bash
npm test          # vitest: name parsing, streaming parser, aggregation, rules, CLI, MCP tools over an in-memory transportnpm run typechecknpm run inspect   # MCP Inspector against the built server

Layout:

src/bin/cli.ts             entry point: `mcp-usage` prints the report, `mcp-usage serve` serves stdiosrc/cli.ts                 argument parsing and outputsrc/server.ts              builds the McpServer and registers the four toolssrc/analyze.ts             options → report; the one function both shells callsrc/parser.ts              streaming JSONL reader → typed eventssrc/aggregate.ts           events → per-server statssrc/recommend.ts           stats → prioritized recommendationssrc/report.ts              text table renderingsrc/scan.ts                transcript discovery (--since, --project)src/adapters/claude-code.ts  the only client-specific code, behind a small ClientAdapter interfacesrc/names.ts               `mcp__<server>__<tool>` parsing and server id mangling

Stack: @modelcontextprotocol/sdk v1, zod v4, nothing else at runtime. Design notes: docs/DESIGN.md.

Things worth knowing

  • The transcript format is not a public API. It is parsed defensively — every field optional, unknown records ignored, malformed lines counted and skipped — but a future Claude Code release can still break it. Tested against Claude Code 2.1.233 – 2.1.274.
  • Token figures are estimates: result bytes ÷ 4, text only. Transcripts record no per-result token count, and image results are not counted.
  • Tool names are split on the first __ after the mcp__ prefix. Server ids can contain underscores, hyphens, dots or be a bare UUID, and tool names can contain __ themselves, so a naive split("__") miscounts.
  • The same connector can appear under two names — a readable one in the CLI, a UUID in the desktop app. They are not merged.
  • Servers bundled with the Claude desktop app (ccd_*) are reported but never flagged for disconnection: you cannot remove them.
  • Claude Code deletes old transcripts, so a long --since window only sees what is still on disk.
  • Claude Code only, for now. Adapters for other clients are welcome.

Contributing

Bug reports, fixes and adapters for other MCP clients are welcome: see CONTRIBUTING.md. If Claude Code updates and the report suddenly looks wrong, open a bug with your Claude Code version. Found a way the tool could leak transcript content? Please report it privately, as described in SECURITY.md.

Release history: CHANGELOG.md.

License

MIT

來源:README.md,提交 4f8dc39

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Oct 1, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分