@dougbots/avenor-mcp

中文文档
0.26.0发布于 2026/11/13TypeScriptES Module构建来源已验证近 30 天下载 2660

Note: Since v0.x, avenor mcp is the canonical Go-native MCP server built into the avenor binary itself — no Node/Bun required. See docs/mcp.md for the primary MCP setup and tool reference. This Node.js package is an altern

原始使用文档
文档目录19 节
  1. When you need this
  2. Prerequisites
  3. Install
  4. Configuration
  5. stdio transport (default)
  6. SSE transport
  7. Tools
  8. spawn
  9. status
  10. result
  11. answer_permission
  12. message
  13. peers
  14. events
  15. kill
  16. shutdown
  17. workflow
  18. Typical workflow
  19. Package structure

@dougbots/avenor-mcp

Note: Since v0.x, avenor mcp is the canonical Go-native MCP server built into the avenor binary itself — no Node/Bun required. See docs/mcp.md for the primary MCP setup and tool reference. This Node.js package is an alternative for OpenCode-based setups or when you prefer npm-based tooling.

MCP server that makes avenor agent runs available as tools inside any MCP-compatible client (Claude Code, Claude Desktop, Cursor, etc.).

When you need this

You have avenor installed and you want Claude (or another MCP host) to spawn and manage agent runs — kicking off a Codex or Gemini session, checking its status, answering permission prompts, tailing event logs, and resuming completed runs.

This package is the MCP layer. It depends on @dougbots/avenor-core for all the actual wiring (supervisor lifecycle, binary discovery, socket protocol). You don't need to know the internals to use it.

Prerequisites

  • Node 20+ (or Bun — the server runs on Bun but is shipped as ESM)
  • avenor binary on your PATH, or set AVENOR_BIN=/path/to/avenor

If the binary isn't found at startup, the MCP server will fail to connect.

Install

npm install @dougbots/avenor-mcp

Or run it on-demand with npx (see configuration below).

Configuration

stdio transport (default)

Add to your MCP host config. For Claude Code, edit ~/.claude/mcp.json:

{
  "mcpServers": {
    "avenor": {
      "command": "npx",
      "args": ["@dougbots/avenor-mcp"],
      "env": {
        "AVENOR_BIN": "/opt/homebrew/bin/avenor"
      }
    }
  }
}

For Claude Desktop, use ~/.config/Claude/claude_desktop_config.json with the same shape.

Skip AVENOR_BIN if avenor is already on your PATH. On a fresh session, the supervisor auto-starts the avenor daemon the first time you call a tool.

SSE transport

When you need the MCP server running as a long-lived HTTP service (multiple clients, remote access via tunneling, etc.), use SSE mode. Set MCP_TRANSPORT=sse and provide an auth token:

MCP_TRANSPORT=sse \
MCP_AUTH_TOKEN="my-secret" \
MCP_PORT=3748 \
npx @dougbots/avenor-mcp

Then in your MCP host config:

{
  "mcpServers": {
    "avenor": {
      "url": "http://127.0.0.1:3748/mcp",
      "headers": {
        "Authorization": "Bearer my-secret"
      }
    }
  }
}

SSE mode restricts incoming requests to localhost / 127.0.0.1 / [::1] origins. The auth token is required — the server returns 401 without it.

Env variableDefaultNotes
MCP_TRANSPORT(unset → stdio)Set to sse for HTTP
MCP_PORT3748Only used in SSE mode
MCP_AUTH_TOKEN—Required in SSE mode
AVENOR_BIN—Path to the avenor binary (falls back to PATH)

Tools

This surface registers tool names without the avenor_ prefix — spawn, status, result, answer_permission, message, peers, events, kill, shutdown, and workflow. MCP clients namespace their own servers (Claude Code shows them as mcp__avenor__spawn, for example), so the prefix would only repeat itself. The avenor binary's own MCP server uses the same names.

spawn

Start a new agent run.

ParameterRequiredDescription
agentnoAgent persona to run. The backend resolves the name to a prompt, tool set, and permission policy. Direct identity field: independent of model and backend. Rejected when roster_entry is set
diryesWorking directory for the run
promptnoPrompt text (mutually exclusive with prompt_file)
prompt_filenoPath to a prompt file
labelnoHuman-readable label for this run
timeoutnoDuration string (5m, 1h, 90s)
modelnoModel override. Independent of agent and backend, so a model can be named alone; combined with agent it runs that persona on this model. Rejected when roster_entry is set
thinkingnoRun-level reasoning control; unsupported effective backends reject explicit values
backendnoRuntime backend (opencode-acp, codex-app-server, agy, pi, claude, poo, among others). Independent of agent and model; naming one avoids relying on a runtime default. Rejected when roster_entry is set
roster_filenoPath to a top-level roster map; pair it with roster_entry
roster_entrynoKey within roster_file. The entry supplies backend, agent, and model as one identity, and its optional thinking is only a default. Roster mode rejects agent, model, and backend
server_urlnoBackend server URL, required by opencode-http unless configured by environment
supervisor_idnoSupervisor ID for multi-supervisor setups

