README.md

March 18, 2026 · View on GitHub

MCO

MCO Logo

npm version npm downloads GitHub stars License: MIT Python 3.10+ 5 built-in providers evermemos-mcp

MCO — Orchestrate AI Coding Agents. Any Prompt. Any Agent. Any IDE.

MCO equips your primary agent with an agent team: dispatch Claude, Codex, Gemini, OpenCode, and Qwen in parallel to execute tasks, review outputs, and synthesize consensus.

English | 简体中文

Claude Code Gemini CLI Codex CLI OpenCode Qwen Code OpenClaw
Claude Code Gemini CLI Codex CLI OpenCode Qwen Code OpenClaw 🦞
claude gemini codex opencode qwen openclaw

AI coding agents are now standard tools for every developer. But one agent is just one perspective.

Work like a Tech Lead: assign one task to multiple agents, run in parallel, and compare outcomes before acting.

One command. Five agents working at once.

Works with OpenClaw

Running OpenClaw on your machine? It can use MCO as its multi-agent backbone. Just tell OpenClaw what you need:

"Use mco to run a security review on this repo with Claude, Codex, and Gemini. Synthesize the results."

OpenClaw reads mco -h, learns the CLI, and orchestrates the entire workflow autonomously. Your local machine becomes a multi-agent review team — OpenClaw is the manager, MCO is the dispatcher, and Claude/Codex/Gemini/OpenCode/Qwen are the team members.

This works the same way from Claude Code, Cursor, Trae, Copilot, Windsurf, or any agent that can run shell commands.

Demo video (Bilibili): 给 OpenClaw 装上兵权:组建你自己的 AI 军团

What is MCO

MCO (Multi-CLI Orchestrator) is a neutral orchestration layer for AI coding agents. It dispatches prompts to multiple agent CLIs in parallel, aggregates results, and returns structured output — JSON, SARIF, or PR-ready Markdown. No vendor lock-in. No workflow rewrite.

With the rise of agentic coding — led by projects like OpenClaw and the broad availability of Claude Code, Codex CLI, Gemini CLI, and more — every developer now has access to powerful AI agents. MCO takes the next step: instead of relying on a single agent, you orchestrate a team.

MCO is designed to be called by any orchestrating agent or AI-powered IDE — Claude Code, Cursor, Trae, Copilot, Windsurf, or OpenClaw. The calling agent organizes context, assigns tasks, and uses MCO to fan out work across multiple agents simultaneously. For example, OpenClaw running on your machine can call mco review to dispatch code reviews to Claude, Codex, and Gemini in parallel — turning your local setup into a multi-agent review team with a single command. Agents can also orchestrate each other: Claude Code can dispatch tasks to Codex and Gemini via MCO, and vice versa.

One Agent is a Tool. Five Agents are a Team.

No single AI model sees everything. Each model has its own training data, reasoning style, and blind spots. Using just one agent is like having a team of five engineers and only asking one for their opinion.

MCO turns this into a team workflow:

  1. Assign — You give MCO a task and a list of agents. Like a Tech Lead assigning the same code review to five team members.
  2. Execute in parallel — All agents work simultaneously. Wall-clock time ≈ the slowest agent, not the sum.
  3. Review and deduplicate — MCO collects each agent's findings, deduplicates identical issues across agents, and tracks which agents found what (detected_by).
  4. Synthesize consensus — Optionally, one agent summarizes the combined results: what everyone agrees on, where they diverge, and what to do next.

In practice, different agents catch different things:

  • One agent spots a race condition in your async code but overlooks an SQL injection in the ORM layer.
  • Another finds the injection immediately but misses the race condition entirely.
  • A third catches neither of those but flags a subtle memory leak in the resource cleanup path.

These aren't hypothetical — different models genuinely have different strengths. Some are better at security analysis, some at logic flow, some at performance patterns. By running 3–5 agents in parallel on the same codebase, you get a union of perspectives rather than the intersection. The result is a more thorough review than any single agent could produce, regardless of which one you pick.

This principle extends beyond code review:

  • Architecture analysis — different agents surface different design risks and trade-offs
  • Bug hunting — broader coverage across code paths and edge cases
  • Refactoring assessment — multiple perspectives on impact and safety of proposed changes

