BB

birdywen/batch-runner-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 81 趋势 14MIT

我用机械期望检定的批量bash跑者做MCP。零NPM的DEPS。

概览

在一次MCP通话中运行多个bash步骤,判断每个步骤是否都达到了你的预期效果。 退出码为零仅证明命令已执行。使用omega_batch,每步都可以携带一个期望断言(contains / notContains / regex)。每一步报告为 ok、FAIL(进程)或 FAIL(期望),退出代码、信号、超时和 stderr 保持独立。失败后跳过的步骤会被标记为(停止),而不是默默消失。 零 npm 依赖。节点 >= 20。支持任何讲标准的 MCP 主机(Claude Code、opencode、Claude Desktop 等)。 然后呼叫omega_health一次。第一行是判决(健康/退化);缺少的可选部分显示为[--]。 omega_batch等待判决(最多等待Ms,默认45秒),并在同一通电话中回答。成功仅凭一句话: 失败时显示出口代码和输出,错误为: - 期望值与输出进行检查。输出超过4000字符时,会被引用到 artifact:// 引用。

概述(AI 翻译)

在一次MCP通话中运行多个bash步骤,判断每个步骤是否都达到了你的预期效果。

退出代码为零仅证明命令已执行。使用 omega_batch,每一步都可以携带 expect 断言(contains / notContains / regex]。每一步报告为 ok、FAIL (process) 或 FAIL (expectation),退出代码、信号、超时和 stderr 保持独立。失败后跳过的步骤会显示为 (halted),而非无声消失。

零 npm 依赖。节点 >= 20。支持任何讲标准的 MCP 主机(Claude Code、opencode、Claude Desktop 等)。

安装

克劳德代码:

Generic JSON config ([mcpServers):

opencode(opencode.json, mcp 部分):

然后呼叫omega_health一次。第一行是结论([HEALTHY / DEGRADED);缺少的可选部分显示为[--]。

示例

omega_batch 等待判决(最多到 waitMs,默认 45 秒),并在同一通电话中回答。成功是一行:

失败时会显示出口代码和输出的尾,其中错误为:

  • expect 与 full 输出进行检查。输出超过 4000 字符时,会发送到 artifact:// 参考。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

batch-runner-mcp

Run several bash steps in one MCP call, and know whether each one actually did what you wanted.

A zero exit code only proves a command ran. With omega_batch, every step can carry an expect assertion (contains / notContains / regex). Each step is reported as ok, FAIL (process) or FAIL (expectation), with exit code, signal, timeout and stderr kept separate. Steps skipped after a failure are listed as (halted) instead of silently disappearing.

Zero npm dependencies. Node >= 20. Works with any MCP host that speaks stdio (Claude Code, opencode, Claude Desktop, …).

Install

Claude Code:

claude mcp add batch-runner -- npx -y github:Birdywen/batch-runner-mcp

Generic JSON config (mcpServers):

{ "batch-runner": { "command": "npx", "args": ["-y", "github:Birdywen/batch-runner-mcp"] } }

opencode (opencode.json, mcp section):

{ "batch-runner": { "type": "local", "command": ["npx", "-y", "github:Birdywen/batch-runner-mcp"] } }

Then call omega_health once. The first line is the verdict (HEALTHY / DEGRADED); optional parts that are missing show as [--].

Example

{ "steps": [
  { "label": "build", "command_line": "npm run build", "expect": { "contains": ["compiled successfully"] } },
  { "label": "smoke", "command_line": "node dist/cli.js --version", "env": { "NO_COLOR": "1" }, "expect": { "regex": "^\\d+\\.\\d+" } }
], "stopOnError": true }

omega_batch waits for the verdict (up to waitMs, default 45s) and answers in the same call. Success is one line:

batch job-xxxx: success 2/2 (3.1s): build | smoke

A failure shows the exit code and the tail of the output, where errors are:

batch job-xxxx: failed 1/2 (0.4s)
  [FAIL] 1. build (process)
      exit=2
      src/a.ts(3,7): error TS2322: Type 'string' is not assignable to type 'number'.
  [--] 2. (halted) -- stopOnError
  • expect is checked against the full output. Output over 4000 chars goes to an artifact:// ref.
  • Still running after waitMs: the reply has the job id; omega_batch_status {id, waitMs} picks it up. cancel: true kills the running step’s process group.
  • Job state is on disk after every step; after a restart an unfinished job reads as interrupted.
  • format: "json" gives structured per-step fields; verbose: true adds output.

Tools

Nine tools, about 1.8k tokens of schema in total.

Tool What it does
omega_batch Bash steps with expect checks; verdict in one call
omega_batch_status Wait for / cancel a batch that outlived waitMs
omega_read Many files in one call: slices, regex-filtered lines, outlines
omega_grep path:line search (rg, grep -E fallback)
omega_edit Multi-file exact-string edits, all-or-nothing; short summary + undo id; undo:"" rolls back
vfs_local_write Atomic file write without shell quoting
omega_sqlite Read-only SQL on any sqlite file
在 GitHub 查看完整 README

安装

npx -y github:Birdywen/batch-runner-mcp
新手?先看 mcpskill.org 教程 →