# 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. --- ## 快速使用 1. 安装: `uv tool install mcp2cli` 2. 运行: `mcp2cli --server your-mcp-server` 3. 所有 MCP 工具立即变成 CLI 命令 或直接运行(无需安装): ```bash uvx mcp2cli --help ``` --- ## 简介 mcp2cli 是一款开发者工具,可以在运行时将任何 MCP 服务器、OpenAPI 规范或 GraphQL 端点转换为命令行界面——无需代码生成。拥有 1,900+ GitHub stars 和 MIT 许可证,通过使用感知的工具排序,每轮对话节省 96–99% 的 token 开销。适用于 Claude Code、Cursor 等 MCP 兼容工具。 --- ## mcp2cli — 从任意 API 生成运行时 CLI ### 核心特性 - **零代码生成**: MCP 工具即时变为 CLI 命令 - **多协议支持**: 支持 MCP 服务器(stdio/SSE)、OpenAPI 规范和 GraphQL 端点 - **Token 节省**: 使用感知排序,节省 96–99% 的 schema token 开销 - **内置 OAuth**: 所有 API 类型均支持 OAuth 认证 - **烘焙模式**: 保存连接配置以便重复使用 --- ## 来源与感谢 > 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/54b79071-6416-4155-8935-416d0399d25e Author: MCP Hub