knowsuchagency/mcp2cli
Turn any MCP, OpenAPI, or GraphQL server into a CLI — at runtime, with zero codegen
What it solves
AI agents and developers often waste tokens sending large tool schemas on every turn. mcp2cli converts any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI at runtime, so you only send the command and arguments — not the full schema — saving 96–99% of tokens per call.
How it works
Point mcp2cli at a source — --mcp for an MCP server URL, --spec for an OpenAPI spec (local or remote), --graphql for a GraphQL endpoint, or --mcp-stdio for a local MCP command. It introspects the API, builds a set of subcommands, and lets you call them directly. You can list available tools with --list, search with --search, and get raw definitions with --schema. It also supports OAuth, sessions that reuse a connection, baked configurations, caching, and multiple output formats (JSON, TOON, compact).
Who it’s for
AI coding agents (Claude Code, Cursor, Codex) that need to call APIs with minimal token overhead, and developers who want a quick CLI for any HTTP-based API without writing glue code.
Highlights
- Zero codegen: works at runtime with any MCP, OpenAPI, or GraphQL source
- Token savings: flattens tool schemas, cutting 96–99% of tokens per turn
- Built‑in OAuth (authorization code + client credentials) with token caching and auto‑refresh
- Named sessions to reuse one MCP connection across calls
bakemode to save connection settings as reusable named tools- Forced JSON output (
--json) and TOON encoding for machine‑readable results - Works with both major versions of the MCP Python SDK
Related
- Project
- Project
- Project
- Dispatch
- Project