feat(opencode): native opencode addon — /mcpctl switcher + live project switching + footer indicator #100
Reference in New Issue
Block a user
Delete Branch "feat/opencode-mine"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements mcpctl as an addon for opencode, mirroring the existing pi and prime-agent integrations.
What you get
Inside opencode:
/mcpctl/mcpctl-status/mcpctl-skillsmcpctl:<project>right of the model name, directly above the token counterWhy it isn't just an
mcpblock in opencode.jsonconfig claude/config prime-agentwrite the project's MCP server into the host's config and need a restart. opencode exposes an HTTP API for its own MCP registry (POST /mcp,/mcp/{name}/disconnect), so the project is mounted through the running app instead:~/.mcpctl/opencode-state.json(0600), not in a mode-0644opencode.jsonpeople paste into bug reports;opencode.jsonis never touched.Design notes
mcpctl). Tools keep a stablemcpctl_*prefix, and because opencode re-resolves the tool list per request the model just sees the new project's tools next turn — no dead-tool-name message, unlike pi.mcp.addrebuilds the connection, and mcplocal binds a gated project's unlocked state to that connection'smcp-session-id— re-adding every turn would re-lock a projectbegin_sessionhad just opened.setup before opencode's server accepts connections;
client.mcp.addcalls back into it and awaiting there hangs opencode on a blank screen.--skip-plugin --skip-marker) so token minting, state and skills stay in one place, then re-points the live mount.api.kv, which is reactive — the footer slot re-renders with no signal plumbing and is right on the first frame.session_prompt_right/home_prompt_rightrender on the prompt's bottom line, right of the model name, directly above the token counter. (app_bottomwould cost a whole terminal row;home_footerreplaces the cwd/version footer.)Also in here
skills sync --agent opencode→~/.config/opencode/skill(XDG-aware), same shared-tree semantics as pi/prime-agent, own state file.config prime-agent(mint / reuse / retire) is lifted to one place and parameterised by agent instead of copied.@opencode-ai/plugin(1.18.15) types.Verification
Full
tsc --build+typecheck:opencode-extclean. Full CLI suite passes (619 tests, incl. 26 new for embed freshness, settings,config opencode, ordering). Completions regenerated.Docs: docs/opencode-extension.md, README section.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.