opencode-delegate
Integrates Google Antigravity with OpenCode specialized models, enabling delegation of coding tasks via MCP tools and slash workflows, including model discovery, task delegation, and session continuation.
Integrates OpenAI Codex with OpenCode specialized models through a stdio MCP server, enabling delegation of coding tasks, model discovery, and session continuation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-delegatedelegate fixing the failing auth tests to deepseek, then verify"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenCode Delegation Bridge & MCP Server
Zero-dependency delegation engine, stdio MCP server, and native /oc slash workflow connecting Google Antigravity and OpenAI Codex to OpenCode specialized models (DeepSeek V4.1 Flash, GLM 5.3 Flash, MiMo 2.6, and more).
๐๏ธ Architecture & Integration Map
Google Antigravity leverages a three-tier customization system (Rules, Workflows, and Skills) alongside Model Context Protocol (MCP) servers. OpenAI Codex shares the .agents/skills/ standard and supports stdio MCP servers.
Component Layer | Workspace Path | Role in Architecture |
1. Slash Workflow ( |
| Interactive slash commands ( |
2. Escalation Rule |
| Lightweight always-on rule enforcing the 15-line threshold and prompting escalation only upon local verification failure. |
3. Progressive Skill |
| On-demand skill teaching agents structured brief generation, status recovery, and |
4. Core Relay Engine |
| Zero-dependency Node.js CLI & library: live discovery, pre/post git snapshot isolation, scope enforcement, and auto-heal loop. |
5. Thin MCP Server |
| Zero-dependency stdio JSON-RPC 2.0 MCP server exposing |
6. Persistent State |
| Stores active default model, automatic fallbacks ( |
7. MCP Registration |
| Connects the stdio server to Antigravity and Codex. |
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Google Antigravity โ
โ / OpenAI Codex โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโ
โ Stdio MCP โ Slash / Rules โ
โผ โผ โผ
[mcp-server.mjs] [.agents/rules/] [.agents/workflows/oc.md]
โ
โผ
[bridge.mjs] โโโโ Persistent Config ([opencode-models.json])
โโโ Model Discovery & Availability Guard (15-min cache)
โโโ Quota / 429 Rate-Limit Guard
โโโ Pre- & Post-Execution Git & SHA-256 Snapshot
โโโ Allowed Paths Scope Guard
โโโ Deterministic verify_cmd & Auto-Heal Loop
โ
โผ
[OpenCode CLI] (`opencode run --format json --auto`)Related MCP server: Pair
๐ Repository Structure
.
โโโ .agents/
โ โโโ mcp_config.json # MCP registration config
โ โโโ opencode-models.json # Model routing, lanes & aliases
โ โโโ rules/
โ โ โโโ opencode-escalation.md # Escalation policy
โ โโโ workflows/
โ โ โโโ oc.md # /oc slash workflow
โ โโโ skills/
โ โโโ opencode-delegate/
โ โโโ SKILL.md # Agent progressive skill
โ โโโ references/
โ โ โโโ brief-template.md # Task brief template
โ โโโ scripts/
โ โโโ bridge.mjs # Core engine & CLI
โ โโโ mcp-server.mjs # Stdio MCP server
โโโ .github/
โ โโโ workflows/
โ โโโ ci.yml # Continuous integration checks
โโโ .gitignore
โโโ LICENSE
โโโ package.json
โโโ README.mdโก Core Engine Capabilities
Model Auto-Discovery & Health Guard: Discovers live models via
opencode models, caches the results with configurable TTL (default: 15 minutes), and validates model availability prior to execution. If a model was deprecated, it halts withMODEL_UNAVAILABLEand presents live alternatives.Quota & Rate-Limit Guard (429): Detects API quota exhaustion and returns
QUOTA_EXCEEDEDalongside alternative models so the parent agent can prompt the user to pivot rather than failing silently.Pre- & Post-Execution Git & SHA-256 Snapshot: Computes SHA-256 hashes of untracked and modified files before invocation. Guarantees that pre-existing uncommitted changes are never attributed to OpenCode and verifies that OpenCode never makes unauthorized git commits.
Scope Guard: Restricts OpenCode edits to specified
allowedPaths. Out-of-scope file modifications are flagged inunexpectedFiles.Deterministic
verify_cmd& Auto-Heal Loop: Executes user-defined test, typecheck, or lint commands after OpenCode completes. If verification fails, it resumes the OpenCode session automatically up tomaxHealRetriestimes with compiler/test error output.
๐ Quickstart & Setup
Prerequisites
Node.js
>= 18.0.0OpenCode CLI (
>= 1.18.0, tested on1.19.3):npm install -g opencode-ai@latest opencode --version
1. Register MCP Server
Google Antigravity
The workspace config is ready in .agents/mcp_config.json. To register globally, append to ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"opencode-delegate": {
"command": "node",
"args": [
"/path/to/project/.agents/skills/opencode-delegate/scripts/mcp-server.mjs"
]
}
}
}OpenAI Codex
Add to ~/.codex/config.toml:
[mcp_servers.opencode_delegate]
command = "node"
args = ["/path/to/project/.agents/skills/opencode-delegate/scripts/mcp-server.mjs"]๐ ๏ธ Usage
1. Slash Command (/oc)
Inside Google Antigravity chat:
# List and discover live models
/oc models
# Set default model
/oc set default opencode/deepseek-v4.1-flash-free
# Delegate coding task (auto-fallbacks to GLM and MiMo if quota is reached)
/oc Implement email validation in src/validators.ts
# Delegate coding task with shorthand alias
/oc glm Refactor auth middleware to use JWT verification
/oc mimo Generate unit tests for utils/date.ts2. Standalone CLI (bridge.mjs)
When MCP is not connected, the bridge CLI can be called directly:
# Model Discovery & Configuration
node .agents/skills/opencode-delegate/scripts/bridge.mjs models list
node .agents/skills/opencode-delegate/scripts/bridge.mjs models refresh
node .agents/skills/opencode-delegate/scripts/bridge.mjs models set_default opencode/deepseek-v4.1-flash-free
# Delegate Task
node .agents/skills/opencode-delegate/scripts/bridge.mjs delegate '{
"brief": "Implement email validation in src/validators.ts",
"contextFiles": ["src/validators.ts"],
"allowedPaths": ["src/validators.ts", "test/validators.test.ts"],
"verifyCmd": "npm test"
}'3. Stdio MCP Tools
The MCP server exposes three JSON-RPC 2.0 tools:
opencode_models: List, refresh, and configure active default model, fallbacks, and trigger modes.opencode_delegate: Delegate tasks with context files, scope restrictions, and auto-heal verification.opencode_continue: Resume an existing session with delta instructions and review feedback.
๐งช Verification & Testing
Run the included test scripts:
# Syntax and validation check
npm test
# Test live model auto-discovery
npm run test:models
# Test unavailable model guard
npm run test:guard
# Test MCP server stdio handshake
npm run test:mcp๐ License
This project is licensed under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
- ParleyOAuthdev.weldra
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Shared control plane for AI coding agents โ tasks, memory, decisions, file locks. 12 tools.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables external agents to delegate coding tasks to a local zcode/GLM coding agent, with multi-turn sessions, model selection, and task cancellation.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables users to delegate coding tasks in a chosen project to the official Codex and Claude CLI agents from within an existing chat, then convene a council of configured models to gather independent opinions and review the resulting files and test runs. It also manages multi-provider API connections, model catalogs, and per-task token, time, and cost limits.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude and Codex agents to delegate implementation, testing, research, or review tasks to each other through local MCP tools, while supporting persistent sessions, isolated editing workspaces, and reviewed integration. It also allows progress tracking, cancellation, model selection, and management handoff between providers.MIT
- AlicenseNot gradedqualityBmaintenanceEnables delegating tasks to agents you configure yourself through OpenAI-compatible Chat Completions backends, with automatic or explicit routing, synchronous calls, persistent asynchronous jobs, and multi-step reviewed workflows. It returns proposals and analyses only, leaving file changes, command execution, and approvals under the MCP client's control.333 npmMIT