handoff-mcp
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., "@handoff-mcp handoff codex to review this code for bugs"
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.
handoff-mcp
An MCP server (and matching CLI) that lets Claude hand a task off to a peer coding-agent CLI — OpenAI's Codex or Google's Antigravity (Gemini 3) — and get the answer back inline.
Why you'd want this:
Independent second / adversarial opinion. Get a genuinely different model to poke holes in a proof, design, diff, or argument instead of Claude reviewing its own work.
Separate quota pools. Codex runs on your OpenAI/ChatGPT subscription; Antigravity runs on your Google AI Pro subscription. Handing work off preserves your Claude usage limit at no extra cost — the two peers don't touch each other's quota or Claude's.
Visual feedback. Antigravity/Gemini 3 is natively multimodal — attach a screenshot, diagram, chart, or PDF and ask what's wrong with it.
Async status. Fire a long handoff as a background job and poll it; you see the peer agent's progress stream in rather than blocking on one long call.
Be aggressive about handing off when your Claude usage limit is near. The server's tool docs instruct the calling model to lower its bar for delegating when the Claude/Fable limit is close — bulk review, long reads, second opinions, and mechanical agentic coding are all good candidates.
Backends — who's good at what
The routing guidance below is verified as of 2026-07-21. The model landscape moves fast; see Maintenance.
codex ( | antigravity ( | |
Model | OpenAI GPT-5.x-Codex | Google Gemini 3 Pro |
Quota | OpenAI / ChatGPT subscription | Google AI Pro subscription |
Best at | agentic/terminal coding (Terminal-Bench ~77% vs ~54%), long-horizon autonomous work, large refactors & migrations, adversarial code review, bug hunting, long-context reliability | visual feedback (screenshots, diagrams, PDFs), very long context (1M–2M tokens: whole monorepos / long docs), novel reasoning, cheap bulk work |
Weak at | images / diagrams / UI (text-specialized); Codex surface caps context ~400K | terminal-agentic coding; the |
Attachments | text + images | text + images + PDFs |
Rule of thumb: code / agentic / second-opinion-on-text → codex. Anything visual, or too large for a normal context window → antigravity.
Note: Google retired the open-source
geminiCLI for individual accounts on 2026-06-18 (IneligibleTierError); Pro/Ultra/free users are served by Antigravity now. That's why the Google backend here isagy, notgemini.
Related MCP server: agy-mcp
Tools
Tool | Purpose |
| Run a backend synchronously, return its answer. |
| Fire a background job, return a job id immediately. |
| Poll a job: |
| List recent jobs. |
| Install/auth readiness of each backend + a guidance-staleness banner. |
| The full model routing guide. |
handoff(prompt, backend, files=[], model="", cwd=None, approve=False, timeout=600)
prompt— self-contained instruction. The peer has none of your conversation's context.backend—"codex"or"antigravity".files— absolute/~paths. codex: text + images. antigravity: text, images, PDFs. Attachments are copied into a throwaway temp workspace — originals are never touched.model— optional id override; empty = the CLI's own default.cwd— a project dir the peer may read for extra context (never written unlessapprove=True).approve— allow the peer to make edits (codexworkspace-write; antigravityaccept-edits). DefaultFalse= read-only, right for reviews/opinions.timeout— seconds before abort.
Async pattern
job = handoff_start("deep-review this repo for races", "codex", cwd="~/proj")
# → "Started codex job a1b2c3…"
handoff_status("a1b2c3…") # poll until state != "running"Setup
1. Install the peer CLIs
Codex (OpenAI):
brew install codex # or: npm i -g @openai/codex
codex login # sign in with your ChatGPT account
codex login status # → "Logged in using ChatGPT"Antigravity (Google):
brew install --cask antigravity-cli
agy # run once, sign in with your Google (Pro) account, then quit2. Install this server
uv tool install --force ~/Documents/programming/handoff-mcpInstalls both the handoff CLI and the handoff-mcp server onto your PATH.
3. Register the MCP server with Claude Code
claude mcp add handoff -- handoff-mcpCheck everything's wired up:
handoff --status # backend install/auth + guidance freshness
handoff --guidance # the routing guideCLI usage
# adversarial code review
handoff codex "review this for correctness and edge cases" -f src/core.py
# visual feedback
handoff antigravity "what's wrong with this dashboard layout?" -f screenshot.png
# read something huge
handoff antigravity "summarize the key obligations in this contract" -f contract.pdf
# let a peer explore a whole repo (read-only)
handoff codex "is there a race condition in the job queue?" -C ~/Documents/programming/myproj
# actually let it edit (opt-in)
handoff codex "migrate this file to async/await" -f app.py --approve
# long job, tail progress until done
handoff codex "find every N+1 query" -C ~/proj --async
# health / guidance
handoff --status
handoff --guidanceConfiguration (env vars)
Var | Default | Purpose |
|
| Path/name of the Codex binary. |
|
| Path/name of the Antigravity binary. |
| (empty) | Default model override for both backends. |
|
| Default sync timeout (seconds). |
|
| Default background-job timeout (seconds). |
|
| Where job logs live. |
How it works
All logic lives in src/handoff_mcp/core.py; the MCP server (server.py) and
CLI (cli.py) are thin, DRY wrappers.
Codex is headless-native: we run
codex exec --json --skip-git-repo-check -s <sandbox> -o <last-message-file>, stream the JSONL events into a per-job log for status, and read the clean final answer from the-ofile. The prompt is fed via stdin (codex's-i/--imageflag is variadic and would swallow a trailing positional prompt).Antigravity (
agy) gates its stdout onisatty()(upstream bug: empty output in a non-TTY). We run it inside a pseudo-terminal and strip the ANSI / spinner noise back out. It also can't prompt for tool permissions headlessly, so we pass--dangerously-skip-permissions(safe: throwaway temp workspace with only file copies) and gate edits with--mode plan(read-only) vsaccept-edits.Async jobs run on background threads writing to a log file, so
handoff_statuscan return live progress and the final result across successive tool calls.
Maintenance
The strengths/weaknesses and default models reflect the model landscape as of
core.MODEL_INFO_UPDATED (2026-07-21). handoff_backends and
handoff --status print a staleness banner that escalates to a warning once
the guidance is over ~120 days old. When new Gemini / GPT / Codex versions ship,
update ROUTING_GUIDE and MODEL_INFO_UPDATED in src/handoff_mcp/core.py.
License
MIT
Available Tools
6 toolshandoffA
Hand a task off to a peer coding-agent CLI and return its answer (blocking).
Use this for tasks that finish in a few minutes. For long/agentic work,
prefer `handoff_start` + `handoff_status` so you get progress and don't block.
Choosing a backend (see `handoff_guidance` for detail):
- `codex` (OpenAI): code review, bug hunting, refactors, terminal-agentic
work, second opinion on code/text. Text & images (not PDFs).
- `antigravity` (Google Gemini 3): visual feedback (screenshots, diagrams,
PDFs), very-long-context reads (whole repos / huge docs), cheap bulk.
Hand off aggressively when the Claude/Fable usage limit is close — each
backend bills to a separate subscription pool.
Args:
prompt: What to do. The peer agent has NONE of this conversation's
context — be explicit and self-contained.
backend: "codex" or "antigravity".
files: Absolute/~ paths to attach. codex: text + images. antigravity:
text, images, and PDFs.
model: Optional model id override; empty = the CLI's own default
(e.g. "gpt-5.3-codex", "gemini-3.1-pro-preview").
cwd: A project directory the agent may read for extra context. The
process itself runs in a throwaway temp dir; originals are never
modified unless you set `approve=True`.
approve: Allow the agent to actually make edits (codex: workspace-write
sandbox; antigravity: --dangerously-skip-permissions). Default False
= read-only, right for reviews/opinions.
timeout: Seconds before abort.
Returns:
The peer agent's response, or a clear "[handoff error] …" string.
Inputs: prompt (required), backend (required), cwd, files, +3 more. Returns: result
handoff_backendsA
Report each backend's install + auth readiness, its quota pool, and a freshness note for the routing guidance.
Call this first if a handoff returns an auth/not-found error. The output
includes a `staleness` banner reminding the maintainer to refresh the model
guidance when new models ship.
Inputs: no named parameters. Returns: result
handoff_guidanceA
Return the model routing guide: which backend is best for which task, and when to hand off aggressively to preserve the Claude/Fable usage limit.
NOTE TO MAINTAINER: this reflects the model landscape as of
core.MODEL_INFO_UPDATED. Update core.ROUTING_GUIDE when new models/CLIs ship.
Inputs: no named parameters. Returns: result
handoff_jobsB
List recent handoff jobs (id, backend, state, elapsed, prompt preview).
Inputs: limit. Returns: result
handoff_startA
Start a handoff as a background job and return a job id immediately.
Use this for long or agentic handoffs (deep reviews, multi-file refactors,
reading a huge document). Then poll `handoff_status(job_id)` to watch
progress stream in and collect the result when it's `done`. This is the
async path — it lets you keep working / check in periodically instead of
blocking on one long call.
Args mirror `handoff`. Returns a short job id string (pass it to
`handoff_status`). The job's own timeout is generous (default 30 min).
Inputs: prompt (required), backend (required), cwd, files, +2 more. Returns: result
handoff_statusA
Poll a background handoff job: state, elapsed time, live progress, result.
Args:
job_id: The id returned by `handoff_start`.
tail: How many lines of streamed progress log to include.
Returns JSON with: `state` (running|done|error), `elapsed_s`, `backend`,
`log_tail` (the peer agent's streamed activity so far), and — once done —
`result` (or `error`). Call repeatedly until `state` != "running".
Inputs: job_id (required), tail. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinct job: synchronous handoff, async start, status polling, job listing, backend readiness, and routing guidance. The sync vs async pair is clearly differentiated by blocking versus job-id-returning behavior.
The handoff_ prefix creates a clear and consistent family, and all names are lowercase snake_case. The lone exception is the bare `handoff` tool, which is a minor deviation from the otherwise uniform pattern.
Six tools is well-scoped for a narrow handoff-oriented MCP server. Each tool covers a necessary part of the workflow without redundancy or bloat.
The server covers the core lifecycle: blocking handoff, async start, polling, listing, backend readiness, and routing guidance. The main missing operation is a way to cancel or abort a long-running background job.
Maintenance
Related MCP Connectors
Discover available AI models and delegate analysis or code review from your existing agent.
Task-first cross-agent collaboration for discussions, review, referrals, and reusable knowledge.
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Hand tasks, bugs and finished work to AI coding agents, and get back a write-up with evidence.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Codex to offload expensive code reading, editing, and checking to a worker agent via Claude Code, supporting async jobs and long-running tasks.MIT
- AlicenseAqualityBmaintenanceEnables Claude Code and Claude Desktop to delegate token-heavy tasks to Antigravity headless subagents, offloading file edits, test runs, and exploration while preserving Claude's context window.1224 npm1MIT
- AlicenseAqualityCmaintenanceEnables Codex to delegate bounded code analysis, review, isolated edits, multimodal research, and native image generation to supervised Antigravity workers, with queued execution, retries, and inspectable patches.232MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code and Claude Desktop to delegate coding tasks to any model available in OpenCode while Claude remains the orchestrator, planning work, reviewing diffs, and running tests. Supports synchronous and async delegation, model selection, session continuation, and permission-aware execution.6MIT