
alaeddinemessadi/opencode-mcp 是从 https://github.com/alaeddinemessadi/opencode-mcp. 导入的 MCP 服务器候选
概览
alaeddinemessadi/opencode-mcp 是从 https://github.com/alaeddinemessadi/opencode-mcp. 导入的 MCP 服务器候选
概述(AI 翻译)
将编码工作委托给你的MCP客户端的OpenCode。
OpenCode-MCP 将 Claude、Cursor、VS Code 及其他 MCP 客户端连接到 OpenCode 的无头 API。提问、实现功能、监控后台工作、回复问题和权限,并审核跨项目的变更。
3.0.0 版本需要 Node.js 22 或更新版本。从 2.x 升级?请参见迁移说明。
快速启动
安装OpenCode并从你的项目启动其服务器:
如果你用 TUI,先用 opencode --port 4096 启动并共享那个服务器。设置 OPENCODE_BASE_URL 作为另一个端点。
对于Claude代码:
对于使用 mcpServers 配置的客户端:
重启客户端并调用 opencode_setup。从配置好的提供商中选择一个提供商,然后使用 opencode_provider_models 选择型号。将 OPENCODE_DEFAULT_PROVIDER 和 OPENCODE_DEFAULT_MODEL 合并,或在每次提示通话中传递选定的 ID。
客户端特定配置包括 VS Code、Windsurf、Continue、Zed 和 Amazon Q。测试未发布的更改时,从源代码构建,并配置客户端运行 node,绝对路径为 dist/index.js。
选择工作流程
| 需求 | 工具 |
|---|
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
opencode-mcp
Delegate coding work to OpenCode from your MCP client.
opencode-mcp connects Claude, Cursor, VS Code, and other MCP clients to OpenCode’s headless API. Ask questions, implement features, monitor background work, respond to questions and permissions, and review changes across projects.
Version 3.x requires Node.js 22 or newer and works with OpenCode 1.x (tested with 1.18.31 and 1.19.3). Support for OpenCode 2.x is planned for 4.0. Upgrading from 2.x? See the migration notes.
Quick Start
Install OpenCode and start its server from your project:
opencode serve --hostname 127.0.0.1 --port 4096
If you use the TUI, start it with opencode --port 4096 and share that server. Set OPENCODE_BASE_URL for another endpoint.
For Claude Code:
claude mcp add opencode -- npx -y opencode-mcp
For clients using an mcpServers configuration:
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "opencode-mcp"]
}
}
}
Restart the client and call opencode_setup. Choose a provider from its configured providers, then use opencode_provider_models to select a model. Set OPENCODE_DEFAULT_PROVIDER and OPENCODE_DEFAULT_MODEL together or pass the selected IDs in each prompt call.
Client-specific configuration includes VS Code, Windsurf, Continue, Zed, and Amazon Q. To test unreleased changes, build from source and configure your client to run node with the absolute path to dist/index.js.
Choose a Workflow
| Need | Tools |
|---|---|
| Setup and orientation | opencode_setup, opencode_context, opencode_provider_models |
| Quick question or follow-up | opencode_ask, opencode_reply |
| Start work and wait | opencode_run |
| Work in the background | opencode_fire, then opencode_check or opencode_wait |
| Recover or control a recorded job | opencode_job_list, opencode_job_get, opencode_job_cancel |
| Resolve required input | opencode_job_input, permission and question tools |
| Review the result | opencode_review_changes, opencode_conversation |
opencode_fire({
directory: "/absolute/path/to/project",
prompt: "Add input validation to POST /api/users and run the relevant tests",
providerID: "",
modelID: ""
})
// Save the returned job and session IDs; use them to monitor or resume observation.
安装
npx -y opencode-mcp配置
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "opencode-mcp"]
}
}
}