fix(config-audit): MCP token callers use 'mcp' kind (v5 F2)

Two MCP enumeration paths in readActiveMcpServers now pass kind='mcp'
to estimateTokens with optional toolCount derived from def.tools array
(populated when callers cache MCP discovery — Step 14 wires that up).

Hook callers keep kind='item' (no schema overhead).

Visible effect: every active MCP server jumps from estimatedTokens=15
to >= 500 (or higher when toolCount is known). The whats-active output
and TOK hotspots now reflect actual MCP cost.

Tests: assert mcpServers[].estimatedTokens >= 500 in fixture.
This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 06:22:54 +02:00
commit ce7c42f517
2 changed files with 13 additions and 2 deletions

View file

@ -528,6 +528,15 @@ describe('readActiveMcpServers', () => {
assert.equal(alpha.enabled, true);
assert.equal(alpha.disabledBy, null);
});
it('estimatedTokens >= 500 for every MCP server (v5 F2)', async () => {
const servers = await readActiveMcpServers(fixture.root);
assert.ok(servers.length > 0, 'fixture should produce MCP servers');
for (const s of servers) {
assert.ok(s.estimatedTokens >= 500,
`${s.name} from ${s.source} has estimatedTokens=${s.estimatedTokens}, expected >= 500`);
}
});
});
// ─────────────────────────────────────────────────────────────────────────