knowsuchagency/mcp2cli
Turn any MCP, OpenAPI, or GraphQL server into a CLI — at runtime, with zero codegen
What it solves
mcp2cli eliminates the need for manual code generation or writing custom wrappers when wanting to interact with APIs via a command-line interface. It specifically addresses the problem of "token waste" for AI agents; instead of passing massive tool schemas to an LLM in every turn, agents can use this CLI to discover and call tools dynamically, significantly reducing token consumption.
How it works
The tool acts as a runtime bridge that introspects various API definitions and turns them into executable CLI commands without any build step. It supports four primary sources:
- MCP Servers: Connects via HTTP/SSE or stdio transport.
- OpenAPI Specs: Parses JSON or YAML specifications to generate commands.
- GraphQL Endpoints: Introspects endpoints to auto-generate queries and mutations.
- Local/Remote Files: Can read specs from URLs or local paths.
It includes a "Bake" mode to save complex connection and authentication settings into named configurations, allowing users to call them with a simple @name prefix. It also tracks tool usage locally to rank the most frequent tools, helping LLMs find the right tool faster with fewer tokens.
Who it’s for
- AI Agent Developers: Those using agents (like Claude Code or Cursor) who want to give their agents the ability to interact with any API without bloating the context window.
- Power Users/DevOps: People who need a quick, unified way to interact with multiple different API standards (MCP, OpenAPI, GraphQL) from a terminal.
Highlights
- Zero Codegen: Turns APIs into CLIs at runtime.
- Broad Compatibility: Supports MCP (HTTP/SSE/stdio), OpenAPI, and GraphQL.
- Token Efficiency: Features usage-aware tool ranking and "TOON" encoding to minimize LLM token costs.
- Robust Auth: Built-in support for OAuth (including PKCE and manual callbacks for headless hosts) and secret management via environment variables or files.
- Bake Mode: Saves connection settings to create persistent, named CLI wrappers.
Related
- Project
- Project
- Project
- Dispatch
- Project