MCP server · agent-to-agent delegation

opencode‑delegate‑mcp

Let Claude Code or Codex hand the grunt work to a cheaper model via OpenCode.

Primary agentClaude Code / Codex — architecture & hard calls
delegate-mcproutes the task to a cheap model
OpenCoderuns MiniMax & friends on the busywork

Why this exists

The problem: frontier models (Claude, GPT-class) are your best tool for architecture, hard bugs, and judgment calls — and expensive overkill for the mechanical majority of real coding work: boilerplate, tests, lint/type fixes, repetitive multi-file edits. Doing all of it with your primary agent burns premium tokens and fills its context with busywork instead of the decisions that actually need it.

What this tool does: it gives your primary agent a tool to hand that busywork to a cheaper model — or a free one — running through OpenCode, without leaving your workflow. The primary agent stays focused on what matters; the cheap model grinds through the repetitive stuff and reports back. Which model does the work is a config change, not a redeploy — switch it any time.

Run the script once to install & register the server.

1 · Configure

Choose a preset to auto-fill the model, or pick Custom to type your own — a local Ollama/LM Studio model works too.

The cheap model that does the busywork. Run opencode models for the full list.

Which agents should get the delegate_* tools.

Teaches the agent when to auto-delegate. When does it delegate? →

Advanced options

Leave blank to use the calling agent's current directory.

Leave blank to auto-detect with command -v opencode.

Where the server was installed (default shown). Used to locate it when reconfiguring.

2 · Install command

One command, one paste. Copy it and run it in your terminal — it downloads and installs in a single step, no follow-up needed.

📄 Prefer to inspect the script first? Read install.sh →

🔒 This page runs entirely in your browser — nothing you type is uploaded. The installer never stores API keys; provider auth stays in OpenCode (opencode auth login).

3 · When does it delegate?

Installing the tools doesn't force your agent to use them — it decides, guided by its instruction file (CLAUDE.md for Claude Code, AGENTS.md for Codex). Tick "Delegation policy" above to install this exact table into that file — and edit it any time to change the conditions.

✅ Delegate — high volume, low risk

  • Tests for well-specified behavior (delegate_tests)
  • Boilerplate & scaffolding (CRUD, DTOs, fixtures, mocks)
  • Mechanical edits across many files (renames, prop propagation, import updates)
  • Lint / formatting / type-error fixes
  • Docstrings, comments, README / changelog sections
  • Straightforward data transforms or migrations with a clear spec
  • Obvious glue code / format conversions

⛔ Keep on the primary agent

  • Architecture, system design, choosing abstractions
  • Security-sensitive code (auth, crypto, secrets, permissions)
  • Concurrency, performance-critical paths, subtle correctness
  • Ambiguous / underspecified requirements needing judgment
  • Public API / interface design, breaking changes
  • Debugging unknown root causes
  • Anything costly or hard to detect if the edit is wrong

Rule of thumb: high volume + low risk → delegate. Low volume + high risk → keep it. Unsure → keep it.

Full guide + how to customize the conditions →

4 · After installing

  1. Make sure your provider is authenticated: opencode auth login.
  2. Restart your agent (or reload its MCP servers) so it picks up opencode-delegate.
  3. Ask it to delegate — e.g. "Use delegate_task to add tests for src/utils in this repo."
  4. Switch the cheap model any time via the Update settings tab — no reinstall.