opencode-delegator
Provides tools for Git operations such as checking status, viewing diffs, committing changes, and viewing commit history.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-delegator Write a Python script to scrape a website"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenCode Delegator
MCP Server — 让 Codex、Claude Code 等 AI 编码助手只做决策,将代码编写、编辑、执行全部委派给 OpenCode。
快速开始
安装
npm install -g opencode-delegator或直接使用 npx:
npx opencode-delegator前置要求
Node.js >= 18
OpenCode CLI 已安装并在 PATH 中
Related MCP server: openclaw-mcp
配置
Codex CLI — 编辑 ~/.codex/config.toml:
[mcp_servers.opencode]
command = "npx"
args = ["-y", "opencode-delegator"]
env = { OPENCODE_DEFAULT_PROJECT = "/path/to/project" }Claude Code:
claude mcp add opencode -- npx -y opencode-delegatorClaude Desktop — 编辑配置文件:
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "opencode-delegator"],
"env": { "OPENCODE_DEFAULT_PROJECT": "/path/to/project" }
}
}
}环境变量
变量 | 默认值 | 说明 |
|
|
|
| - | 默认项目绝对路径 |
|
| OpenCode 可执行文件路径 |
|
| 超时时间 (ms) |
|
| 启用命令白名单 |
| - | JSON 格式多项目配置 |
也支持配置文件 opencode-delegator.json,参见 config.example.json。
工具
工具 | 说明 |
| 创建/覆写文件(支持 AI 生成) |
| 通过 OpenCode 编辑文件(自动 lint/typecheck) |
| 读取文件内容 |
| ripgrep 搜索代码库 |
| 执行 shell 命令(带安全过滤) |
| 运行测试套件(自动检测框架) |
| 查看分支和文件状态 |
| 查看 diff |
| 暂存并提交 |
| 查看提交历史 |
| OpenCode 分析需求并输出方案 |
| 执行已生成的方案 |
| 列出已注册项目 |
| 动态注册新项目 |
| 列出活跃会话(persistent) |
| 恢复历史会话(persistent) |
| 通用委派工具 |
MCP Resources
资源 | URI | 说明 |
project-structure |
| 项目文件树 |
project-dependencies |
| 依赖信息 |
project-recent |
| 最近 git 变更 |
安全
路径校验:所有文件操作限制在项目目录内,防止路径遍历
命令过滤:拦截危险 shell 命令(
rm -rf /、curl | sh等),支持白名单模式审计日志:所有工具调用记录到
~/.opencode-delegator/audit.jsonl
架构
┌─────────────────┐ MCP (stdio) ┌──────────────────┐
│ Codex CLI │ ◄────────────────────► │ opencode- │
│ Claude Code │ │ delegator │
│ Cursor 等 │ │ (MCP Server) │
└─────────────────┘ └────────┬─────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Project A │ │ Project B │ │ Project C │
└──────────┘ └──────────┘ └──────────┘文档
License
MIT
Available Tools
17 toolsadd_projectC
Register a new project directory.
Inputs: name (required), path (required), mode, port.
ask_opencodeA
Send an arbitrary prompt to OpenCode in a project context. General-purpose delegation tool.
Inputs: prompt (required), model, project.
edit_codeA
Edit an existing file using OpenCode. Delegates all edits to OpenCode for lint/typecheck safety.
Inputs: file (required), instruction (required), project.
execute_planB
Execute a previously generated plan. OpenCode will implement the plan step by step.
Inputs: plan (required), dryRun, project.
git_commitC
Stage all changes and create a git commit.
Inputs: message (required), files, project.
git_diffB
View git diff (unstaged, staged, or specific commit).
Inputs: ref, file, project.
git_logB
View recent git commits.
Inputs: count, project.
git_statusA
Get git status (branch, staged/unstaged changes).
Inputs: project.
list_projectsB
List all registered projects.
Inputs: no named parameters.
list_sessionsB
List active OpenCode sessions (persistent mode only).
Inputs: project.
planA
Use OpenCode in plan mode to analyze, design, and plan without executing. Safe for exploration.
Inputs: task (required), context, project.
read_fileC
Read the contents of a file.
Inputs: file (required), project.
resume_sessionB
Resume a previous OpenCode session (persistent mode only).
Inputs: sessionId (required), project.
run_commandB
Execute a shell command in the project directory. Use for builds, installs, scripts, etc.
Inputs: command (required), force, project, timeout.
run_testsC
Run the project test suite with configurable options.
Inputs: pattern, project, timeout, coverage, +1 more.
search_codeB
Search for patterns in the codebase using ripgrep.
Inputs: pattern (required), glob, path, project.
write_codeA
Create or overwrite a file with code. Use this to write new files or completely replace file contents.
Inputs: file (required), prompt, content, project.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Each tool has a clearly distinct purpose. Potential confusion between edit_code and write_code is resolved by descriptions (edit vs create/overwrite). All other tools target different operations or resources.
Most tools follow a verb_noun pattern (add_project, edit_code, run_command). 'plan' is a lone verb without a noun, and git_* tools use a non-verb prefix, but the overall pattern is consistent and readable.
17 tools is appropriate for a coding assistant delegate. Each tool addresses a distinct need (project management, file ops, git, sessions, delegation) without redundancy.
Core workflow (plan, edit, test, commit) is covered. Minor gaps exist: no tool to delete a project or end a session, but these are not essential for typical usage.
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Official MCP server for Agentwork — delegate tasks to AI agents with human-in-the-loop
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that supercharges AI assistants with powerful tools for software development, enabling research, planning, code generation, and project scaffolding through natural language interaction.1142 npm102MIT
- AlicenseAqualityDmaintenanceMCP server that integrates OpenClaw AI assistant with Claude Code, enabling chat, task management, messaging, memory, alerts, agent spawning, and web search through configurable tools.12406 npmMIT
- AlicenseAqualityCmaintenanceAn MCP server that empowers AI coding agents to work effectively with Minecraft mod development, providing static analysis of decompiled source code and runtime interaction with a running Minecraft instance.3192 npm18MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets an AI coding agent delegate implementation work to the OpenCode CLI, choosing an explicit provider + model on every call.3MIT