# mcp2cli — Turn MCP Servers into CLI Tools, Zero Codegen > Convert any MCP server, OpenAPI spec, or GraphQL endpoint into a full CLI at runtime. Saves 96-99% of tokens wasted on tool schemas every turn. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Install via uv: `uv tool install mcp2cli` 2. Run: `mcp2cli --server your-mcp-server` 3. All MCP tools become CLI commands instantly Or run directly without installing: ```bash uvx mcp2cli --help ``` --- ## Intro mcp2cli is a developer tool that turns any MCP server, OpenAPI spec, or GraphQL endpoint into a command-line interface at runtime — no code generation needed. With 1,900+ GitHub stars and MIT license, it saves 96–99% of the tokens wasted on tool schemas every turn by using usage-aware tool ranking. Works with Claude Code, Cursor, and any MCP-compatible AI tool. Best for: developers who use multiple MCP servers and want to reduce token overhead. Works with: Claude Code, Cursor, any MCP client. Setup time: under 1 minute. --- ## mcp2cli — Runtime CLI from Any API ### Key Features - **Zero Codegen**: No code generation step — MCP tools become CLI commands instantly - **Multi-Protocol**: Supports MCP servers (stdio/SSE), OpenAPI specs, and GraphQL endpoints - **Token Savings**: Usage-aware tool ranking saves 96–99% of tokens wasted on schema overhead - **Built-in OAuth**: OAuth support across all API types - **Bake Mode**: Save connection configurations for repeated use - **Output Filtering**: jq support and TOON encoding for LLM-efficient output - **Caching**: Customizable TTL caching for repeated queries ### Installation ```bash # Option 1: Direct execution (no install) uvx mcp2cli --help # Option 2: Global install uv tool install mcp2cli # Option 3: pip pip install mcp2cli ``` ### Usage Examples ```bash # Connect to an MCP server mcp2cli --server my-mcp-server # Use with OpenAPI spec mcp2cli --openapi https://api.example.com/openapi.json # Use with GraphQL mcp2cli --graphql https://api.example.com/graphql # Bake a connection for reuse mcp2cli bake my-server --server my-mcp-server ``` ### How It Works mcp2cli introspects the target API at runtime, discovers all available tools/endpoints, and generates CLI commands dynamically. The usage-aware ranking system tracks which tools you use most and prioritizes them, dramatically reducing the token cost of tool schemas in every conversation turn. ### FAQ **Q: What is mcp2cli?** A: mcp2cli is a CLI tool that converts MCP servers, OpenAPI specs, and GraphQL endpoints into command-line interfaces at runtime without code generation, saving 96–99% of tokens on tool schemas. **Q: Is mcp2cli free?** A: Yes, mcp2cli is free and open source under the MIT license. **Q: How do I install mcp2cli?** A: Run `uv tool install mcp2cli` or `pip install mcp2cli`, or use directly with `uvx mcp2cli`. --- ## Source & Thanks > Created by [Stephan Fitzpatrick](https://github.com/knowsuchagency). Licensed under MIT. > > [mcp2cli](https://github.com/knowsuchagency/mcp2cli) — ⭐ 1,900+ Thank you for building a tool that makes MCP servers accessible from the command line. --- ## Quick Use 1. Install: `uv tool install mcp2cli` 2. Run: `mcp2cli --server your-mcp-server` 3. Every MCP tool instantly becomes a CLI command Or run it directly (no install): ```bash uvx mcp2cli --help ``` --- ## Intro mcp2cli is a developer tool that turns any MCP server, OpenAPI spec, or GraphQL endpoint into a command-line interface at runtime — no code generation needed. With 1,900+ GitHub stars and an MIT license, it saves 96–99% of token overhead per conversation through usage-aware tool ordering. Works with Claude Code, Cursor, and other MCP-compatible tools. --- ## mcp2cli — Runtime CLI Generation for Any API ### Core Features - **Zero code generation**: MCP tools become CLI commands on the fly - **Multi-protocol support**: MCP servers (stdio/SSE), OpenAPI specs, and GraphQL endpoints - **Token savings**: usage-aware ordering saves 96–99% of schema token overhead - **Built-in OAuth**: OAuth auth for all API types - **Bake mode**: save connection configs for reuse --- ## Source & Thanks > Created by [Stephan Fitzpatrick](https://github.com/knowsuchagency). Licensed under MIT. > > [mcp2cli](https://github.com/knowsuchagency/mcp2cli) — ⭐ 1,900+ --- Source: https://tokrepo.com/en/workflows/mcp2cli-turn-mcp-servers-into-cli-tools-zero-codegen-54b79071 Author: MCP Hub