Returns { run_id, label, supervisor_id }. The run_id is what you pass to the other tools.

Direct and roster modes

Use both roster_file and roster_entry for roster mode. Every entry inside the roster file must declare backend and at least one of agent or model. A call in roster mode cannot also pass direct agent, model, or backend fields, because the entry supplies all three; the refusal names the field to drop. Direct mode permits all three identity fields to be omitted independently, including a backend-only request; omitted values use runtime defaults.

{
  "dir": "/repo",
  "prompt": "Analyze the repository",
  "roster_file": "/repo/roster.json",
  "roster_entry": "planner"
}

The roster map is strict: system and unknown entry fields are rejected. An entry's thinking is a default, so a run-level thinking still wins. Whichever value applies is validated against the effective backend chosen by direct mode or by the roster entry. A resumed session cannot switch to a different backend.

status

Get the status of one run, or list all runs. Use the compact lifecycle view for progress and pending permission checks; full remains the compatibility default.

ParameterRequiredDescription
run_idnoRun ID or label to query. Omit to list all runs.
viewnoResponse detail: lifecycle or full (default)
supervisor_idnoSupervisor ID for multi-supervisor setups

Returns a status object (or array) with status being one of running, waiting, done, failed, timeout, killed, or unknown (no status reported, or one that is not recognized). done, failed, timeout and killed are terminal; unknown is not. When a run is blocked on a permission request, the response includes a pending_permission field with the available options.

result

Wait for a run to finish and return its complete final output without transcript or event details.

ParameterRequiredDescription
run_idyesRun ID or label to await
waitnoWait for a terminal result (default true)
timeoutnoMaximum time to wait (for example 30s or 5m)
supervisor_idnoSupervisor ID for multi-supervisor setups

Terminal responses include ready: true and output when the backend exposed one. A pending permission returns immediately. If the result wait itself expires, the response has ready: false and timed_out: true without changing the run.

answer_permission

Respond to a permission prompt that paused a run.

ParameterRequiredDescription
run_idyesRun ID or label
option_idyesThe option to select (from the pending_permission shown by status)
request_idnoSpecific permission request ID. Auto-detected from the pending request if omitted.
messagenoWrite-in response text, required only when the selected option declares requiresMessage: true
supervisor_idnoSupervisor ID for multi-supervisor setups

Returns { ok: true } on success. Throws if no permission request is pending for the given run.

message

Send a message to another run, withdraw a pending ask, resume a completed run, or deliver a control reply. Cross-variant argument rules are enforced by the shared router, so an argument outside the chosen action's field set is an error rather than a silent no-op.

actionRequired fieldsWhat it does
telltarget, messageDeliver a message without creating an ask edge
asktarget, message, optional timeout_msDeliver a message and wait for a reply
replyreply_to, messageAnswer an inbound message. An ask this surface received is answered through its claim; a tell is routed back to its sender by the broker. A message id with no route reports edge-absent
resumetarget, message, optional label, idempotency_keyResume a completed run from its persisted session
withdrawmessage_idWithdraw a pending ask
control_replytarget, optional payloadDeliver a control reply where the provider supports it

target is a run id, a peer label, or "self". timeout_ms must be an integer no greater than the shared ask cap. This tool does not take supervisor_id; it is bound to the default supervisor. A router tool error is returned as an MCP error result carrying the contract sentence and a code.

Every successful result is the shared contract object in snake_case (action, outcome, text, and message_id, run_id, label, reply, sentinel_file, on_event when the outcome carries them), returned as the structured content, with the contract sentence as the text content, exactly like the Go MCP host.

peers

List the visible agent sessions, rename a run, or read a run's last agent message.

actionFieldsWhat it does
list (default)—List the visible peers
renamename, optional session_idChange a display name, self by default
lasttargetRead the target's last agent message with its stop reason

