统一CLI工具

独立MCP服务器,通过统一的`ask`工具暴露已安装的编码CLI,实现本地CLI间的直接调用。

  • by dev-boz
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 dev-boz/unified-cli-mcp

使用说明

统一cli-mcp

通过一个通用的MCP服务器公开已安装的编码CLI的独立MCP服务器 ask 工具。

它允许一个MCP客户端直接调用另一个本地CLI。例如:

  • 克劳德代码调用Codex
  • Codex呼叫双子座
  • 副驾驶呼叫光标

支持的后端

在本机器上进行现场烟雾测试:

  • gemini
  • codex
  • claude
  • kiro
  • kilo
  • copilot
  • opencode
  • mistral
  • cursor
  • qwen

已知除外责任:

  • qodo:暂时排除,因为上游执行当前返回日落响应
  • amp:已安装,但无头执行模式目前需要付费点数

它暴露了什么

两个MCP工具:

  • ask(backend, prompt, model?, cwd?, timeout?)
  • backends()

ask 运行一次无头CLI调用。

backends 配置本地二进制文件的报告可用。

安装

直接从GitHub运行 uvx

uvx --from git+https://github.com/dev-boz/unified-cli-mcp unified-cli-mcp

作为工具安装 uv

uv tool install git+https://github.com/dev-boz/unified-cli-mcp

安装时使用 pipx

pipx install git+https://github.com/dev-boz/unified-cli-mcp

本地开发

git clone https://github.com/dev-boz/unified-cli-mcp
cd unified-cli-mcp
uv sync
uv run unified-cli-mcp

MCP客户端配置

克劳德代码

claude mcp add -s user unified-cli-mcp -- uvx --from git+https://github.com/dev-boz/unified-cli-mcp unified-cli-mcp

法典

codex mcp add unified-cli-mcp -- uvx --from git+https://github.com/dev-boz/unified-cli-mcp unified-cli-mcp

双子星命令行工具

gemini mcp add -s user unified-cli-mcp uvx --from git+https://github.com/dev-boz/unified-cli-mcp unified-cli-mcp

Copilot 命令行界面

用户配置文件: ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "unified-cli-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/dev-boz/unified-cli-mcp",
        "unified-cli-mcp"
      ]
    }
  }
}

项目本地Copilot配置: .mcp.json

{
  "servers": {
    "unified-cli-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/dev-boz/unified-cli-mcp",
        "unified-cli-mcp"
      ]
    }
  }
}

通用stdio配置

{
  "mcpServers": {
    "unified-cli-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/dev-boz/unified-cli-mcp",
        "unified-cli-mcp"
      ],
      "env": {
        "UNIFIED_CLI_ENABLED_BACKENDS": "gemini,codex,claude,copilot,cursor,mistral",
        "UNIFIED_CLI_DEFAULT_TIMEOUT": "300",
        "UNIFIED_CLI_ALLOW_DANGEROUS": "1"
      }
    }
  }
}

示例提示

在任何MCP客户端内部:

Use the unified-cli-mcp ask tool with backend="codex", cwd="/path/to/repo", prompt="Review this project for parsing bugs. Return only the top 3 findings."
Use unified-cli-mcp to ask gemini: "Summarize the architecture of this repo in 5 bullets."
Call the ask tool with backend="cursor", prompt="Suggest a refactor plan for the parser layer. No code."

备注

  • 目标CLI必须已在运行此MCP服务器的计算机上安装并经过身份验证。
  • 此服务器是独立的。它不需要 cli-agent-nexus.
  • 后端别名,如 claude-code, mistral-vibe,以及 cursor-agent 内部正常化。
  • 广泛权限绕过标志现在是选择加入。设置 UNIFIED_CLI_ALLOW_DANGEROUS=1 仅当您明确希望桥接CLI在启用信任/自动批准模式的情况下运行时。

发展

python3 -m pytest tests/test_core.py -q
python3 -m compileall unified_cli_mcp