The question isn't "which AI agent is best" — it's "why limit yourself to one?"

Key Highlights

  • Parallel fan-out — dispatch to multiple agents simultaneously, wait-all semantics
  • Any IDE, any agent — works from Claude Code, Cursor, Trae, Copilot, Windsurf, or plain shell
  • Agent-to-agent orchestration — agents can dispatch tasks to other agents through MCO
  • Dual modemco review for structured code review findings, mco run for general task execution
  • Cross-agent deduplication — identical findings from multiple agents are merged automatically with detected_by provenance
  • Consensus engine — merged findings get consensus_score = agreement_ratio × max_confidence plus confirmed / needs-verification / unverified consensus levels
  • Cross-session memory--memory flag persists findings and agent scores via evermemos-mcp, building institutional knowledge across runs
  • LLM synthesis--synthesize runs an extra pass to produce consensus/divergence summary across all agents
  • Live terminal streaming--stream live renders rich real-time terminal progress; --stream jsonl remains available for machine consumers
  • Debate mode--debate adds a second challenge round where agents critique the merged findings before final ranking
  • Divide mode--divide files|dimensions splits review work by file slices or review dimensions while preserving the existing merge + consensus pipeline
  • CI/CD integration--format sarif for GitHub Code Scanning, --format markdown-pr for PR comments
  • Environment health checkmco doctor probes binary presence, version, and auth status for all providers
  • Token usage tracking--include-token-usage for best-effort per-agent and aggregate token consumption
  • Progress-driven timeouts — agents run freely until completion; cancel only when output goes idle
  • Stateful sessionsmco session for persistent multi-turn conversations with prompt queue and cancellation
  • ACP transport--transport acp for structured JSON-RPC communication via the Agent Client Protocol
  • Custom ACP agents--agent NAME COMMAND to register any ACP-compatible binary as a provider
  • Custom agent registry.mco/agents.yaml, .mcorc.yaml, or ~/.mco/agents.yaml can register shim, ACP, or Ollama-backed agents; inspect them with mco agent list / mco agent check
  • Flexible prompt input--file path, --file - (stdin), or piped input for non-interactive workflows
  • Quiet mode--quiet for pipe-friendly output (final text only, no headers)
  • Config files.mcorc.json (project) and ~/.mco/config.json (global) for persistent defaults
  • Idempotent sessionsmco session ensure creates-or-returns a session in one call
  • Async send--no-wait returns immediately after queuing a prompt; retrieve results later via session result
  • Ctrl+C cancel — interrupt session send gracefully, automatically cancels the running prompt
  • Chain mode--chain runs providers sequentially, feeding each provider's output as context to the next for challenge-and-supplement workflows
  • Per-provider perspectives--perspectives-json assigns different review focus areas (security, performance, maintainability) to each provider
  • Consensus badges — findings show [N/M agree] in parallel mode or [confirmed by N/M] in chain mode to surface cross-agent agreement
  • Session retry with error classification — session dispatch retries retryable errors (timeout, rate limit, network) with exponential backoff; partial output preserved on timeout
  • ACP bidirectional handlers — agents can read/write files and run terminal commands through MCO
  • Extensible adapter contract — uniform interface for any CLI agent, not limited to built-in providers
  • Machine-readable output — JSON, SARIF, or Markdown output for downstream automation

What's New in v0.9

  • Consensus Engine — findings are no longer just deduplicated. Each merged finding now carries:
    • agreement_ratio = detected_by_count / total_providers_ran
    • consensus_score = agreement_ratio × max_confidence
    • consensus_level = confirmed | needs-verification | unverified
  • Real-time terminal mode--stream live adds a human-friendly TTY renderer while preserving --stream jsonl for automation.
  • Debate round--debate asks providers to challenge or refine merged findings before the final output.
  • Divide mode--divide files balances file ownership across providers; --divide dimensions assigns providers to security, performance, maintainability, correctness, and error-handling perspectives.
  • Custom agent registry — MCO can now discover custom agents from .mco/agents.yaml / ~/.mco/agents.yaml, including Ollama-backed local models.

