mcp2cli
knowsuchagency
Turn any MCP, OpenAPI or GraphQL server into a CLI at runtime - zero codegen, token-efficient.
What is mcp2cli?
mcp2cli dynamically exposes MCP servers, OpenAPI specs and GraphQL endpoints as command-line interfaces with no code generation. It supports MCP HTTP/SSE with OAuth, stdio mode for local servers, usage-aware tool ranking, saved connections, and a TOON encoding claimed to cut tool-schema token overhead by 96-99% (project's own claim).
mcp2cli in depth
Every agent that talks to external tools pays a recurring tax: the full JSON schema of each tool is shipped to the model on every turn, and large MCP servers, OpenAPI specs or GraphQL endpoints can flood the context window before any real work begins. The usual fix is to write a bespoke wrapper for each service, which means code generation, maintenance and another thing to keep in sync. mcp2cli takes a different route. It is a small Python command-line tool that turns any MCP server, OpenAPI specification or GraphQL endpoint into a usable CLI at runtime, with no generated code. You point it at an endpoint, and the available operations become subcommands you can call directly from a shell, a script or an agent loop.
mcp2cli works by introspecting the target at the moment you run it. For MCP it speaks both HTTP/SSE and stdio, launching local servers as subprocesses; for OpenAPI it parses JSON or YAML specs, local or remote; for GraphQL it uses introspection to discover queries and mutations. What is distinctive is the focus on token economy. The project ships a TOON encoding (token-optimized output notation) that it says delivers 40 to 60 percent fewer tokens than JSON for large uniform arrays, and it claims the overall approach can save 96 to 99 percent of the tokens otherwise wasted on tool schemas each turn. It also tracks tool usage locally and ranks list output by frequency, plus a bake mode that saves named connections with auth so you can reuse them via an @name shorthand.
The natural audience is anyone scripting or automating MCP and API calls where a full MCP client would be overkill. Concretely, that means an engineer wiring an MCP tool into a CI job, a shell pipeline that needs one call to an internal service, or an agent loop where you want deterministic, inspectable tool invocations rather than a persistent connection. AI coding agents such as Claude Code or Cursor can use it to discover and call external APIs without bloating their context, and the project even publishes an optional skill package to teach agents how to drive it. OAuth support, including authorization code with PKCE and headless client credentials, plus token refresh and caching, makes it practical against real authenticated services rather than just local toys.
The caveats are worth taking seriously. The headline token savings depend heavily on how verbose a given server's schema is: a lean API will not see anything close to the upper figures, and the 96 to 99 percent number is the project's own claim, framed around schema overhead rather than total payload. mcp2cli is a CLI shim, not a persistent agent runtime, so there is no bidirectional streaming and no stateful session between calls; each invocation stands alone. Caching defaults to a one-hour TTL, GraphQL requires introspection to be enabled, stdio mode depends on the server being available in PATH, and the interactive OAuth flow needs a browser. The repository also shows a thin commit history relative to its reported star count, so rapid star acquisition is something to watch when judging maturity.
Against a hosted option like Zapier MCP, mcp2cli sits at the opposite end: it is a local, open MIT-licensed utility you run yourself, with no service to sign up for and no vendor holding your credentials, but also none of the managed connectors, retries or hosted convenience. Adopt it when you are comfortable in a terminal and want a fast, scriptable bridge to MCP, OpenAPI or GraphQL services inside CI, shell automation or agent loops, especially where trimming schema tokens matters. Hold off if you need stateful sessions, bidirectional streaming or a long-lived agent connection, since that is explicitly outside its design. Given the young commit history, pin a version and verify the token claims against your own schemas before betting a production workflow on it.
Pros & Cons
Pros
- Zero-codegen - any MCP or OpenAPI service becomes a CLI immediately
- Token-efficient TOON encoding helps agents that call many tools repeatedly
- OAuth self-healing and saved connections make it production-usable
Cons
- Thin commit history relative to star count - watch rapid star acquisition
- Token savings depend heavily on the specific server's schema verbosity
- A CLI shim, not a persistent agent runtime - no bidirectional streaming
License
MIT (OSI-open)
When it is interesting
Scripting or automating MCP tool calls in CI, shell scripts or agent loops where a full MCP client is overkill.
When it is too early
If you need stateful sessions or bidirectional streaming.
Commercial alternative & related
- Commercial counterpart: Zapier MCP
This repo featured in the 2026-07 edition of the Open-Source AI Radar.
chrome-devtools-mcp
ChromeDevTools
Official Chrome DevTools MCP server giving coding agents control of a real Chrome instance with DevTools-grade inspection.
n8n-mcp
czlonkowski
Independent MCP server giving AI assistants structured access to n8n node docs to build and validate workflows.
claude-context
zilliztech
Code-search MCP server for AI coding agents - semantic + BM25 hybrid search across whole codebases.