经 AI Skill Hub 精选评估,MCP命令行转换器 获评「强烈推荐」。已获得 2.1k 颗 GitHub Star,这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
将MCP、OpenAPI、GraphQL服务器实时转换为CLI工具,无需编码。支持多种协议标准,自动生成命令行接口,适合开发者快速将API服务转化为本地命令行工具使用。
MCP命令行转换器 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
将MCP、OpenAPI、GraphQL服务器实时转换为CLI工具,无需编码。支持多种协议标准,自动生成命令行接口,适合开发者快速将API服务转化为本地命令行工具使用。
MCP命令行转换器 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/knowsuchagency/mcp2cli
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"mcp------": {
"command": "npx",
"args": ["-y", "mcp2cli"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 MCP命令行转换器 执行以下任务... Claude: [自动调用 MCP命令行转换器 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"mcp______": {
"command": "npx",
"args": ["-y", "mcp2cli"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <img src="https://raw.githubusercontent.com/knowsuchagency/mcp2cli/main/assets/hero.png" alt="mcp2cli — one CLI for every API" width="700"> </p>
<p align="center"> Turn any MCP server, OpenAPI spec, or GraphQL endpoint into a CLI — at runtime, with zero codegen.<br> <strong>Save 96–99% of the tokens wasted on tool schemas every turn.</strong><br><br> <a href="https://www.orangecountyai.com/blog/mcp2cli-one-cli-for-every-api-zero-wasted-tokens"><strong>Read the full writeup →</strong></a> </p>
mcp2cli --mcp https://mcp.example.com/sse --search "task" ```
--search implies --list and works across all modes (--mcp, --spec, --graphql, --mcp-stdio).
mcp2cli --mcp https://mcp.example.com/sse --list --json mcp2cli --spec ./openapi.json --list --json mcp2cli --graphql https://api.example.com/graphql --list --json
```bash
uvx mcp2cli --help
uv tool install mcp2cli ```
uv sync --extra test
mcp2cli tracks tool invocations locally and uses that data to rank --list output, reducing token costs for LLM agents working with large servers.
```bash
Sensitive values (--auth-header values, --oauth-client-id, --oauth-client-secret) support env: and file: prefixes to avoid passing secrets as CLI arguments (which are visible in process listings):
```bash
mcp2cli --mcp https://mcp.example.com/sse \ --auth-header "Authorization:env:MY_API_TOKEN" \ --list
fnox exec -- mcp2cli --mcp https://mcp.example.com/sse \ --oauth-client-id "env:OAUTH_CLIENT_ID" \ --oauth-client-secret "env:OAUTH_CLIENT_SECRET" \ --list ```
mcp2cli --mcp-stdio "node server.js" --env API_KEY=sk-... --env DEBUG=1 \ search --query "test" ```
Tired of repeating --spec/--mcp/--mcp-stdio plus auth flags on every invocation? Bake them into a named configuration:
```bash
```bash
mcp2cli --spec ./openapi.json --base-url https://api.example.com list-pets --status available
mcp2cli --graphql https://api.example.com/graphql --list
mcp2cli bake create petstore --spec https://api.example.com/spec.json \ --exclude "delete-,update-" --methods GET,POST --cache-ttl 7200
mcp2cli --spec ./openapi.json --json list-pets mcp2cli --graphql https://api.example.com/graphql --json users ```
--json takes precedence over --raw and --toon (both of which can produce non-JSON), so it always wins — that is what makes it a reliable "force JSON" switch. Indentation follows the usual rule: pretty on a TTY or with --pretty, compact when piped.
mcp2cli [global options] <subcommand> [command options]
Source (mutually exclusive, one required):
--spec URL|FILE OpenAPI spec (JSON or YAML, local or remote)
--mcp URL MCP server URL (HTTP/SSE)
--mcp-stdio CMD MCP server command (stdio transport)
--graphql URL GraphQL endpoint URL
Options:
--auth-header K:V HTTP header (repeatable, value supports env:/file: prefixes)
--base-url URL Override base URL from spec
--transport TYPE MCP HTTP transport: auto|sse|streamable (default: auto)
--env KEY=VALUE Env var for MCP stdio server (repeatable)
--oauth Enable OAuth (authorization code + PKCE flow)
--oauth-client-id ID OAuth client ID (supports env:/file: prefixes)
--oauth-client-secret S OAuth client secret (supports env:/file: prefixes)
--oauth-scope SCOPE OAuth scope(s) to request
--cache-key KEY Custom cache key
--cache-ttl SECONDS Cache TTL (default: 3600)
--refresh Bypass cache
--list List available subcommands
--search PATTERN Search tools by name or description (implies --list)
--sort MODE Sort --list output: usage|recent|alpha|default
--top N Show only the top N tools in --list output
--compact Space-separated tool names only, no descriptions
--verbose Show full tool descriptions (unwrapped)
--fields FIELDS Override GraphQL selection set (e.g. "id name email")
--pretty Pretty-print JSON output
--raw Print raw response body
--json Force valid JSON output for every command (--list and tool
calls). MCP calls emit the full result envelope including
structuredContent. Takes precedence over --raw and --toon.
--toon Encode output as TOON (token-efficient for LLMs)
--head N Limit output to first N records (arrays)
--version Show version
Bake mode:
bake create NAME [opts] Save connection settings as a named tool
bake list List all baked tools
bake show NAME Show config (secrets masked)
bake update NAME [opts] Update a baked tool
bake remove NAME Delete a baked tool
bake install NAME Create ~/.local/bin wrapper script
@NAME [args] Run a baked tool (e.g. mcp2cli @petstore --list)
Subcommands and their flags are generated dynamically from the spec or MCP server tool definitions. Run <subcommand> --help for details.
For token savings analysis, architecture details, and comparison to Anthropic's Tool Search, see the full writeup on the OCAI blog.
uv run pytest tests/ -v
创新型MCP工具,零代码快速将任意服务转CLI,2.1k星热度验证。架构优雅,生态适配完善,开发者友好度高。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:MCP命令行转换器 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | mcp2cli |
| 原始描述 | 开源MCP工具:Turn any MCP, OpenAPI, or GraphQL server into a CLI — at runtime, with zero code。⭐2.1k · Python |
| Topics | MCP协议API转CLI自动化工具Python开发DevOps |
| GitHub | https://github.com/knowsuchagency/mcp2cli |
| License | MIT |
| 语言 | Python |
收录时间:2026-05-16 · 更新时间:2026-05-19 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端