Built-in Providers

ProviderCLIStatus
Claude CodeclaudeSupported
Codex CLIcodexSupported
Gemini CLIgeminiSupported
OpenCodeopencodeSupported
Qwen CodeqwenSupported

The adapter architecture is extensible — adding a new agent CLI requires implementing three hooks: auth check, command builder, and output normalizer.

Use Cases

ScenarioCommandWhat happens
PR code reviewmco review --format markdown-prMultiple agents review in parallel, output a PR-ready comment
Security scan in CImco review --format sarifResults upload directly to GitHub Code Scanning
Architecture analysismco run --providers claude,gemini,qwenMulti-perspective architecture assessment
Pre-deploy health checkmco doctor --jsonVerify all agents are installed and authenticated
Consensus decisionmco review --synthesizeSummarize what agents agree on and where they diverge
Debate findingsmco review --debate --providers claude,codex,geminiRun an extra challenge round before final ranking
File division reviewmco review --divide filesSplit changed files across providers, balanced by file size
Dimension division reviewmco review --divide dimensionsGive each provider a dedicated review dimension
Persistent code reviewmco review --memoryFindings accumulate across runs; agents learn what's already been flagged
Diff-only reviewmco review --diffReview only changed files vs main branch
Staged changes reviewmco review --stagedReview only git staged changes
Real-time event streammco review --stream jsonlJSONL events to stdout as providers execute
Live terminal streammco review --stream liveRich terminal progress view for interactive TTY sessions
Multi-turn sessionmco session start --provider claudePersistent session with conversation history
Cancel running promptmco session cancel my-reviewInterrupt running + queued prompts immediately
Queue statusmco session queue my-reviewShow running request ID and queue depth
Multi-session broadcastmco session broadcast "prompt"Fan out to all active sessions, aggregate results
ACP transportmco run --transport acp --providers claudeStructured JSON-RPC communication with ACP agents
Custom ACP agentmco run --agent mybot "mybot --acp"Register a temporary ACP-compatible agent; works with shim or acp transport
Prompt from filemco review --file prompt.md --providers claudeRead prompt from a file instead of inline
Piped promptcat prompt.md | mco run --providers claudeRead prompt from stdin pipe
Quiet outputmco run --quiet --providers claude --prompt "..."Print only final text, no headers
Config-driven run(uses .mcorc.json)Persistent project defaults without CLI flags
Idempotent sessionmco session ensure --provider claude --name devCreate or return existing session
Async promptmco session send dev "task" --no-waitQueue prompt and return immediately
Retrieve async resultmco session result dev 42Get result of a previously queued nowait request
Chain analysismco review --chain --providers claude,codexClaude analyzes first, Codex challenges and supplements
Perspective assignmentmco review --perspectives-json '{"claude":"security","codex":"performance"}'Each provider focuses on a different review area
List custom agentsmco agent listShow built-in + configured custom agents
Check one custom agentmco agent check my-ollamaValidate one configured agent or Ollama model wrapper

Note: --debate and --divide are mutually exclusive. Use one workflow at a time.

Debate example:

mco review \
  --repo . \
  --prompt "Review this PR and challenge weak findings before final ranking." \
  --providers claude,codex,gemini \
  --debate

Divide example:

mco review \
  --repo . \
  --prompt "Review this PR for correctness and performance issues." \
  --providers claude,codex,gemini \
  --divide dimensions

Quick Start

Install via npm (Python 3 required on PATH):

npm i -g @tt-a1i/mco

Or install from source:

git clone https://github.com/mco-org/mco.git
cd mco
python3 -m pip install -e .

Run your first multi-agent review:

mco review \
  --repo . \
  --prompt "Review this repository for high-risk bugs and security issues." \
  --providers claude,codex,qwen

Agent-Friendly CLI

MCO's CLI is fully self-describing. Run mco -h or mco review -h to see grouped flags, defaults, and usage examples — all in the terminal. This means any AI agent that can execute shell commands can learn MCO's interface autonomously by reading the help output, without requiring documentation or prior training.

In practice, you simply tell your IDE agent what you want:

