MCP Configs2026年4月6日·1 分钟阅读

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.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Established
入口
mcp2cli — Turn MCP Servers into CLI Tools, Zero Codegen
安全暂存命令
npx -y tokrepo@latest install 54b79071-6416-4155-8935-416d0399d25e --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

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.

常见问题

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.

引用来源 (3)
🙏

来源与感谢

Created by Stephan Fitzpatrick. Licensed under MIT.

mcp2cli — ⭐ 1,900+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产