last is read-only. This surface never publishes a turn of its own, so last of the server's own session returns the shared empty result. This tool does not take supervisor_id; it is bound to the default supervisor. The structured result is {peers}, {renamed} or {last} in snake_case, the same object the Go MCP host returns.

events

Fetch the event log for a run. Useful for inspecting what an agent did.

ParameterRequiredDescription
run_idyesRun ID or label
typesnoFilter by event types (array of strings)
limitnoMax events to return (default 50, max 1000)
supervisor_idnoSupervisor ID for multi-supervisor setups

Returns an array of event objects ({ type, ts, ... }) in chronological order.

kill

Terminate a run without shutting down the supervisor. Other runs and the supervisor itself keep running.

ParameterRequiredDescription
run_idyesRun ID or label of the run to terminate
supervisor_idnoSupervisor ID for multi-supervisor setups

shutdown

Stop the avenor supervisor and clean up sentinel files.

ParameterRequiredDescription
supervisor_idnoSupervisor ID for multi-supervisor setups
forcenoForce shutdown instead of graceful (false by default)

Returns { ok: true, cleaned_up: [...] }. Use this when you're done with avenor in your session or when the supervisor crashes and needs to be restarted.

workflow

Drive a durable workflow instance. One action selects the verb; every action takes an optional supervisor_id for multi-supervisor setups. Read-only actions need no permission; gate, complete and cancel keep their authority checks.

ActionArgumentsPurpose
statusworkflow_idLightweight instance status
inspectworkflow_idFull instance detail
eventsworkflow_id, after_seq, limitThe instance's log events
waitworkflow_id, timeoutWait for a terminal state or a timeout
readycontroller_id, limitClaimable auto-dispatch candidates; grants no lease
controller_statuscontroller_idOne controller's status, or a summary list without it
gateworkflow_id, node_id, gate_id, activation_id, operation, and the operation's fieldsRecord a gate decision on a parked awaiting_gate activation
completeworkflow_id, node_id, activation_id, attempt_id, lease_id, owner_token, outcome, outputs, artifactsComplete a machine/external handoff activation
cancelworkflow_id, actor, reasonCancel the whole instance (terminal canceled)

The underlying control methods are in docs/control-protocol.md.

Typical workflow

  1. Spawn a run: spawn(agent: "codex", dir: "/path/to/project", prompt: "audit the API routes for auth gaps")
  2. Check lifecycle when needed: status(run_id: "<id>", view: "lifecycle") for progress or pending permissions.
  3. If permission requested: run answer_permission with the offered option.
  4. Retrieve the result: result(run_id: "<id>") waits and returns the complete final output.
  5. Inspect history when needed: events(run_id: "<id>") returns raw recent events.
  6. Iterate: message(action: "resume", target: "<id>", message: "now write tests for that")
  7. Clean up: shutdown() when you're finished.

Package structure

@dougbots/avenor-mcp
├── @dougbots/avenor-core  (workspace dep — supervisor, tool implementations)
├── @modelcontextprotocol/sdk  (MCP server + transports)
└── hono  (HTTP framework for SSE transport)

The server is a single file (src/mcp.ts), compiled to dist/index.js by tsdown. The avenor-mcp bin entry runs it directly.

版本与发布记录

@dougbots/avenor-mcp 共发布 49 个版本,首次发布于 2026/05/17;过去 12 个月发布了 49 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.26.0latest2026/11/13今天
0.25.02026/11/13今天
0.24.02026/11/094 天前
0.23.02026/11/057 天前
0.22.02026/11/0310 天前
0.21.02026/11/0112 天前

关于 @dougbots/avenor-mcp 的常见问题

@dougbots/avenor-mcp 是什么?

Note: Since v0.x, avenor mcp is the canonical Go-native MCP server built into the avenor binary itself — no Node/Bun required. See docs/mcp.md for the primary MCP setup and tool reference. This Node.js package is an altern

如何安装 @dougbots/avenor-mcp?

在项目目录运行 npm install @dougbots/avenor-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 avenor-mcp,可以用 npx avenor-mcp 直接运行。

@dougbots/avenor-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dougbots/avenor-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dougbots/avenor-mcp 可以商用吗?

@dougbots/avenor-mcp 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@dougbots/avenor-mcp 的下载量有多少?

根据 npm 官方下载统计,@dougbots/avenor-mcp 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,660 次,日均约 89 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dougbots/avenor-mcp 还在维护吗?

最新版本 0.26.0 发布于 2026/11/13(今天);至今共发布 49 个版本,其中过去 12 个月发布了 49 个;首次发布于 2026/05/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。