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
# Option 1: Direct execution (no install)
uvx mcp2cli --help
# Option 2: Global install
uv tool install mcp2cli
# Option 3: pip
pip install mcp2cliUsage Examples
# 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-serverHow 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.