Back to Browse

Agent Ex MCP Server

Developer ToolsUse Caution3.8MCP RegistryLocal
Free

Server data from the Official MCP Registry

Dispatch coding tasks to detached Claude Code / OpenCode agents and collect results.

About

Dispatch coding tasks to detached Claude Code / OpenCode agents and collect results.

Security Report

3.8
Use Caution3.8High Risk

agent-ex is an MCP server that dispatches prompts to local AI coding CLIs (claude, opencode) as detached background workers, with SQLite task state and Feishu webhook notifications. The main concern is that workers are launched with permission prompts disabled (claude --dangerously-skip-permissions, opencode --auto), so any prompt the server dispatches can act on the filesystem without confirmation. Task prompts and file contents are also sent to a third-party service (opencode.ai) on the free-model profile, which the README discloses. Supply chain analysis found 6 known vulnerabilities in dependencies (2 critical, 2 high severity). Package verification found 1 issue.

4 files analyzed · 12 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

process_spawn

Check that this permission is expected for this type of plugin.

File System Read

Reads files on your machine. Normal for tools that analyze or process local data.

File System Write

Writes or modifies files on your machine. Check that this is expected for the tool.

HTTP Network Access

Connects to external APIs or services over the internet.

env_vars

Check that this permission is expected for this type of plugin.

database

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Data directory holding config.json, .env and the task database (default: ~/.agent-ex). Run `agent-ex init` once before first use.Optional

