knowsuchagency/mcp2cli

Turn any MCP, OpenAPI, or GraphQL server into a CLI — at runtime, with zero codegen

What it solves

It eliminates the need for writing custom code or generating boilerplate to turn APIs into command-line interfaces (CLIs). Specifically, it solves the problem of "token waste" for AI agents; instead of sending massive tool schemas to an LLM every turn, agents can use this CLI to discover and call tools dynamically, significantly reducing token consumption.

How it works

mcp2cli acts as a runtime bridge that introspects various API definitions and transforms them into executable CLI commands without any code generation. It supports four primary sources:

  • MCP Servers: Connects via HTTP/SSE or stdio transport.
  • OpenAPI Specs: Uses JSON or YAML specifications to map endpoints to commands.
  • GraphQL Endpoints: Introspects the endpoint to auto-generate queries and mutations.
  • Bake Mode: Allows users to save connection and authentication settings into named configurations (e.g., @petstore) to avoid repeating flags.

It includes built-in support for OAuth (including PKCE and manual callbacks for headless servers), secret management via environment variables or files, and a token-efficient output format called TOON.

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 prompt context.
  • DevOps/Power Users: Users who want a quick, zero-config way to interact with various APIs from the terminal.

Highlights

  • Zero Codegen: Converts APIs to CLIs at runtime.
  • Multi-Protocol Support: Works with MCP, OpenAPI, and GraphQL.
  • Token Efficiency: Features usage-aware tool ranking and a compact output mode to save LLM tokens.
  • Comprehensive Auth: Built-in OAuth flow handling, including token caching and refresh.
  • Agent Integration: Ships with an installable "skill" to teach AI coding agents how to use the tool.

Related

  • Project
  • Project
  • Project
  • Project
  • Project