CLI Agent MCP

CLI Agent MCP

Provides unified access to multiple CLI AI agents (Codex, Gemini, Claude, and OpenCode) through a single MCP interface with real-time task monitoring, enabling specialized code analysis, UI design, implementation, and prototyping workflows.

Category
访问服务器

README

cli-agent-mcp

中文文档

Unified MCP (Model Context Protocol) server for CLI AI agents. Provides a single interface to invoke Codex, Gemini, Claude, and OpenCode CLI tools.

Features

  • Unified Interface: Single MCP server exposing multiple CLI agents
  • GUI Dashboard: Real-time task monitoring with pywebview
  • Request Isolation: Per-request execution context for safe concurrent usage
  • Signal Handling: Graceful cancellation via SIGINT without killing the server
  • Debug Logging: Comprehensive subprocess output capture for debugging

Screenshot

CLI Agent MCP GUI

Installation

# Install from PyPI (when published)
uvx cli-agent-mcp

# Install from GitHub
uvx --from git+https://github.com/shiharuharu/cli-agent-mcp.git cli-agent-mcp

# Install from source (editable mode for development)
uvx --from /path/to/cli-agent-mcp cli-agent-mcp

# Or use pip
pip install -e .

Configuration

Configure via environment variables:

Variable Description Default
CAM_TOOLS Comma-separated list of allowed tools (empty = all) "" (all)
CAM_GUI Enable GUI dashboard true
CAM_GUI_DETAIL GUI detail mode false
CAM_GUI_KEEP Keep GUI on exit false
CAM_DEBUG Include debug info in MCP responses false
CAM_LOG_DEBUG Write debug logs to temp file false
CAM_SIGINT_MODE SIGINT handling (cancel/exit/cancel_then_exit) cancel
CAM_SIGINT_DOUBLE_TAP_WINDOW Double-tap exit window (seconds) 1.0

Tools

codex

Invoke OpenAI Codex CLI agent for deep code analysis and critical review.

Best for: Code review, bug hunting, security analysis

Parameter Type Required Default Description
prompt string - Task instruction for the agent
workspace string - Absolute path to the project directory
permission string read-only Permission level: read-only, workspace-write, unlimited
model string "" Model override (only specify if explicitly requested)
save_file string "" Save agent output to file path
save_file_with_prompt boolean false Include analysis prompt in saved file
full_output boolean false Return detailed output including reasoning
image array [] Absolute paths to image files for visual context
session_id string "" Session ID to resume previous conversation
task_note string "" Display label for GUI
debug boolean (global) Override debug setting for this call

gemini

Invoke Google Gemini CLI agent for UI design and comprehensive analysis.

Best for: UI mockups, image analysis, requirement discovery, full-text analysis

Parameter Type Required Default Description
prompt string - Task instruction for the agent
workspace string - Absolute path to the project directory
permission string read-only Permission level: read-only, workspace-write, unlimited
model string "" Model override
save_file string "" Save agent output to file path
save_file_with_prompt boolean false Include analysis prompt in saved file
full_output boolean false Return detailed output including reasoning
session_id string "" Session ID to resume previous conversation
task_note string "" Display label for GUI
debug boolean (global) Override debug setting for this call

claude

Invoke Anthropic Claude CLI agent for code implementation.

Best for: Feature implementation, refactoring, code generation

Parameter Type Required Default Description
prompt string - Task instruction for the agent
workspace string - Absolute path to the project directory
permission string read-only Permission level: read-only, workspace-write, unlimited
model string "" Model override (sonnet, opus, or full model name)
save_file string "" Save agent output to file path
save_file_with_prompt boolean false Include analysis prompt in saved file
full_output boolean false Return detailed output including reasoning
system_prompt string "" Complete replacement for the default system prompt
append_system_prompt string "" Additional instructions appended to default prompt
agent string "" Specify agent name (overrides default agent setting)
session_id string "" Session ID to resume previous conversation
task_note string "" Display label for GUI
debug boolean (global) Override debug setting for this call

opencode

Invoke OpenCode CLI agent for full-stack development.

Best for: Rapid prototyping, multi-framework projects

Parameter Type Required Default Description
prompt string - Task instruction for the agent
workspace string - Absolute path to the project directory
permission string read-only Permission level: read-only, workspace-write, unlimited
model string "" Model override (format: provider/model)
save_file string "" Save agent output to file path
save_file_with_prompt boolean false Include analysis prompt in saved file
full_output boolean false Return detailed output including reasoning
file array [] Absolute paths to files to attach
agent string build Agent type: build, plan, etc.
session_id string "" Session ID to resume previous conversation
task_note string "" Display label for GUI
debug boolean (global) Override debug setting for this call

Permission Levels

Level Description Codex Claude OpenCode
read-only Can only read files --sandbox read-only --tools Read,Grep,Glob edit: deny, bash: deny
workspace-write Can modify files within workspace --sandbox workspace-write --tools Read,Edit,Write,Bash edit: allow, bash: ask
unlimited Full system access (use with caution) --sandbox danger-full-access --tools default edit: allow, bash: allow

Debug Mode

Enable debug mode to get detailed execution information:

# Enable debug info in responses
export CAM_DEBUG=true

# Enable detailed log file
export CAM_LOG_DEBUG=true

When CAM_LOG_DEBUG=true, logs are written to:

/tmp/cli-agent-mcp/cam_debug_YYYYMMDD_HHMMSS.log

Debug output includes:

  • Full subprocess command
  • Complete stdout/stderr output
  • Return codes
  • MCP request/response summaries

MCP Configuration

Add to your MCP client configuration (e.g., Claude Desktop claude_desktop_config.json):

Basic Configuration

{
  "mcpServers": {
    "cli-agent-mcp": {
      "command": "uvx",
      "args": ["cli-agent-mcp"]
    }
  }
}

Install from GitHub

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

With Debug Mode

{
  "mcpServers": {
    "cli-agent-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/shiharuharu/cli-agent-mcp.git",
        "cli-agent-mcp"
      ],
      "env": {
        "CAM_DEBUG": "true",
        "CAM_LOG_DEBUG": "true"
      }
    }
  }
}

Disable GUI

{
  "mcpServers": {
    "cli-agent-mcp": {
      "command": "uvx",
      "args": ["cli-agent-mcp"],
      "env": {
        "CAM_GUI": "false"
      }
    }
  }
}

Limit Available Tools

{
  "mcpServers": {
    "cli-agent-mcp": {
      "command": "uvx",
      "args": ["cli-agent-mcp"],
      "env": {
        "CAM_TOOLS": "claude,gemini"
      }
    }
  }
}

Project Structure

cli-agent-mcp/
├── shared/                  # Source of truth (for distribution)
│   ├── gui/
│   ├── invokers/
│   └── parsers/
├── src/cli_agent_mcp/       # Main package
│   ├── shared/              # ← Synced copy (do not edit directly)
│   ├── server.py
│   ├── config.py
│   └── gui_manager.py
├── tests/
└── shared_sync.sh

Important: Never edit src/cli_agent_mcp/shared/ directly. Always edit shared/ and run the sync script.

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Sync shared modules (runs tests first)
./shared_sync.sh

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选