agent-ex
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., "@agent-ex dispatch a background worker to add tests for the auth module, then wait for the result"
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.
agent-ex
Dispatch and review with external agents.
English README · 中文版 →
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 isagent-ex. (The-mcpsuffix only avoids the registry's package-name-similarity rejection foragent-ex.)The data directory is
~/.agent-ex(override withAGENT_EX_HOME).
Three collaboration shapes — all of them are just a different submit prompt, no extra tool:
Shape | How |
Delegate implementation |
|
Draft a plan independently |
|
Cross-review |
|
Features
External executors — tasks run in a detached process tree; poll with
status, stop withcancel.Task state machine —
queued → running → (needs_input → running → …) → completed | failed | cancelled, up to 5 continuation rounds.Multi-agent, multi-provider — built-in
claudeandopencodeexecutors; each profile carries its own env, model and PATH additions.needs_inputcontinuation — when the agent asks a question the task parks inneeds_input; feed the answer back withsubmit(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_runlets 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 —
versionreports the build'sgitSha;restartmakes the server exit so the host respawns it with the current build. Running workers are unaffected.
Related MCP server: basic-mcp
Requirements
Node.js >= 22.5 (the server and the runner both use
node:sqlite)A local agent CLI —
claudeoropencode
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 initQuick start
agent-ex initinit 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):
{
"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, andnode_modules/.binis only injected fornpm run/npx. WithPATH=/usr/bin:/bin, a bare"command": "agent-ex"fails withcommand not found; an absolute path works.initprints 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.
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 installIt does three things:
copies
skills/agent-ex-dispatchinto~/.agents/skills/agent-ex-dispatch(the shared directory of the Agent Skills spec);writes
.agent-ex-skill.jsonnext to it, recording the version and a content fingerprint —agent-ex skill statusandagent-ex doctoruse it to tell "which version is installed";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-mcpversion that shipped it. Published packages are immutable, so an installed skill always matches your CLI. Re-runagent-ex skill installafter 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/skillsitself. 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/skillsitself, so a link could only point back at the canonical copy.agent-ex skill statuslists 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 staysAn unknown name is an error — nothing gets written.
Non-interactive shells refuse to run it (exit code 2) unless you pass
--yes:install/removecreate, re-point and delete things.--yesmeans "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:
Command | What it does |
| Interactive onboarding (detects CLIs, writes |
| Health 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 |
| Auto-fixes deterministic defects (empty keyword, stale brand name, a plaintext webhook left in |
| Additionally sends a self-test card whose body deliberately contains no product name. |
| Shows profiles / executors / notify / defaults. |
| Changes one field. Whitelist: |
| Lists all profiles (marks the default one). |
| Switches the default profile. |
| Materialises a built-in preset ( |
| Changes a profile's env, or |
| Blocks until the task is terminal (or needs input) and prints the worker's final report. |
| Installs the dispatch skill from the package and links it into the hosts that should have it. |
| Uninstalls: 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. |
| Read-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 windowstdout 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
Tool | Arguments | Returns |
|
|
|
|
| task fields; |
|
| current state (idempotent on terminal tasks) |
| — |
|
|
| findings with severity / detail / fix |
| — | 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 }
}Field | What it does |
| Where the agent CLI lives — a bare command name or an absolute path both work. |
| Environment for the agent process. |
| Extra absolute directories appended to the worker's |
|
|
|
|
| The keyword appended to every card. Defaults to |
| Default 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 --sendFeishu | Meaning |
| delivered |
| keyword mismatch — the bot's keyword and |
| signature verification failed — the bot has "加签" enabled; turn it off |
| the webhook URL itself is invalid — copy a new one |
| IP allow-list rejected the call |
Full walkthrough (bot setup, the security-mode matrix, every error code): notifications guide.
Troubleshooting
Symptom | Likely cause |
| Wrong path, or the file is not |
Task fails with | The directory holding |
| The key is neither in |
Feishu sends nothing |
|
Behaviour did not change after editing code | The MCP host reuses a long-lived server process. Rebuild, then |
The skill is installed but the host does not load it | Run |
Documentation
Document | Contents |
The same guide in Chinese | |
Every | |
Bot setup, security modes, error codes | |
State machine, continuation, | |
The onboarding wizard step by step | |
Maintainer guide: hard constraints, release process | |
Version history |
License
MIT
Available Tools
6 toolsagent_ex_cancelA
取消任务(状态感知、幂等):running 杀整个进程组;已终态则原样返回当前状态。 若返回带warning,说明进程树快照不可用(ps 被拒),组外逃逸的 agent 子进程可能残留。
Inputs: task_id (required).
agent_ex_doctorA
体检:把「通知到底通不通」的证据聚合成结论 + 病因 + 修复命令。 查三类问题:config 本身(关键词/dry_run/webhook/默认profile)、executor 的 bin 是否可执行、 历史通知失败(扫 runner 日志里的飞书拒收记录,按 code 聚合)。 send=true 会额外实发一张正文不含产品名的自检卡——验证通知必须用它, 因为飞书关键词闸门匹配整张卡片,拿真实任务报告当探针会假通过。
Inputs: send.
agent_ex_restartA
主动重启当前 MCP server 进程(process.exit,由 host 自动 respawn 并加载当前 dist)。 server 无状态、in-flight worker 在独立进程组,重启安全;只重启调用方这条连接,不影响其他 live server 或在跑任务。
Inputs: no named parameters.
agent_ex_statusA
查询任务状态。无参数调用返回全部进行中的任务,用于一次性概览; needs_input 任务会返回 question 字段。 include_finished=true 时连已结束的任务(completed/failed/cancelled)一起列,按创建时间倒序—— 会话重启或上下文压缩后要认回「上次派的任务」时用它(默认列表里只有进行中的任务)。
Inputs: limit, task_id, include_finished.
agent_ex_submitA
派发编码任务给外部 worker(detached runner),立即返回 task_id,不阻塞。 prompt 需包含完整上下文、约束与验收标准——worker 不共享当前会话上下文。 任务已提交,卡住/完成会推飞书,无需轮询。 同一 project_path 的写任务并发会互相踩文件——plan 负责串行派发或确保改动文件不重叠;只读分析任务不受此限,可并行。 对 needs_input 任务答疑续跑时传 continue_of=task_id,prompt 填答案,worker 将带着原上下文继续。 切到当前默认档(defaults.profile)以外的计费档 profile 时必须传 allow_metered=true,且只在用户本轮明确指定该 profile 或明确同意付费时传——429、额度上限、超时、失败都不构成同意。
Inputs: prompt (required), profile, continue_of, timeout_sec, +2 more.
agent_ex_versionA
返回当前 MCP server 构建元数据(version / gitSha / buildTime),用于确认重启后新代码已生效。 构建信息缺失时返回 unknown。
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
The six tools map to clearly different actions: dispatch (submit), inspect (status), stop (cancel), plus server ops (restart, version, doctor). The only mild overlap is between version and doctor, since both are 'check the system' tools, but their descriptions distinguish build metadata from notification/executor health clearly.
All tools share a consistent agent_ex_ snake_case prefix and use short, predictable suffixes. The only deviation is mixing verbs (submit, restart, cancel) with noun-style query names (status, version, doctor), which is a common and readable convention rather than an inconsistency.
Six tools sit squarely in the well-scoped range for a task-orchestration MCP server. Each tool covers a distinct concern (dispatch, inspect, cancel, restart, version, diagnostics) and none feels redundant or bolted on.
The task lifecycle is fully covered: submit, status (including finished tasks and needs_input questions), cancel, and continuation via continue_of. Operational concerns (restart, version, doctor) round it out; the main minor gap is no dedicated per-task log/result retrieval tool, relying on status or runner logs instead.
Maintenance
Related MCP Connectors
Durable background job execution, async task scheduling, and state persistence for AI agents.
Shared task layer for AI agents: tasks, handoffs and decisions that persist across tools.
Task manager for AI agents. Orchestrate agents to achieve large goals in unified control plane.
Task tracking built for coding agents. Work is leased, so two agents never take the same SubTask.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables agents to register tasks, dispatch work under explicit caller/owner credentials, amend goals, report and deliver results, read outstanding records, and manage task dependencies through a structured SQLite-backed coordination service. Ships paired collaboration skills for discussing parties and executing owners, keeping a single canonical task identity so work boards reflect the latest reports without monitoring or auto-dispatch.-
- AlicenseBqualityCmaintenanceEnables task management with persistent SQLite storage, along with tools, resources, subscriptions, prompts, and completions over stdio or Streamable HTTP with per-user authentication.9MIT
- AlicenseNot gradedqualityCmaintenanceEnables agents to manage a local SQLite task backlog over stdio, with tools to create, search, list, get, update, and stat tasks while preserving audit history and idempotency.MIT
- AlicenseNot gradedqualityBmaintenanceProvides tools for coordinating AI agent work on one machine through a local SQLite-backed queue and kanban, including task creation, atomic claiming, lease renewal, completion/failure, listing, comments, and cancellation.MIT