"Use mco to dispatch a security review to Claude and Codex, and a performance analysis to Gemini and Qwen — run them in parallel."

The agent reads mco -h, understands the flags, composes the commands, and orchestrates the entire workflow on its own. You describe the intent; the agent handles the rest.

Usage

Review Mode

Structured code review with findings schema. Each provider returns normalized findings with severity, category, evidence, and recommendations.

mco review \
  --repo . \
  --prompt "Review for security vulnerabilities and performance issues." \
  --providers claude,codex,gemini,opencode,qwen \
  --json

Run Mode

General-purpose multi-agent execution. No forced output schema — providers complete the task freely.

mco run \
  --repo . \
  --prompt "Summarize the architecture of this project." \
  --providers claude,codex \
  --json

Doctor

Check that your agents are installed, reachable, and authenticated before running tasks:

mco doctor
mco doctor --json

Output Formats (Review Mode)

FormatFlagUse case
Human-readable report--format report (default)Terminal reading
PR Markdown--format markdown-prPost as GitHub PR comment
SARIF 2.1.0--format sarifUpload to GitHub Code Scanning
Machine JSON--jsonDownstream automation

Consensus Engine

MCO v0.9 upgrades review merging from simple deduplication into a consensus analysis layer:

  • agreement_ratio = detected_by_count / total_providers_ran
  • consensus_score = agreement_ratio × max_confidence
  • consensus_level = confirmed | needs-verification | unverified

Meaning of each level:

  • confirmed — at least 50% of providers reported the finding
  • needs-verification — 2+ providers reported it, but under 50% agreement
  • unverified — only one provider reported it

Outputs now surface this consistently:

  • JSON — each finding includes consensus_score and consensus_level
  • SARIFconfidence is mapped from consensus_score
  • Markdown — findings are grouped by consensus level
  • Chain mode — confirmed findings are rendered as confirmed-by instead of agree

Review Coordination Modes

ModeFlagWhat it does
ParalleldefaultAll providers review the same scope independently
Chain--chainRun providers sequentially; each sees prior analysis
Debate--debateRun a second challenge round on merged findings
Divide by files--divide filesEvenly distribute files across providers, prioritizing large files first
Divide by dimensions--divide dimensionsKeep the same file scope, but assign each provider a review dimension

--divide is mutually exclusive with --chain and --debate.

Result Modes

ModeBehavior
--result-mode stdoutPrint full result to stdout, skip artifact files (default)
--result-mode artifactWrite artifact files, print summary
--result-mode bothWrite artifacts and print full result

Use --save-artifacts to keep stdout mode while still writing artifacts.

Path Constraints

Restrict which files agents can access:

mco run \
  --repo . \
  --prompt "Analyze the adapter layer." \
  --providers claude,codex \
  --allow-paths runtime,scripts \
  --target-paths runtime/adapters \
  --enforcement-mode strict

Defaults and Overrides

MCO is zero-config by default. You can also persist defaults in config files:

  • Project config: .mcorc.json in the repo root
  • Global config: ~/.mco/config.json

Merge order: CLI flags > project config > global config > built-in defaults. Nested objects (like policy) are deep-merged.

Key Runtime Flags

