Claude Code × OpenCode
Allows Claude Code to delegate tasks to OpenCode sessions using OpenAI models as the underlying provider, including model selection and reasoning variants.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Claude Code × OpenCode is an MCP server that gives Claude Code one more sub-agent: OpenCode. Claude writes a brief, picks the model, the agent and the skills, lets OpenCode work in your project, then gets back its answer, the list of files it changed and what it cost.
It is useful for three things:
Using any model from inside Claude Code. Every provider connected to OpenCode (OpenRouter, Kilo, OpenCode Zen, Anthropic, OpenAI…), with their reasoning variants, including free models for bulk work.
Running work in parallel. Up to 12 OpenCode sessions at once, each with its own model, agent and permissions.
Staying in control. Permission requests and questions from the agent come back to Claude, which can answer them, interrupt the agent, revert its changes or fork the session.
You › Migrate the 40 components in src/legacy to the new API, in parallel,
with a free model, then check the result.
Claude › oc_delegate_parallel 4 batches × opencode/deepseek-v4.1-flash-free
✓ batch 1 · 10 files · $0 ✓ batch 2 · 10 files · $0
✓ batch 3 · 10 files · $0 ✓ batch 4 · 10 files · $0
oc_session diff → review → npm test ✓Contents
Related MCP server: BoteX
Features
Full delegation | New session or continue an existing one, fork, free-form brief or slash command, attached files. |
Every model | Pick by |
Agents and skills | Primary agent ( |
Parallelism |
|
Background work |
|
Control |
|
Readable results | Final answer, tools used, files changed, tokens and cost, or the full transcript of the turn. |
Full access |
|
Zero configuration | Finds the local OpenCode service on its own, starts it if it is asleep, reconnects if it moves to another port. |
How it works
flowchart LR
U([You]) --> C[Claude Code]
C -- "MCP (stdio)<br/>oc_delegate, oc_wait…" --> M[claude-code-x-opencode]
M -- "HTTP + Basic auth<br/>API v2" --> S[(OpenCode service)]
S --> A1[Session 1<br/>model A · build agent]
S --> A2[Session 2<br/>model B · plan agent]
S --> A3[Session n<br/>…]
A1 & A2 & A3 --> P[[Your project<br/>files · shell · web · MCP]]The MCP server contains no model and stores no key. It talks to the OpenCode service already installed on your machine (opencode service), using the password that service writes to ~/.config/opencode/service.json. Your providers, agents, skills and OpenCode MCP servers are the ones you already use.
One oc_delegate call does this:
creates the session (directory, model, agent, permissions), or picks up the one you give it;
sends the brief, with the requested skills, sub-agents and files;
waits until the session is idle again, checking every 4 seconds that it is not waiting for a permission or an answer;
summarizes the turn: answer, tools, files changed, tokens, cost, errors.
Installation
Requirements
Node.js 20 or later
OpenCode 2.x (API v2, tested with 2.1.4), with at least one provider connected:
opencode auth loginClaude Code (or any other MCP client)
Check that OpenCode answers:
opencode service statusOption 1: straight from GitHub
claude mcp add -s user opencode -- npx -y github:AXLdev123/claude-code-x-opencodeOn Windows, go through cmd /c:
claude mcp add -s user opencode -- cmd /c npx -y github:AXLdev123/claude-code-x-opencodeOption 2: from a clone
git clone https://github.com/AXLdev123/claude-code-x-opencode.gitcd claude-code-x-opencode && npm installclaude mcp add -s user opencode -- node /path/to/claude-code-x-opencode/server.mjsThen check:
claude mcp get opencodeOther MCP clients
Claude Desktop, Cursor, Windsurf and the others take the same JSON entry:
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "github:AXLdev123/claude-code-x-opencode"]
}
}
}Optional: the Claude Code skill
The skill/opencode-subagent folder teaches Claude when to delegate, how to write the brief and how to check the work it gets back. Copy it to ~/.claude/skills/:
cp -r skill/opencode-subagent ~/.claude/skills/Getting started
Open a new Claude Code session and talk normally:
Check that the OpenCode connection works and list its free models.
Delegate to OpenCode, with
claude-sonnet-5-5#high, writing the tests forsrc/parser.ts. It must runnpm testand give me the result.
Ask three different models to review this module read-only, then give me a synthesis.
Start documenting the
api/folder in the background with a free model; we'll look at the result later.
Tool reference
Delegate
Tool | What it does |
| Hands off a task and returns the result. Creates a session or continues |
| Runs 1 to 12 tasks in parallel (one session each) and waits for every answer. |
| Sends a follow-up message, a slash command or skills to an existing session. |
| Waits for a session started in the background, or just unblocked, to finish. |
| Reads a session's state without waiting, pending requests included. |
| Stops the current turn. |
Unblock
Tool | What it does |
| Lists the permissions and questions blocking a session (or the whole server). |
| Answers: |
Manage
Tool | What it does |
| Lists sessions, filtered by directory, text, parent or archive state. |
|
|
Discover
Tool | What it does |
| Connection, version, URL, default model, number of models, agents and skills. |
| Searches models by text, provider or free only. Shows price, context size and variants. |
|
|
Everything else
Tool | What it does |
| Lists the operations of the OpenCode API, or the detailed schema of one of them. |
| Calls an operation by |
Parameter | Type | Default | Purpose |
| text | required | The brief. The agent cannot see your conversation. |
| absolute path | service directory | Project the agent works in. |
| text | Continue this session. | |
| boolean |
| With |
| text | generated | Session title. |
| text | default model | See Choosing a model. |
| text | default agent |
|
| list | Ids of OpenCode skills to attach. | |
| list | Sub-agents to mention ( | |
| list | Paths or URIs of files to attach. | |
| text | Slash command to run; | |
| preset or rules |
| See Permissions. |
| boolean |
|
|
| 5 to 7200 |
| Past it, the task keeps running and |
|
|
| Answer only, answer + tools + files, or transcript. |
Choosing a model
Syntax | Example |
|
|
|
|
ids containing |
|
plain name |
|
With a plain name, the server takes the exact match, then the shortest one, preferring the opencode, anthropic, openai, kilo and openrouter providers in that order. If the name is still ambiguous, the error lists the candidates. Variants (low, high, max…) are shown by oc_models.
Permissions
Preset | Effect |
| Everything is allowed, like |
| Reading, searching and web allowed; editing, writing, patching and shell denied. |
| The selected agent's rules. Anything set to |
rules | A list of |
Example: allow everything except the shell, which needs approval every time.
[
{ "action": "*", "resource": "*", "effect": "allow" },
{ "action": "shell", "resource": "*", "effect": "ask" }
]Long tasks and blocked sessions
stateDiagram-v2
[*] --> Running: oc_delegate
Running --> Done: the session is idle again
Running --> Blocked: permission or question
Running --> Background: wait=false or timeout reached
Blocked --> Running: oc_answer then oc_wait
Background --> Done: oc_wait
Running --> Interrupted: oc_interrupt
Done --> Running: oc_sendWhen a session is waiting for something, the call returns with the exact command to run:
session ses_… BLOCKED, waiting for an answer:
- permission per_… (session ses_…): shell on node -e "console.log(6*7)"
→ oc_answer {session_id:"ses_…", request_id:"per_…", decision:"once|always|reject"}
Answer with oc_answer, then resume with oc_wait {session_id:"ses_…", since:1794312322352}.If the MCP client sends a progressToken, the server publishes a progress notification every 4 seconds while it waits.
Configuration
Nothing is required. To target another OpenCode server:
Variable | Purpose |
| Server URL (otherwise: |
| Basic auth password (otherwise: read from the service file). |
| JSON file holding |
claude mcp add -s user opencode -e OPENCODE_URL=http://127.0.0.1:4096 -e OPENCODE_PASSWORD=secret -- npx -y github:AXLdev123/claude-code-x-opencodeRecipes
{
"tool": "oc_delegate_parallel",
"arguments": {
"detail": "final",
"tasks": [
{ "task": "Review src/auth.ts and list the security flaws, without changing anything.", "directory": "/project", "model": "opencode/claude-sonnet-5-5#high", "permissions": "readonly" },
{ "task": "Review src/auth.ts and list the security flaws, without changing anything.", "directory": "/project", "model": "opencode/gpt-6.1-sol", "permissions": "readonly" },
{ "task": "Review src/auth.ts and list the security flaws, without changing anything.", "directory": "/project", "model": "opencode/deepseek-v4.1-flash-free", "permissions": "readonly" }
]
}
}{ "tool": "oc_delegate", "arguments": { "task": "Document every exported function in api/", "directory": "/project", "wait": false } }{ "tool": "oc_wait", "arguments": { "session_id": "ses_…", "since": 1794312225387 } }{ "tool": "oc_delegate", "arguments": { "task": "Write the migration plan to Postgres 18.", "directory": "/project", "agent": "plan", "skills": ["writing-plans"] } }{ "tool": "oc_delegate", "arguments": { "task": "HEAD~3", "command": "review", "directory": "/project" } }{ "tool": "oc_session", "arguments": { "session_id": "ses_…", "action": "diff" } }{ "tool": "oc_session", "arguments": { "session_id": "ses_…", "action": "revert", "value": "msg_…" } }{ "tool": "oc_api_ops", "arguments": { "operation": "worktree.create" } }{ "tool": "oc_api", "arguments": { "operation": "worktree.create", "body": { "…": "…" } } }Troubleshooting
Symptom | Likely cause and fix |
| The service does not start. Run |
| Wrong password. Check |
| Look up the exact id with |
The task is "still running" | Expected past |
Nothing happens, no error | The session is probably waiting for a permission: |
The tools do not show up | MCP servers load at startup: open a new Claude Code session. |
Development
npm installnpm testCommand | What it checks | Needs OpenCode |
| The 15 tools and their schemas. | No |
| The whole flow with real free models: delegation, follow-up, background, parallel. | Yes |
| Discovery only, no model calls. | Yes |
| Attached skills and the permission → | Yes |
The live tests use deepseek-v4.1-flash-free and opencode/big-pickle by default; override them with TEST_MODEL, TEST_MODEL_2 and TEST_SKILL.
Layout:
server.mjs the 15 MCP tools
lib/client.mjs service discovery, HTTP client, OpenAPI, model resolution
lib/session.mjs sessions, waiting, pending requests, result summaries
skill/ "opencode-subagent" Claude Code skill
test/ offline and end-to-end testsContributions are welcome: see CONTRIBUTING.md.
Known limitations
Waiting and skill loading go through
experimentalroutes of the OpenCode API. They may change from one version to the next.The
readonlypreset denies theedit,write,patch,bashandshellactions. A third-party MCP tool that writes to disk under another name is not covered: for a real sandbox, pass explicit rules.
License
MIT. Independent project, not affiliated with Anthropic or the OpenCode team.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Start and manage Reason cloud coding agents, projects and sessions from any MCP client.
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
- aXDeprecatedio.github.ax-platform
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
Scoped agent execution. Server-side credentials, policy, budgets and verifiable receipts.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables any MCP host to delegate work to multiple coding-agent CLIs such as Codex, Claude Code, and Antigravity as subagents, preserving native sessions and supporting team-based supervision and agent-to-agent messaging.1721 npmApache 2.0
- AlicenseAqualityBmaintenanceEnables MCP-compatible clients to delegate multi-step coding tasks to an autonomous subagent that reads outlines, applies validated patches, manages workspace memory, and returns structured results with rollback and cost tracking.18Apache 2.0
- AlicenseAqualityBmaintenanceLets an MCP client hand coding tasks, second-opinion reviews, and image-asset generation to the official OpenAI CLI agent running locally, returning final messages, session IDs, and saved files. Jobs run sandboxed with prompts over stdin, work asynchronously with polling, and expose a live model catalog without needing an API key.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to delegate work to nested subagents running on Codex and Claude Code, keeping each task's session, turn history and results durable in SQLite while the main chat continues. Supports async or blocking waits, mid-session context updates, git worktree isolation, read-only-by-default permission inheritance, and cancelling whole subagent trees.MIT