v3.8.0 β Lazy MCP tools (big token savings)
Lazy MCP tools β large MCP servers no longer cost you tokens every turn. Inspired by mcp2cli and Anthropic's Tool Search.
Added
-
Lazy MCP tool loading (on by default). Instead of injecting every connected MCP tool's schema into every request, Kodiqa exposes 3 fixed meta-tools and discovers tools on demand:
mcp_searchβ find MCP tools by keyword (names + descriptions, ranked by how often you've used them)mcp_tool_schemaβ fetch one tool's full input schema only when neededmcp_callβ execute a tool by name
For a 50-tool MCP server this cuts the per-turn tool-schema cost from ~5,300 to ~310 tokens (~94%), and the cost stays flat no matter how many MCP tools are connected.
-
Usage-aware ranking β
mcp_searchorders results by call frequency (persisted in~/.kodiqa/mcp_usage.json). -
/mcp lazy [on|off]β toggle it;/mcp listshows the current mode and token trade-off. Setmcp_lazy: falsein settings to keep the old always-inject behavior.
Tests
test_mcp_lazy.pyβ manager primitives, lazy vs. non-lazy tool exposure, meta-tool handlers, usage ranking, and routing. 383 total; ruff + CI green.