FlagDefaultDescription
--providersclaude,codexComma-separated provider list
--stall-timeout900Cancel when no output progress for this duration (seconds)
--review-hard-timeout1800Hard deadline for review mode; 0 disables
--max-provider-parallelism00 = full parallelism across selected providers
--enforcement-modestrictstrict fails closed on unmet permissions
--strict-contractoffEnforce strict findings JSON contract (review mode)
--formatreportOutput format: report, markdown-pr, sarif (review-only for last two)
--include-token-usageoffBest-effort per-provider and aggregate token usage
--synthesizeoffRun extra LLM pass for consensus/divergence summary
--synth-providerclaudeWhich provider runs the synthesis pass
--provider-timeoutsunsetPer-provider stall-timeout overrides (provider=seconds)
--provider-permissions-jsonunsetProvider permission mapping JSON (see below)
--save-artifactsoffWrite artifacts while keeping stdout result delivery
--task-idauto-generatedStable task identifier for artifact paths
--artifact-basereports/reviewBase directory for artifact output
--memoryoffEnable cross-session memory via evermemos-mcp
--spaceautoSpace slug for memory storage (default: inferred from git remote)
--diffoffReview only changes vs merge-base with main/master
--stagedoffReview only staged changes
--unstagedoffReview only unstaged working tree changes
--diff-baseautoGit ref for branch diff (e.g. origin/main, HEAD~3). Implies --diff
--streamoffjsonl for machine-readable events, live for interactive terminal rendering
--transportshimshim (stdout parsing) or acp (Agent Client Protocol JSON-RPC)
--agentunsetTemporary custom ACP agent: --agent NAME "command". Works with shim or acp transport
--fileunsetRead prompt from file path, or - for stdin. Mutually exclusive with --prompt
--quietoffOutput only final text, no headers or formatting. Mutually exclusive with --json/--stream
--chainoffRun providers sequentially, feeding each output as context to the next
--debateoffRun a second challenge round on merged findings
--divideofffiles or dimensions task division across providers
--perspectives-jsonunsetPer-provider review perspective JSON (e.g. '{"claude":"security","codex":"performance"}')

Default provider permissions:

ProviderKeyDefault
claudepermission_modeplan
codexsandboxworkspace-write

Override example:

mco review \
  --repo . \
  --prompt "Review for bugs." \
  --providers claude,codex,qwen \
  --save-artifacts \
  --stall-timeout 900 \
  --review-hard-timeout 1800 \
  --max-provider-parallelism 0 \
  --provider-timeouts qwen=900,codex=900

Config File Example

// .mcorc.json
{
  "providers": ["claude", "codex", "gemini"],
  "transport": "acp",
  "quiet": true,
  "policy": {
    "stall_timeout_seconds": 600,
    "enforcement_mode": "best_effort",
    "max_provider_parallelism": 3,
    "chain": false,
    "perspectives": {
      "claude": "Focus on security vulnerabilities and injection attacks",
      "codex": "Focus on performance bottlenecks and resource leaks",
      "gemini": "Focus on code maintainability and design patterns"
    }
  }
}

Run mco review --help for the full flag list.

Custom Agents

Config files are loaded in priority order:

  1. .mco/agents.yaml (project-specific)
  2. .mcorc.yaml (project root)
  3. ~/.mco/agents.yaml (global)

Inspect what MCO sees:

mco agent list
mco agent check my-ollama

Example .mco/agents.yaml:

agents:
  - name: my-acp-agent
    transport: acp
    command: my-agent --acp
    permission_keys: [sandbox]

  - name: my-shim-agent
    transport: shim
    command: my-review-bot --json

  - name: my-ollama
    model: qwen2.5-coder:14b

How it works:

  • transport: acp registers a custom ACP provider
  • transport: shim registers a command-based shim provider
  • model: ... registers an Ollama-backed provider automatically

This means local Ollama models can participate in the same mco review / mco run workflows as Claude, Codex, Gemini, OpenCode, and Qwen.

Exit Codes

CodeMeaning
0Success
2FAIL / input / config / runtime error
3INCONCLUSIVE (review mode only, with --strict-contract)

How It Works

You (Tech Lead)


  mco review / mco run

     ├─→ Claude Code  ──┐
     ├─→ Codex CLI      │
     ├─→ Gemini CLI     ├─→ Consensus Engine → Debate / Synthesize → Output
     ├─→ OpenCode       │
     └─→ Qwen Code   ───┘

                    ┌─────────┼─────────┐
                    ▼         ▼         ▼
                  JSON    SARIF    Markdown-PR
               (stdout)  (CI/CD)  (PR comment)

     ↕  (with --memory)
  evermemos-mcp
  ┌─────────────────────────┐
  │ findings  · agent scores│
  │ run history · priors    │
  └─────────────────────────┘

The calling agent (or user) invokes mco with a prompt and a list of providers. MCO fans out to all selected agents in parallel and waits for all to finish.

