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.
Staging seguro para este activo
Este activo primero queda en staging. El prompt copiado pide inspeccionar los archivos staged antes de activar scripts, config MCP o config global.
npx -y tokrepo@latest install 54b79071-6416-4155-8935-416d0399d25e --target codexPrimero deja archivos en staging; la activación requiere revisar el README y el plan staged.
What it is
mcp2cli is a CLI tool that converts any MCP server, OpenAPI specification, or GraphQL endpoint into a full command-line interface at runtime. Instead of sending large tool schemas to an AI model on every turn (consuming thousands of tokens), you interact with MCP tools directly from your terminal using generated CLI commands.
mcp2cli is for developers who use MCP servers and want to invoke tools from the command line without writing client code or paying the token cost of schema embedding.
The project is actively maintained with regular releases and a growing user community. Documentation covers common use cases, and the open-source nature means you can inspect the source code, contribute fixes, and adapt the tool to your specific requirements.
How it saves time or tokens
Every time an AI agent calls an MCP tool, the full tool schema is sent as part of the prompt -- often 500-2000 tokens per tool per turn. With 10 tools over 20 turns, that is 100K-400K tokens wasted on schema repetition. mcp2cli moves tool invocation to the CLI, eliminating schema overhead entirely. The project claims 96-99% token savings.
How to use
- Install mcp2cli via uv or pip.
- Point it at your MCP server configuration.
- All MCP tools become CLI commands that you can run directly.
Example
# Install via uv
uv tool install mcp2cli
# Run with an MCP server
mcp2cli --server your-mcp-server
# List available tools
mcp2cli --server sqlite-mcp tools
# Call a tool directly
mcp2cli --server sqlite-mcp call query --sql 'SELECT * FROM users LIMIT 5'
# Convert an OpenAPI spec to CLI
mcp2cli --openapi https://api.example.com/openapi.json
Related on TokRepo
- AI Tools for Agents -- Agent tools and MCP utilities
- MCP Integrations -- MCP server integrations on TokRepo
Common pitfalls
- mcp2cli generates CLI commands at runtime. If the MCP server changes its tool definitions, the CLI commands update automatically but your scripts may break.
- Complex tool parameters (nested objects, arrays) may be harder to express as CLI flags. Check the generated help output for the correct syntax.
- mcp2cli requires the MCP server to be running and accessible. Network issues or server crashes will cause CLI commands to fail.
Before adopting this tool, evaluate whether it fits your team's existing workflow. Read the official documentation thoroughly, and start with a small proof-of-concept rather than a full migration. Community forums, GitHub issues, and Stack Overflow are valuable resources when you encounter edge cases not covered in the documentation.
Preguntas frecuentes
AI agents send tool schemas as part of every prompt. With mcp2cli, you invoke tools from the CLI instead, so schemas are never sent to the model. This saves 96-99% of the tokens normally consumed by tool definitions.
Yes. mcp2cli is compatible with any MCP-compliant server. It reads the tool definitions from the server and generates CLI commands automatically.
Yes. mcp2cli can take an OpenAPI specification and generate CLI commands for each endpoint. This works independently of MCP, making it useful for any REST API.
Not exactly. mcp2cli is for direct human invocation of MCP tools from the terminal. It supplements agent tool use by providing a way to test and invoke tools without token overhead.
Install via uv with uv tool install mcp2cli, or via pip with pip install mcp2cli. The uv method is recommended for isolated installation.
Referencias (3)
- mcp2cli GitHub— mcp2cli converts MCP servers into CLI tools
- MCP Spec— Model Context Protocol specification
- mcp2cli README— Token savings from eliminating schema overhead
Relacionados en TokRepo
Fuente y agradecimientos
Created by Stephan Fitzpatrick. Licensed under MIT.
mcp2cli — ⭐ 1,900+
Thank you for building a tool that makes MCP servers accessible from the command line.
Discusión
Activos relacionados
ToolHive — Run & Manage MCP Servers with thv
Install, run, and manage MCP servers with the `thv` CLI (plus desktop/K8s options), with registry workflows and AI-client setup helpers.
MCP Linker — Sync MCP Servers Across Clients
MCP Linker is a cross-platform app with a curated MCP marketplace to add and sync server configs across clients like Claude Code, Cursor, and VS Code.
OpenMCP Client — Universal CLI for MCP Servers
OpenMCP Client is a universal CLI to connect to MCP servers, list tools, and run calls from a terminal—useful for debugging and smoke tests.
mcpc — Universal MCP CLI Client
A Swiss Army knife CLI for the Model Context Protocol: connect to MCP servers, manage sessions, list tools, and script tool calls via JSON output.