Connect OpenCode to Chorus
May 4, 2026 · View on GitHub
This guide walks through connecting the OpenCode CLI to a running Chorus instance via the community-maintained opencode-chorus plugin. The plugin ships Chorus MCP tools, reviewer hooks, and the Chorus skill library into OpenCode through OpenCode's native plugin mechanism.
Tip: The in-app setup wizard at Settings → Setup Guide → Open setup guide walks you through the same steps interactively, including API-key creation. Use this doc if you prefer a reference you can read end-to-end or automate.
Prerequisites
- Chorus instance running and reachable (e.g.
http://localhost:8637or a deployed URL) opencodeCLI installed (see opencode.ai/docs)- A Chorus API Key (create one in the Web UI under Settings → Agents → Create API Key). Keys start with
cho_.
Step 1: Export environment variables
export CHORUS_URL="http://localhost:8637"
export CHORUS_API_KEY="cho_your_api_key"
Add these to
~/.bashrcor~/.zshrcso OpenCode can read them on startup. Theopencode-chorusplugin readsprocess.env.CHORUS_URL(orCHORUS_BASE_URL) andprocess.env.CHORUS_API_KEYduring plugin initialization.Note on URL format:
CHORUS_URLshould be the root URL of your Chorus instance (e.g.https://chorus.example.com), without the/api/mcpsuffix. The plugin appends the MCP path internally.
Step 2: Enable the Chorus plugin
Run the one-shot installer:
curl -fsSL "$CHORUS_URL/install-opencode.sh" | bash
The script is idempotent and safe to re-run. It will:
- Verify
opencodeis installed (warns if not, but still writes the config). - Idempotently add
"opencode-chorus"to thepluginarray in~/.config/opencode/opencode.json. Existing plugin entries are preserved. - Back up the original config to
opencode.json.chorus-bak(only on first modification) and set file mode to600.
What the script does NOT do:
- It does not write to
~/.bashrc/~/.zshrc. You are responsible for exportingCHORUS_URLandCHORUS_API_KEYyourself before launchingopencode. - It does not install the plugin package. OpenCode fetches
opencode-chorusfrom npm via Bun the first time you launch it after editingopencode.json(cache lives at~/.cache/opencode/packages/opencode-chorus@latest/).
Manual alternative
If you prefer to edit the config by hand, add this to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-chorus"]
}
Merge "opencode-chorus" into any existing plugin array instead of replacing it.
Step 3: Verify the connection
Launch OpenCode:
opencode
On first launch Bun will fetch opencode-chorus from npm (this adds a few seconds the first time). Then ask the agent:
check in to chorus
The plugin will call chorus_checkin() via its MCP client and the agent will report back with your identity, permissions, and recent activity. The Chorus workflow skills (chorus, chorus-develop, chorus-proposal, chorus-review, chorus-yolo, etc.) are automatically registered under OpenCode.
Troubleshooting
-
Plugin not loaded. Clear the package cache and restart OpenCode:
rm -rf ~/.cache/opencode/packages/opencode-chorus@latestOpenCode will re-fetch the latest version from npm on next launch.
-
Environment variables not taking effect. Confirm you launched OpenCode from a shell where
CHORUS_URLandCHORUS_API_KEYare exported. Runenv | grep CHORUS_in the shell to verify. Re-source your shell rc file if needed (source ~/.zshrc). -
check innot responding. Double-checkCHORUS_API_KEYfor typos or trailing whitespace. If the plugin still fails to load on startup, try upgrading OpenCode (opencode upgrade). Theopencode-chorusplugin depends on a recent@opencode-ai/pluginSDK version. -
401 Unauthorized. API key wrong or revoked. Recreate under Settings → Agents, then updateCHORUS_API_KEYin your shell rc and restart OpenCode. -
Need to roll back? The installer saved your original config to
~/.config/opencode/opencode.json.chorus-bak. Restore with:mv ~/.config/opencode/opencode.json.chorus-bak ~/.config/opencode/opencode.json
Advanced: use a config file instead of env
If you prefer not to touch your shell rc, opencode-chorus also reads from ~/.config/opencode/chorus.json:
{
"chorusUrl": "https://chorus.example.com",
"apiKey": "cho_your_api_key"
}
Environment variables take precedence over file values when both are set. The file approach is useful for shared dev containers or when you want to keep secrets out of ~/.zshrc. Make sure to chmod 600 ~/.config/opencode/chorus.json since it contains your API key.
Next
- Workflow overview: tell the OpenCode agent
load the chorus skill - Project-level install: write the same
pluginarray into./opencode.jsonat the project root. OpenCode loads per-project configs on top of the global one. - To connect Claude Code instead, see CONNECT_CLAUDE_CODE.md
- To connect Codex, see CONNECT_CODEX.md
- For any other MCP-capable agent (Cursor, Continue, custom, etc.), see CONNECT_OTHER_AGENTS.md