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.
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., "@Claude Code × OpenCode Delegate this bug fix to a free model and show me the changed files."
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.
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.
Available Tools
15 toolsoc_answerAnswer a permission or a questionB
Unblock a session: grant/deny a permission (request_id + decision) or answer a form (form_id + answer).
Inputs: session_id (required), answer, cancel, form_id, +3 more.
oc_apiCall any OpenCode operationC
Raw access to the whole OpenCode API (worktrees, MCP, credentials, integrations, web search, files, terminals, config…). Give an operationId (see oc_api_ops) or method+path. Path parameters are filled from params, the rest goes to the query string.
Inputs: body, path, method, params, +2 more.
oc_api_opsList OpenCode API operationsA
List the ~120 operations of the OpenCode API (operationId, method, path, parameters), with a filter. With operation, show the detailed schema of the expected body.
Inputs: search, operation.
oc_catalogOpenCode catalogB
Read what OpenCode has available: agents, skills, commands (slash), mcp (MCP servers), providers, integrations, plugins, config, projects, worktrees, websearch_providers, info.
Inputs: what (required), verbose, directory.
oc_delegateDelegate a task to OpenCodeA
Hand a task to an OpenCode agent (an autonomous sub-agent with its own tools: files, shell, web, MCP, skills). Creates a new session (or continues session_id), picks model/agent/skills, waits for the end and returns the answer, the tools used, the files changed and the cost. Write a complete brief: the agent cannot see your conversation.
Inputs: task (required), fork, wait, agent, +11 more.
oc_delegate_parallelDelegate several tasks in parallelA
Start several independent OpenCode tasks at once (one session each, with any model/agent/skills) and wait for all of them. Built for fan-out: multi-angle research, independent files, model comparison.
Inputs: tasks (required), wait, detail, timeout_s.
oc_interruptInterrupt a sessionC
Stop the current turn of an OpenCode session.
Inputs: session_id (required).
oc_modelsSearch modelsA
List the models available in OpenCode (every connected provider) with prices and variants (reasoning levels). Filter by text, provider or free only.
Inputs: limit, search, provider, free_only.
oc_pendingPending requestsA
List the permission requests and questions (forms) blocking an OpenCode session, or all of them on the server if no session is given.
Inputs: session_id.
oc_resultRead a session's resultA
Return the state and content of a session without waiting: final answer, tools, files changed, cost, and pending requests.
Inputs: session_id (required), since, detail, max_chars.
oc_sendSend a message to a sessionB
Send a follow-up message (or a slash command, or skills) to an existing OpenCode session, then wait for the answer.
Inputs: message (required), session_id (required), wait, agent, +8 more.
oc_sessionManage a sessionC
Actions on a session: info, diff (files changed), fork, compact, rename, archive, delete, set_model, set_agent, shell (run a shell command in the session), load_skill, revert (undo changes from a message on), context (context/tokens), export.
Inputs: action (required), session_id (required), value.
oc_sessionsList sessionsB
List OpenCode sessions (most recent first), filtered by directory, text or parent.
Inputs: limit, search, archived, directory, +1 more.
oc_statusOpenCode server statusB
Check the connection to the OpenCode service (starting it if needed) and report version, URL, default model and how many models, agents and skills are available.
Inputs: reconnect.
oc_waitWait for a sessionA
Wait until an OpenCode session started in the background (or unblocked) finishes, then return its result. Also stops when the agent is waiting for a permission or an answer to a question.
Inputs: session_id (required), since, detail, timeout_s.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
The core workflows are clearly separated: oc_delegate creates work, oc_send continues it, oc_delegate_parallel fans out, and oc_wait/oc_result/oc_pending differ in whether they block or inspect state. Some boundaries are softer, especially between oc_result, oc_wait, oc_pending, and oc_session info/context, and oc_api overlaps every other tool as a raw escape hatch.
All tools share an oc_ prefix and lowercase snake_case, which makes them easy to scan as a family. The convention mixes resource nouns (oc_sessions, oc_models, oc_catalog) with action verbs (oc_send, oc_wait, oc_interrupt), but the pattern remains readable.
Fifteen tools is at the upper end of the usual 3-15 range but still appropriate for an integration surface covering delegation, sessions, models, permissions, catalog, and raw API access. Each tool has a distinct role rather than padding the count.
The surface covers the full OpenCode lifecycle: starting and continuing sessions, parallel delegation, waiting/results, interruption, permission/form answers, session management, catalog discovery, model listing, and raw API access. The oc_api/oc_api_ops pair provides an escape hatch for any specialized operation not exposed directly.
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.1713 npmApache 2.0
- AlicenseBqualityBmaintenanceEnables 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.25Apache 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.53MIT
- 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