Skip to content

Latest commit

 

History

History

opencode-ctl-mcp-cc

Folders and files

README.md

opencode-ctl-mcp-cc

A Claude Code plugin that lets Claude delegate bounded work to an OpenCode worker session over MCP: start and inspect the OpenCode service, create sessions, send prompts, wait for the turn, read the messages and the changes, and answer permission and form requests. A launcher pairs an OpenCode TUI with the Claude session so a human can watch the worker.

It is the Claude Code front of shared/opencode-ctl; the Qwen Code and Antigravity fronts are opencode-ctl-mcp-qwen and opencode-ctl-mcp-agy.

Context footprint

Installing this plugin adds ≥ 10,137 bytes to every request, for the whole session. A further ≥ 8,592 bytes load only when one of its skills or agents is actually invoked.

Tier Bytes When you pay it
Resident ≥ 10,137 Every request, for the whole session
Invocation ≥ 8,592 Only when that skill or agent runs

Bytes, not tokens. This is the exact serialised size of what the host loads, measured by probing the plugin's own MCP server and reading its skill and agent frontmatter. It is not a token count and does not convert to one at a fixed rate — treat it as a figure you can compare between plugins, not as a context budget.

≥, because hook output is excluded. Measuring it would mean executing the plugin's hooks against a synthetic event, which this tool will not do. A plugin whose hooks emit a large preamble costs more than the figure shown.

Generated by tools/plugin-footprint; regenerate with just footprint-regen.

Install

Install from the marketplace (/plugin marketplace add ckir/aiplugins, then /plugin install opencode-ctl-mcp-cc@aiplugins), or build the binary locally:

$ just build-opencode-ctl-mcp-cc

The opencode executable is looked up on PATH, then in ~/.opencode/bin; set OPENCODE_CTL_BIN to use another. The server starts and handshakes even when opencode is not installed; the tools then answer OPENCODE_NOT_FOUND.

First use

Ask Claude to delegate a task to opencode, or run the opencode-ctl-doctor skill to check the installation. The opencode-ctl-driver skill carries the delegate-and-verify workflow.

Settings

See examples/opencode-ctl-mcp-cc.local.md: copy it to .claude/opencode-ctl-mcp-cc.local.md. Protected keys and environment overrides are described there.

MCP tools

Tool Purpose
service_status, service_start, service_stop, service_restart OpenCode service lifecycle (service_stop needs confirm)
session_list, session_create, session_get, session_delete Sessions
session_prompt, session_wait, session_interrupt Run a turn, wait in slices, interrupt
session_messages, session_changes, workspace_status Read results
permission_reply, form_reply, saved_permissions Answer worker requests
opencode_operations, opencode_api Discover and call any OpenCode API operation
pair_status State of the paired TUI

session_wait blocks for one slice of wait_timeout_s (120 s by default). Claude Code's MCP_TOOL_TIMEOUT must allow at least that long, or a wait is cut off by the host before the slice ends.

Launcher

opencode-ctl-cc-mcp install-launcher links opencode-pair into a directory on PATH; opencode-pair (or opencode-ctl-cc-mcp pair) starts an OpenCode TUI paired with the Claude session, resume and attach reconnect to an existing pair, and gc removes stale pair records.

Layout

.claude-plugin/plugin.json   manifest
.mcp.json                    registers `opencode-ctl-cc-mcp serve`
src/bin/mcp.rs               thin main: all behaviour is in shared/opencode-ctl
skills/                      opencode-ctl-driver, opencode-ctl-doctor (generated, see below)
examples/                    settings example
tests/                       e2e against a mock opencode; skill copy check

The skill copies are generated by opencode-ctl-cc-mcp emit-skill <name> --host cc and pinned byte for byte by tests/skill_emit.rs.

Testing

$ cargo test -p opencode-ctl-mcp-cc

The tests drive the real serve over stdio against mock-opencode-ctl-cc (a fake opencode); no real opencode is run and the real home is never touched.