feat(config-audit): MCP tool-count detection with manifest fallback (v5 M1) [skip-docs]

readActiveMcpServers now resolves tool count via:
  1. In-config tools array
  2. Cached tools/list at \$HOME/.claude/config-audit/mcp-cache/<name>.json
  3. node_modules/<pkg>/package.json (resolved from npx <pkg>)
  4. Fallback: { toolCount: null, toolCountUnknown: true }

estimateTokens uses detected toolCount (heavy server > light server).

New fixture: mcp-tool-heavy/ with mocked node_modules/mcp-heavy/package.json (20 tools).

576 → 580 tests, all green.
This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 07:02:08 +02:00
commit 1422daf895
3 changed files with 148 additions and 7 deletions

View file

@ -0,0 +1,6 @@
{
"mcpServers": {
"heavy": { "command": "npx", "args": ["mcp-heavy"] },
"light": { "command": "npx", "args": ["mcp-light"] }
}
}