OpenCode MCP integration for Claude Code.
Use OpenCode as an autonomous worker from within Claude Code — for code audits, implementation, verification, bug analysis, and plan review. OpenCode supports 75+ LLM providers (Anthropic, OpenAI, Google, Kimi, DeepSeek, Ollama, and more), giving you multi-model capabilities through a unified interface.
- Install OpenCode CLI:
curl -fsSL https://opencode.ai/install | bashOr via npm:
npm install -g opencode-ai- Authenticate with at least one provider:
opencode auth loginOr set API keys directly:
export OPENCODE_API_KEY="your-key"
export OPENAI_API_KEY="your-key"
export ANTHROPIC_API_KEY="your-key"- The plugin uses opencode-mcp as the MCP bridge (installed automatically via npx).
First, add the marketplace (once):
/plugin marketplace add lllyys/opencode-toolkit-for-claude
Then install:
/plugin install opencode-toolkit@lllyys
Choose an install scope based on your needs:
| Scope | Command | Effect |
|---|---|---|
| User (default) | /plugin install opencode-toolkit@lllyys |
Available in all your projects |
| Project | /plugin install opencode-toolkit@lllyys --scope project |
Shared with team via .claude/settings.json (committed to repo) |
| Local | /plugin install opencode-toolkit@lllyys --scope local |
Only you, only this repo (gitignored) |
Run /init inside your project to generate a .opencode-toolkit.md config file. This lets you set project-specific defaults:
- Default provider and model
- Audit focus (balanced, security-first, performance-first, quality-first)
- File patterns to skip during audits
- Project-specific instructions for OpenCode (your stack, conventions, constraints)
If no config file exists, commands use sensible built-in defaults.
| Command | Description |
|---|---|
/init |
Initialize project config — set default model, audit focus, skip patterns |
/preflight |
Check OpenCode connectivity, auth status, and discover available providers/models |
/implement |
Delegate an implementation plan to OpenCode for autonomous execution |
/audit |
Code audit — fast 5-dimension (--mini, default) or thorough 9-dimension (--full) |
/verify |
Verify that issues from a previous audit have been fixed |
/bug-analyze |
Root cause analysis for user-described bugs |
/review-plan |
Architectural review of implementation plans |
/audit-fix |
Full audit→fix→verify loop — runs until all issues are resolved or you stop |
/audit-plugin |
Audit a Claude Code plugin for schema, specification, security, and structural defects |
/continue |
Continue a previous OpenCode session — iterate on findings or request fixes |
When installed as a plugin, commands appear as
/opencode-toolkit:<command>(e.g./opencode-toolkit:audit).
Each command follows the same pattern:
- Choose model — pick a provider/model from discovered options (e.g.
opencode/big-pickle,openai/gpt-4o) - Send to OpenCode — the task is dispatched via
opencode-mcpMCP tools with a role-specific persona - Fallback — if OpenCode is unavailable or returns empty, Claude performs the task manually
- Report — structured output with findings, verdicts, session ID, and next steps
Every command output includes a session ID that you can pass to /continue to iterate on findings, request fixes, or drill deeper — without re-sending the full context.
| Feature | codex-toolkit | opencode-toolkit |
|---|---|---|
| Backend | OpenAI Codex | OpenCode (75+ providers) |
| MCP server | codex mcp-server |
opencode-mcp (npm) |
| Model format | slug (e.g. o3-pro) |
provider/model (e.g. opencode/big-pickle) |
| Session persistence | In-memory (lost on restart) | Persistent (survives restarts) |
| Sandbox levels | read-only / workspace-write / danger-full-access | Managed by OpenCode config |
| Reasoning effort | low / medium / high | N/A (model-dependent) |
| Auth | codex login or OPENAI_API_KEY |
opencode auth login or provider-specific env vars |
The /audit-fix command runs the full cycle automatically:
audit → fix → verify → (issues remain?) → fix → verify → ... → ACCEPTED
- Audits your code (mini or full — your choice)
- Sends findings to Claude or OpenCode to fix (your choice)
- Verifies each fix was actually resolved
- Repeats up to 3 rounds or until clean
- Reports final status: ACCEPTED / PARTIAL / UNCHANGED
You can also run each step manually:
/audit # find issues (defaults to --mini)
/audit --full # thorough 9-dimension audit
# fix them yourself
/verify report.md # check your fixes
Models are discovered dynamically at runtime via opencode models CLI and the opencode_setup MCP tool. New models and providers appear automatically after configuring them in OpenCode.
To check availability manually:
bash scripts/opencode-preflight.sh # JSON to stdoutOr run /preflight inside Claude Code for a human-friendly report.
This plugin bundles a .mcp.json that registers the OpenCode MCP server via npx -y opencode-mcp. The MCP bridge auto-starts opencode serve if it's not already running, providing seamless access to OpenCode's 79 tools, 10 resources, and 6 prompts.
Authentication is handled by OpenCode's own config — set API keys via opencode auth login or environment variables for your chosen providers.
This project is a redesign of codex-toolkit-for-claude by xiaolai, adapted to use OpenCode instead of OpenAI Codex. The command structure, shared partial architecture, and audit dimension frameworks are derived from the original work.