Skip to content

Latest commit

 

History

History

opencode-ctl-mcp-opencode

Folders and files

README.md

opencode-ctl-mcp-opencode

An OpenCode V2 plugin that lets an OpenCode session delegate bounded work to a second 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.

It is the OpenCode front of shared/opencode-ctl; the other fronts are opencode-ctl-mcp-cc, opencode-ctl-mcp-qwen and opencode-ctl-mcp-agy. This front is a source-only bundle: plugin.ts adds a one-time pointer to the opencode-ctl-driver skill, and opencode.jsonc registers the shared opencode-ctl-cc-mcp binary with serve --host opencode. On this host service_stop and service_restart are refused.

Tested with @opencode/plugin 2.0.32. The V2 plugin API is beta; re-test on bump.

Context footprint

Installing this plugin adds ≥ 10,066 bytes to every request, for the whole session. A further ≥ 8,544 bytes load only when one of its skills or agents is actually invoked. Its plugin.ts setup module adds ≥ 976 bytes, loaded in-process with the host on every request and counted separately below so the TypeScript tier stays comparable across releases.

Tier Bytes When you pay it
Resident ≥ 10,066 Every request, for the whole session
Invocation ≥ 8,544 Only when that skill or agent runs
Setup ≥ 976 Every request — plugin.ts loads in-process with the host

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.

Installing

Follow INSTALL.md (written for an agent to execute): it fetches the plugin zip and the opencode-ctl-cc-mcp binary, runs bun add @opencode/plugin@2.0.32, merges the opencode.jsonc snippet with an absolute command and the 330000 ms execution timeout, and verifies with /opencode-ctl-mcp-opencode:opencode-ctl-doctor.

To stage the binary locally: just build-opencode-ctl-mcp-opencode.

Settings

See examples/opencode-ctl-mcp-opencode.local.md: copy it to .opencode/opencode-ctl-mcp-opencode.local.md.

Layout

plugin.ts          context hook: one-time pointer to the driver skill
opencode.jsonc     MCP server entry (serve --host opencode, OPENCODE_CTL_HOST=opencode)
skills/            opencode-ctl-driver, opencode-ctl-doctor (generated, see below)
examples/          settings example
tests/             bun tests

The skill copies are generated by opencode-ctl-cc-mcp emit-skill <name> --host opencode (just emit-opencode-ctl-skills).

Testing

$ cd opencode/plugins/opencode-ctl-mcp-opencode && bun test