mcp2cli is a Python tool that converts any MCP server or OpenAPI spec into a CLI at runtime with no code generation. It addresses the token bloat problem where LLM agents pay the full cost of injecting all tool schemas into context on every turn. By letting agents discover tools on-demand via --list (~16 tokens/tool) and --help (~80-200 tokens/tool), it reduces token consumption by 96-99% compared to native MCP injection. It supports MCP HTTP/SSE, MCP stdio, and OpenAPI specs (JSON/YAML), works with any LLM provider, and includes spec caching with configurable TTL. Detailed benchmarks show a 120-tool MCP platform over 25 turns saves over 357,000 tokens.

11m read timeFrom github.com
Post cover image
Table of contents
InstallAI Agent SkillUsageCLI referenceThe problem: tool sprawl is eating your tokensWhat mcp2cli addsThe numbers: how much context do you actually save?How it worksDevelopmentAcknowledgmentsLicense

Sort: