Skip to main content
Glama

trio-mcp

Claude Code, OpenAI Codex and Google Antigravity call each other over MCP. It uses the CLIs you already have installed and signed in. No API keys, no proxies.

Claude Code OpenAI Codex Google Antigravity MCP Tools Python License: MIT

English · 简体中文

Why

  • One orchestrator with specialist peers. The CLI you are working in acts as the lead. It can ask agy (Gemini) for unbiased strategy, ask claude for architecture, and hand implementation to codex.

  • Isolated background jobs. Each coding task gets its own git worktree on branch trio/<id>, and the call returns right away. You check on it later, so long jobs are not killed by the host's tool-call timeout.

  • Zero-context cross review. A new read-only reviewer reads the diff and replies PASS or REVISE on its first line. If that line is missing, the verdict is UNKNOWN. After two REVISE verdicts in a row on the same target, trio advises handing the decision to a human.

flowchart LR
    H["Orchestrator<br/>claude · codex · agy"] -->|stdio MCP| T["trio-mcp"]
    T -->|"trio_ask · read-only"| S["strategist · agy"]
    T -->|"trio_ask · read-only"| A["architect · claude"]
    T -->|"trio_dispatch · worktree"| C["coder · codex"]
    T -->|"trio_review · zero-context"| R["reviewer · codex"]

Related MCP server: agentmux

Quick start

You need Python 3.11+, git, and at least two of claude, codex, agy installed and signed in.

uv tool install git+https://github.com/lbt81957/trio-mcp.git
trio doctor                            # git + CLI login status
trio setup-mcp                         # dry run: prints what would be registered
trio setup-mcp --target all --apply    # or --target claude | codex | antigravity

--apply registers the trio stdio server with each host:

Host

Registration

Claude Code

claude mcp add -s user trio -- <trio_exe> mcp

Codex

codex mcp add trio -- <trio_exe> mcp

Antigravity

adds mcpServers.trio to ~/.gemini/config/mcp_config.json

For Codex, also add tool_timeout_sec = 900 under [mcp_servers.trio] in ~/.codex/config.toml. Otherwise Codex may cut off synchronous trio_ask and trio_review calls. Reload the host, then give it a plain request:

Ask the strategist for clearer names for the export API. Then have a coder implement it with pytest tests, get it reviewed, and summarize the diff for me.

What happens:

  1. trio_ask(role="strategist") runs agy read-only in an empty scratch directory. It can't see your code, so the prompt has to include any context it needs.

  2. trio_dispatch(role="coder") starts codex in a new worktree in the background and returns a wrk_… ID.

  3. Poll with trio_status(conv_id=..., wait_sec=110) until the job finishes. trio_review(target_conv_id=...) then reviews that worktree's diff.

  4. Check the diff and bring the worker changes back with trio_apply(conv_id=...). Once you verify the applied changes, remove the worker's copy with trio_cleanup(force=True).

You can also have an agent install trio for you. Send it: Read https://github.com/lbt81957/trio-mcp/blob/main/docs/ai-install.md and follow Step 0 to Step 9 to install, register and verify trio-mcp. The same guide covers installing into a venv without uv.

MCP tools

Tool

Purpose

trio_ask

Ask a peer a read-only question (default role strategist).

trio_reply

Continue a session by conv_id, e.g. to ask a worker for further changes.

trio_dispatch

Start a background worktree job. Options include snapshot, write_set, write_mode and accept_cmd.

trio_review

Review the repo diff, a worker via target_conv_id, or explicit files with an optional baseline_dir.

trio_status

Inspect a job with wait_sec (up to 110 seconds per call), tail_lines, full and include_diff. Shows write violations and host acceptance results.

trio_apply

Three-way merge in a temporary index, then install files with rollback on failure. Preserves the caller's index.

trio_retry

Replay the saved prompt of an eligible failed, timed-out, or empty job. The new ID is linked by retry_of.

trio_cleanup

Remove a finished worker's worktree and branch.

trio_roles

Show the active role presets after TOML overrides and the harnesses' web capabilities.

Statuses are queued, running, done, failed and timeout. A single-job lookup also returns resumable, plus a response_path that points to the full reply saved as Markdown. If a job times out, trio keeps whatever the agent had already written. Every tool except trio_retry also has a CLI command (trio ask, trio dispatch --bg, trio status, …). The CLI adds trio doctor, trio setup-mcp and trio diff <wrk_id>.

  • An empty reply from a successful CLI turn produces empty_response for an ask or a worktree dispatch with a verified clean diff. An in-place dispatch (worktree=false) finishes as done with an empty_response_unverified entry in warnings, including the exit code and output tails.

  • Dispatch retries require a verified clean saved diff and a current worktree that matches its recorded base, including the Git index and non-ignored untracked files. For in-place dispatch, inspect the checkout and submit a new job for the remaining work.

  • snapshot="working" includes tracked edits and non-ignored untracked files within a 200 MB budget. It lists skipped files in snapshot_skipped_paths and starts diffs after the snapshot commit. Set [dispatch] snapshot_max_mb or TRIO_SNAPSHOT_MAX_MB to change the budget.

  • write_set takes preferred repo-relative globs. Use ** for nested directories. Status lists violations and warns about overlapping in-place runs.

  • accept_cmd or [acceptance] cmd takes an argument array such as ["python", "-m", "pytest"] or a shell-quoted string. Trio resolves the executable outside the worker directory and runs it directly with a cleaned environment. Status records the exit code and last 50 lines when acceptance finishes.

  • Restart the MCP host after updating trio to refresh tool schemas. Server defaults come from [dispatch] allow_unsandboxed_write and [status] include_diff / full in .trio/roles.toml, or TRIO_ALLOW_UNSANDBOXED_WRITE, TRIO_INCLUDE_DIFF and TRIO_FULL. Explicit arguments override environment variables, which override TOML.

Roles

Role

Harness

Runs as

Effort

Timeout

strategist

agy

read-only, empty scratch dir

medium

600 s

architect

claude

read-only, repo root

high

1800 s

reviewer

codex

read-only, fresh session

high

1800 s

coder

codex

workspace-write, own worktree

xhigh

1800 s

trio does not hard-code any model IDs. Each CLI uses the model it is already configured with. Any call can override to, effort and timeout_sec.

  • Overrides: ~/.trio-mcp/roles.toml, then <repo>/.trio/roles.toml. Later files win. Check the merged result with trio_roles.

  • Shared context: if .trio/context.md exists, trio puts it at the start of every agent prompt, including the strategist's.

Safety model

  • Windows permits direct Claude and Antigravity writes by default and shows a sandbox warning. Set allow_unsandboxed_write=False or [harnesses.<name>] allow_unsandboxed_write = false to opt out. Direct dispatch uses the harness's normal hooks and settings.

  • Direct Claude dispatch auto-approves Bash and accepts edits in the working directory. Supply extra_read_dirs (CLI --extra-read-dir, repeatable) to grant file-tool reads from absolute local directories. Claude's editing tools deny edits there. Bash still runs with the worker's OS permissions.

  • write_mode="blocks" runs read-only, suppresses workspace hooks and plugins, and applies returned UTF-8 files. Git-ignored block outputs are included with a warning. Concurrent caller edits stop the batch.

  • Dispatch warns about write-set violations. Patch delivery requires allow_outside=True for outside-set files, always blocks reserved .git and .trio paths and unsafe links, and rolls back on failure.

  • Host acceptance launches an executable directly. On timeout, Windows stops the Job Object tree and POSIX stops the original process group. A POSIX child that starts a new session can survive.

  • Dispatch uses its own worktree by default. Trio stores state and per-worker temporary files under .trio/. Use force=True to clean up a worktree after you have preserved its edits.

  • Clean-context agy asks can create temporary files inside their conversation's scratch directory. Failed agy turns report denied actions when available and reference the CLI log under .trio/logs/.


AI install guide · 简体中文 · MIT License

Development

From the repository root, run python -m pytest -q. For a read-only checkout, set TRIO_TEST_TMPDIR to a directory writable by the sandbox. Pytest uses it for default capture, test repositories, and subprocess temporary files.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables multi-agent AI collaboration by connecting Claude Code, OpenAI Codex, and Google Antigravity, providing cross-model code reviews, independent second opinions, and autonomous validation through MCP tools.
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables any MCP host to delegate work to multiple coding-agent CLIs such as Codex, Claude Code, and Antigravity as subagents, preserving native sessions and supporting team-based supervision and agent-to-agent messaging.
      17
      19 npm
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables multiple AI agents to hold same-round discussions, approve a shared plan, split and execute file and command work in parallel, verify results, and request read-only Claude advice on failure, all through a single MCP service with dashboard and CLI access.
      MIT