Environment variable: AGENT_EX_HOME

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "agent-ex-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "agent-ex-mcp@0.7.0"
      ],
      "env": {
        "AGENT_EX_HOME": "your-agent-ex-home-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

agent-ex

Dispatch and review with external agents.

English README · 中文版 →

Changelog: CHANGELOG.md

agent-ex is an MCP server that treats AI coding agents (Claude Code, OpenCode, …) as external executors. You dispatch a self-contained ticket; the agent works in a detached background process and writes its result back to a SQLite-backed task store — so a long job never blocks your own conversation.

  • The npm package is agent-ex-mcp; the command it installs is agent-ex. (The -mcp suffix only avoids the registry's package-name-similarity rejection for agent-ex.)
  • The data directory is ~/.agent-ex (override with AGENT_EX_HOME).

Three collaboration shapes — all of them are just a different submit prompt, no extra tool:

ShapeHow
Delegate implementationsubmit(prompt=<self-contained ticket>) → the worker does the job → agent-ex wait brings back the result
Draft a plan independentlysubmit(prompt="read docs/ and the code, write a design to docs/plans/x.md")
Cross-reviewsubmit(prompt="review docs/plans/x.md, list concrete problems by feasibility / gaps / contradictions")

Features

  • External executors — tasks run in a detached process tree; poll with status, stop with cancel.
  • Task state machine — queued → running → (needs_input → running → …) → completed | failed | cancelled, up to 5 continuation rounds.
  • Multi-agent, multi-provider — built-in claude and opencode executors; each profile carries its own env, model and PATH additions.
  • needs_input continuation — when the agent asks a question the task parks in needs_input; feed the answer back with submit(continue_of=…).
  • Transient-error retry — 429 / 529 / 5xx / connection resets are retried (3 attempts, backoff 30s → 60s). Timeouts and hard failures are never retried.
  • Feishu (Lark) notifications — a card is pushed when a task reaches a terminal state; dry_run lets you debug without sending.
  • No secrets in config.json — the config only holds {env:VAR} placeholders; the real values live in $AGENT_EX_HOME/.env (mode 600, never in git).
  • Self-diagnosis — version reports the build's gitSha; restart makes the server exit so the host respawns it with the current build. Running workers are unaffected.

Requirements

  • Node.js >= 22.5 (the server and the runner both use node:sqlite)
  • A local agent CLI — claude or opencode. If you have neither, init offers to download opencode for you (~174 MB, MIT licence, into $AGENT_EX_HOME/runtime/) and configure it against opencode's free zen models, so no API key is needed to get started.

Security

Workers run with the agent CLI's permission prompts skipped (claude --dangerously-skip-permissions, opencode --auto). There is no second confirmation. Use it on your own machine, in directories you trust, and think about what permissions you are handing the worker.

Install

npm i -g agent-ex-mcp
# or, without installing:
npx -y agent-ex-mcp@latest init

Quick start

agent-ex init

init is interactive: it detects the agent CLIs, asks for the provider and the keys, writes config.json + .env, and then prints a ready-to-paste MCP registration snippet. Copy it into your MCP client config (Trae: TRAE SOLO CN/User/mcp.json; WorkBuddy: ~/.workbuddy/mcp.json):

When no agent CLI is found it no longer aborts: it asks whether to download a pinned opencode build instead. Non-interactive form (an AI assistant can run this for you):

npx -y agent-ex-mcp@latest init --yes                      # never downloads anything on its own
npx -y agent-ex-mcp@latest init --yes --download-opencode  # downloads opencode if none is installed

-y is accepted as a short form of --yes. Keep them apart: the first -y in npx -y is npx's "don't ask before installing this package", the second one belongs to agent-ex init.

Privacy: on opencode's free zen models, the task prompt and the files the worker reads are sent to opencode.ai. That free pool rotates and can rate-limit (429) — an affected task fails with a readable reason instead of hanging.

{
  "mcpServers": {
    "agent-ex": {
      "command": "/abs/path/to/node",          // printed by init
      "args": ["/abs/path/to/node_modules/agent-ex-mcp/dist/server.js"]
    }
  }
}

Use absolute paths. MCP clients spawn the server without inheriting your shell PATH, and node_modules/.bin is only injected for npm run / npx. With PATH=/usr/bin:/bin, a bare "command": "agent-ex" fails with command not found; an absolute path works. init prints the exact absolute paths it used — just copy them.

which node        # e.g. /Users/<you>/.nvm/versions/node/v24.18.0/bin/node

After that, just say "dispatch X to a background worker" in your conversation. When the task reaches a terminal state you get a Feishu notification (if you configured a webhook).

init re-runs are full overwrites of config.json — to change a single setting use agent-ex config set / agent-ex profile set instead. Details: init guide.

Recommended: the strong model thinks, the free model works

Keep your paid agent on the thinking — spec, plan, cross-review, sign-off — and put the executor on opencode's free zen models. One command, no key, no per-token bill for the part that types:

agent-ex profile create opencode-zen-free --use

Then drive it as a loop rather than one giant ticket: submit → agent-ex wait → verify the result yourself → submit the next one (continue_of when the worker stopped at needs_input). Serial for anything that writes files, parallel only for read-only reviews. The dispatch skill below encodes the whole routine, review gates included.

Optional: install the dispatch skill

The MCP tools are the low-level capability. The dispatch skill is the convention layered on top: when to delegate, how to write a self-contained ticket, why two write tasks must not run in the same directory, how to continue a needs_input task — and when not to delegate at all.

The skill ships inside the npm package, so installing it is one command:

agent-ex skill install

It does three things:

  1. copies skills/agent-ex-dispatch into ~/.agents/skills/agent-ex-dispatch (the shared directory of the Agent Skills spec);
  2. writes .agent-ex-skill.json next to it, recording the version and a content fingerprint — agent-ex skill status and agent-ex doctor use it to tell "which version is installed";
  3. symlinks it into every host that is present on this machine and should have it (Claude Code, Cursor, Windsurf, Trae, Trae CN, GitHub Copilot, Gemini CLI, OpenCode, Droid, Amp, Qwen Code, MiniMax Code, CodeBuddy, WorkBuddy).

Things worth knowing:

  • Version stays in sync with the CLI — the skill's version is the agent-ex-mcp version that shipped it. Published packages are immutable, so an installed skill always matches your CLI. Re-run agent-ex skill install after upgrading; it asks before replacing anything.

  • It never overwrites foreign content — if the target path already holds a real directory that agent-ex did not install, the command aborts and changes nothing.

  • Hosts that bridge themselves are skipped — WorkBuddy only scans ~/.workbuddy/skills, but most WorkBuddy installs ship an auto-bridge script (~/.workbuddy/hooks/sync-agents-skills.sh) that mirrors ~/.agents/skills itself. Without that script, name it explicitly: agent-ex skill install --agent workbuddy.

  • Hosts that read the shared directory are never linked — Codex, Cline and Zed read ~/.agents/skills itself, so a link could only point back at the canonical copy. agent-ex skill status lists them as "reads ~/.agents/skills — no link needed".

  • Pick hosts yourself with --agent — by default agent-ex links the hosts it finds on this machine (their config directory exists: ~/.claude, ~/.cursor, ~/.config/opencode, …). --agent <name> restricts the install to the hosts you name and links them without asking:

    agent-ex skill install --agent cursor --agent claude-code   # ids and aliases both work
    agent-ex skill install --agent '*'                          # every host that needs a link
    agent-ex skill remove --agent cursor                        # that host only; the rest stays
    

    An unknown name is an error — nothing gets written.

  • Non-interactive shells refuse to run it (exit code 2) unless you pass --yes: install / remove create, re-point and delete things. --yes means "answer every question with yes", not "link every host".

Inspect with agent-ex skill status (read-only), uninstall with agent-ex skill remove.

CLI commands

agent-ex is both the MCP server and the entry point for a few operational commands:

CommandWhat it does
agent-ex initInteractive onboarding (detects CLIs, writes config.json + .env). Re-running overwrites config.json; it lists the diff and asks first, and backs up the old file. If no agent CLI is installed it offers to download opencode (~174 MB, MIT) instead of aborting.
agent-ex init --yesNon-interactive: accept every default and write the config without prompting. Never downloads anything — with no agent CLI it exits 2 and prints the command to run. -y works as a short form.
agent-ex init --yes --download-opencodeSame, but allowed to download opencode when no agent CLI is found. This is the one to use when an assistant sets the machine up for you.
agent-ex doctorHealth check: aggregates the evidence for "does the notification path work" into a verdict + cause + copy-pasteable fix. Also flags a worker PATH gap (a command such as node/npm/bun/git that the worker's own PATH cannot resolve, even though your shell can) with the exact profile set ... path_dirs command to close it. Read-only.
agent-ex doctor --fixAuto-fixes deterministic defects (empty keyword, stale brand name, a plaintext webhook left in config.json). Never touches dry_run (that is your preference) nor a custom keyword (that is your bot's UI).
agent-ex doctor --sendAdditionally sends a self-test card whose body deliberately contains no product name.
agent-ex config listShows profiles / executors / notify / defaults.
agent-ex config set <key> <value>Changes one field. Whitelist: notify.dry_run, notify.keyword, defaults.timeout_sec, and executors.<name>.bin.
agent-ex profile listLists all profiles (marks the default one).
agent-ex profile use <profile>Switches the default profile.
agent-ex profile create <built-in> [--bin <path>] [--use]Materialises a built-in preset (opencode-zen-free — a zero-key opencode free-model profile). Without --use it only creates; with --use it also becomes the default profile.
agent-ex profile set <profile> <KEY> <value>Changes a profile's env, or executor (which executor it uses), path_dirs (extra absolute PATH directories for the worker), or cost (free / metered — whether dispatching to this profile may cost money).
agent-ex wait <task_id>Blocks until the task is terminal (or needs input) and prints the worker's final report.
agent-ex skill installInstalls the dispatch skill from the package and links it into the hosts that should have it. --agent <name> restricts it to the hosts you name.
agent-ex skill removeUninstalls: removes the host symlinks and the installed copy. Only symlinks — a real directory is never touched; the exit code is non-zero if anything was left behind.
agent-ex skill statusRead-only: where it is installed, which version, which hosts are not linked yet.

There is a matching agent_ex_doctor MCP tool, so an agent can diagnose itself without you copy-pasting commands.

agent-ex wait

agent-ex wait task_abc123                    # wait for a terminal state or needs_input
agent-ex wait task_abc123 --once             # check once and return
agent-ex wait task_abc123 --max-wait-sec 900 # pick your own window

stdout is machine-readable KEY=VALUE; the exit code is the contract: 0 terminal, 5 needs_input (not terminal — answer and wait again on the same id), 2 timeout, 3 not found, 6 database unreadable (an environment problem, not a task problem), 4 bad arguments. Full contract: task lifecycle.

MCP tools

ToolArgumentsReturns
agent_ex_submitprompt (required), project_path, profile, continue_of, timeout_sec, allow_metered{ task_id, status, rounds }
agent_ex_statustask_id, include_finished (0.3.1+), limittask fields; question when needs_input
agent_ex_canceltask_id (required)current state (idempotent on terminal tasks)
agent_ex_version—{ version, gitSha, buildTime }
agent_ex_doctorsend (optional)findings with severity / detail / fix
agent_ex_restart—the server exits; the host respawns it

Tool names are sometimes prefixed by the host (e.g. mcp__agent-ex__agent_ex_submit).

The server is stateless — everything lives in tasks.db. restart does not affect running workers (they live in their own process groups) nor other live server instances.

Configuration

{
  "executors": {
    "claude":   { "bin": "/abs/path/to/claude", "extra_flags": ["--dangerously-skip-permissions"] },
    "opencode": { "bin": "/abs/path/to/opencode", "extra_flags": ["--auto"] }
  },
  "profiles": {
    "minimax-3": {
      "executor": "claude",
      "cost": "metered",
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.minimaxi.com/anthropic",
        "ANTHROPIC_AUTH_TOKEN": "{env:MINIMAX_API_KEY}",
        "ANTHROPIC_MODEL": "MiniMax-M3[1m]"
      }
    }
  },
  "notify": {
    "feishu_webhook_url": "{env:FEISHU_WEBHOOK_URL}",
    "dry_run": true,
    "keyword": "agent-ex"
  },
  "defaults": { "profile": "minimax-3", "timeout_sec": 3600 }
}
FieldWhat it does
executors.<name>.binWhere the agent CLI lives — a bare command name or an absolute path both work.
profiles.<name>.envEnvironment for the agent process. {env:VAR} placeholders are resolved at task runtime. Never put PATH / NODE_OPTIONS / LD_* / DYLD_* here — that is the worker's process-loading surface, i.e. arbitrary code execution.
profiles.<name>.path_dirsExtra absolute directories appended to the worker's PATH. This is the only supported way to extend the worker's PATH. "path_dirs": [] means "no extras, deliberately" (doctor stops suggesting dirs); an absent field means "never configured" (doctor suggests them).
profiles.<name>.cost"free" or "metered" — whether dispatching to this profile may cost money. Undeclared means metered, so switching to this profile (when it is not the one currently configured) needs allow_metered: true. Declare "free" only when you are sure it costs nothing — doctor warns when it cannot verify that for you.
notify.dry_runtrue (default) prints the card to stderr instead of sending it.
notify.keywordThe keyword appended to every card. Defaults to agent-ex; it must match the keyword registered on the bot side.
defaults.profile / defaults.timeout_secDefault profile, and the per-round timeout in seconds.

Secrets never live in config.json: write {env:VAR} placeholders there and the real values into $AGENT_EX_HOME/.env (mode 600, auto-loaded by the server at startup).

Cost gate. The gate catches one shape: the agent switching to a paid profile on its own. Dispatching to the profile the user currently has configured (defaults.profile) is never blocked — that is the user's own choice, paid or not — and neither is switching to a free profile. What needs allow_metered: true is a switch to a different, metered profile, and the caller may only pass it when the user explicitly asked for that profile or agreed to pay. The flag is per dispatch: a quota error, an exhausted free pool, a timeout or a failed run is not an agreement to pay, so a failed run must not be retried with the flag added. The effective cost of every dispatch is recorded on the task row and shown by agent_ex_status and in the terminal card footer (计费档 / 免费档 / 未记录).

Full reference — every field, {model:zen-free}, the [1m] context-window trick, path_dirs, the write whitelist: configuration guide.

Notifications

Notifications go to a Feishu (Lark) custom bot webhook. The tool only supports the "keyword" security mode — do not enable signature verification, the tool does not send timestamp/sign and every card would be rejected.

Verify the path with a self-test card instead of a real task report:

agent-ex doctor --send
Feishu codeMeaning
0delivered
19024keyword mismatch — the bot's keyword and notify.keyword disagree
19021signature verification failed — the bot has "加签" enabled; turn it off
19001the webhook URL itself is invalid — copy a new one
19022IP allow-list rejected the call

Full walkthrough (bot setup, the security-mode matrix, every error code): notifications guide.

Troubleshooting

SymptomLikely cause
agent_ex_submit returns error_code: "not_initialized"This machine never ran init. Run the next_command from the response; add --download-opencode if no agent CLI (claude / opencode) is installed.
executor "claude" bin "…" not found or not executableWrong path, or the file is not +x. A bare name is resolved against process.env.PATH.
Task fails with failed to spawn runner: … ENOENTThe directory holding bin has no executable. The worker's PATH is rebuilt from dirname(bin) + path_dirs + system dirs — /opt/homebrew/bin is not included unless you declare it in path_dirs.
{env:VAR} fails with not found in process environmentThe key is neither in .env nor exported to the server process. Add it to $AGENT_EX_HOME/.env and restart the server.
Feishu sends nothingnotify.dry_run is still true; or the webhook is missing; or the bot has signature verification enabled (code=19021).
Behaviour did not change after editing codeThe MCP host reuses a long-lived server process. Rebuild, then restart, then check gitSha with version.
The skill is installed but the host does not load itRun agent-ex skill status to see which hosts are not linked, then agent-ex skill install --agent <host>.

Documentation

DocumentContents
中文版 READMEThe same guide in Chinese
配置详解Every config.json field, secrets, model resolution, worker PATH
飞书通知详解Bot setup, security modes, error codes
任务生命周期与状态机State machine, continuation, agent-ex wait contract
init 详解The onboarding wizard step by step
AGENTS.mdMaintainer guide: hard constraints, change rules
Release processnpm publish, MCP Registry submission, GitHub Release
CHANGELOG.mdVersion history

License

MIT

Reviews

No reviews yet

Be the first to review this server!