Each provider runs as an independent subprocess through a uniform adapter contract:

  1. Detect — check binary presence and auth status
  2. Run — spawn CLI process with prompt, capture stdout/stderr
  3. Poll — monitor process + output byte growth for progress detection
  4. Cancel — SIGTERM/SIGKILL on stall timeout or hard deadline
  5. Normalize — extract structured findings from raw output

Execution model is wait-all: one provider's timeout or failure never stops others.

Retry and Resilience

  • Transient errors (timeout, rate-limit, network) are retried automatically with exponential backoff (default: 1 retry).
  • A single provider failure never blocks other providers.
  • Every invocation executes providers and returns fresh output (no result-cache replay).

Running Inside Claude Code

MCO automatically strips the CLAUDECODE environment variable before spawning provider subprocesses. You can safely run mco from within a Claude Code session.

Artifacts

When artifact writing is enabled (--save-artifacts or --result-mode artifact/both), MCO writes:

reports/review/<task_id>/
  summary.md          # Human-readable summary
  decision.md         # PASS / FAIL / ESCALATE / PARTIAL
  findings.json       # Aggregated normalized findings (review mode)
  run.json            # Machine-readable execution metadata
  providers/          # Per-provider result JSON
  raw/                # Raw stdout/stderr logs

Cross-Session Memory (Powered by evermemos-mcp)

MCO integrates with evermemos-mcp to give your agent team persistent memory across sessions. Add --memory once and MCO starts accumulating institutional knowledge: which findings were real, which agents are reliable for which task types, and what has already been fixed.

Fully opt-in — without --memory, MCO behaves exactly as before.

# Install the optional dependency
pip install mco[memory]

# Run with memory enabled
mco review \
  --repo . \
  --prompt "Review for security issues." \
  --providers claude,codex,gemini \
  --memory

What memory adds:

PhaseWhat happens
Pre-runPrior findings injected into prompt with confidence grades [HIGH]/[MEDIUM]/[LOW]
Pre-runAgent weights loaded — more reliable agents get more weight in consensus
Post-runNew findings persisted with finding hash for cross-run deduplication
Post-runAgent scores updated (cross-validation: agents that agree get higher reliability)
Post-runPassively fixed findings auto-confirmed (disappeared + file changed = fixed)

Finding lifecycle:

open → passive_fix_candidate → fixed

         (rejected / wontfix / accepted)

A finding that disappears when its file was changed is marked passive_fix_candidate. If it stays absent a second consecutive run, it's auto-confirmed as fixed — no manual intervention needed.

Agent reliability:

MCO tracks each agent's cross-validation rate per task category (security, performance, logic, architecture, style). Agents that consistently agree with others on real findings build up higher reliability scores. Cold-start blends repo-specific, tech-stack, and global baseline scores until enough runs accumulate.

Memory Subcommands

mco memory status                      # Memory spaces and finding/score counts
mco memory agent-stats                 # Per-agent reliability scores
mco memory priors --category security  # Blended agent weight priors for a task type

mco findings list                      # All persisted findings
mco findings list --status open        # Filter by status
mco findings confirm <hash>            # Manually mark a finding as fixed

Storage Design

  • Backend: evermemos-mcp via uvx evermemos-mcp@latest (append-only, MCP stdio protocol)
  • Finding hash: sha256(repo + file_path + category + normalize(title)) — stable across runs, independent of line numbers or severity changes
  • Spaces: coding:<slug>--findings, coding:<slug>--agents, coding:<slug>--context, coding:stacks--<tech>, coding:global--agents
  • Deduplication: client-side latest-wins on read; all writes are appends

Requires EVERMEMOS_API_KEY environment variable. See mco review --help for --space and other memory flags.

MCP Server Mode

MCO can run as an MCP server, allowing AI agents and MCP-compatible clients to call MCO tools programmatically over stdio.

pip install mco[memory]  # includes mcp dependency

Configure in your MCP client:

{
  "mcpServers": {
    "mco": {
      "command": "mco",
      "args": ["serve"]
    }
  }
}

Available tools: mco_review, mco_run, mco_doctor, mco_findings_list, mco_memory_status

All tools return a uniform envelope: {"ok": true, "data": ...} on success, {"ok": false, "error": {"code": "...", "message": "..."}} on failure.

License

MIT — see LICENSE