Skip to content

v3.8.0 β€” Lazy MCP tools (big token savings)

Choose a tag to compare

@eniz1806 eniz1806 released this 06 Jun 13:52

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 needed
    • mcp_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_search orders results by call frequency (persisted in ~/.kodiqa/mcp_usage.json).

  • /mcp lazy [on|off] β€” toggle it; /mcp list shows the current mode and token trade-off. Set mcp_lazy: false in 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.