MCP ConfigsApr 6, 2026·2 min read

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.

TL;DR
mcp2cli converts MCP servers into CLI commands at runtime, saving 96-99% of token overhead.
§01

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.

§02

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.

§03

How to use

  1. Install mcp2cli via uv or pip.
  2. Point it at your MCP server configuration.
  3. All MCP tools become CLI commands that you can run directly.
§04

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
§05

Related on TokRepo

§06

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.

Frequently Asked Questions

How does mcp2cli save tokens?+

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.

Does mcp2cli work with any MCP server?+

Yes. mcp2cli is compatible with any MCP-compliant server. It reads the tool definitions from the server and generates CLI commands automatically.

Can mcp2cli convert OpenAPI specs?+

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.

Is mcp2cli a replacement for AI agent tool use?+

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.

How do I install mcp2cli?+

Install via uv with uv tool install mcp2cli, or via pip with pip install mcp2cli. The uv method is recommended for isolated installation.

Citations (3)
🙏

Source & Thanks

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.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.