gavel-mcp
gavel-mcp
Оракул приёмки gavel как MCP-сервер: один инструмент, который превращает «готово» агента в квитанцию. gavel_acceptance холодно запускает команду и сообщает код возврата. Код возврата 0 — единственный проходной вердикт.
Настройка
1. Сборка
Требуются Node ≥ 20 и git.
cd gavel-mcp
npm install
npm run build # → dist/index.jsdist/ игнорируется git — в каждой свежей копии репозитория этот шаг обязателен, прежде чем сервер сможет запуститься.
2. Подключение к ZCode
Есть две области действия; обе подключаются автоматически при старте сессии.
Область рабочего пространства — версионируется вместе с репозиторием и доступна всей команде. Создайте <repo>/.zcode/config.json:
{
"mcp": {
"servers": {
"gavel": {
"command": "node",
"args": ["/ABS/PATH/TO/gavel-mcp/dist/index.js"]
}
}
}
}Область пользователя — действует для каждого рабочего пространства. Поместите тот же объект mcp.servers в ~/.zcode/cli/config.json и добавьте к нему правило приёмки (раздел 5) в ~/.zcode/AGENTS.md, чтобы каждая сессия знала, когда вызывать инструмент, а не только как.
Установка в область пользователя привязывает все рабочие пространства к сборке этой машины:
После изменения
src/запуститеnpm run build— остальные сессии продолжат загружать старыйdist/, пока вы этого не сделаете.Перемещение или удаление каталога репозитория сразу ломает все сессии.
Сегодня работает из удалённого git-репозитория — реестр не нужен. Скрипт prepare собирает dist/ при установке, поэтому остальное берёт на себя npx:
{
"command": "npx",
"args": ["-y", "github:newlix/gavel-mcp#v0.5.0"]
}Зафиксируйте тег (#v0.5.0), чтобы кэш npx был стабильным; без него вы следуете за веткой по умолчанию, а обновление кэша остаётся на усмотрение npx. Первый запуск на машине требует однократного клонирования, установки и сборки. После публикации в npm ["-y", "gavel-mcp"] эквивалентен и снимает требование к git. Любой другой MCP-хост тоже работает; отличается только форма конфигурации.
3. Перезапуск сессии
MCP-серверы подключаются при старте сессии. Уже запущенная сессия не подхватит сервер.
4. Проверка
ZCode: Settings → MCP показывает, что
gavelподключён.Или просто попросите агента вызвать
gavel_acceptanceсcmd: "test -d ."— ожидайтеverdict=pass exit=0.
5. Правило (AGENTS.md)
Инструмент — это структура; правило сообщает агенту, когда его использовать. Поместите это в <repo>/AGENTS.md:
## Acceptance
- Done = `gavel_acceptance` returned exit 0. One self-contained
command, cold from the repo root; report the verdict and the
command itself — never a paraphrase of test results.
- The command asserts intent (what should happen), not the
implementation.
- `refused` means it never ran. Report it verbatim.Для установки в область пользователя тот же блок помещается в ~/.zcode/AGENTS.md — пользовательские инструкции загружаются первыми, поэтому собственный AGENTS.md репозитория может дополнительно сузить правило для конкретного проекта.
Related MCP server: Spec Kit Acceptance Gate MCP
Контракт
Оракул никогда не доверяет перефразированному результату — он сам выполняет команду, поэтому красную приёмку нельзя описать как зелёную. Два структурных уровня, сначала самый дешёвый:
Линт (
src/lint.ts): команда, которая не может завершиться ошибкой (true,exit 0, голые echo/printf,x && trueбез реальной проверки), отклоняется до выполнения —passed: false,refused: <reason>, квитанция не выпускается. Проверки синтаксиса и деструктивных паттернов из Go-линтера намеренно опущены: синтаксис при выполнении падает точно так же, а контроль опасных команд — задача уровня разрешений хоста, а не уровня вердикта.Холодный запуск (
src/runner.ts): команда выполняется через системную оболочку из корня проекта; код возврата 0 — единственный признак успеха. Завершения по сигналу сообщаются как 128+signal, сбой запуска — -1, команда не найдена — 127.
Семантика квитанции: refused — команда не выполнялась. Передавайте его дословно.
Инструменты
gavel_acceptance(cmd, cwd?, timeout_sec?)
→ { passed, exit_code, duration_ms, refused, output }
output: объединённые stdout+stderr, как есть; начало и конец с маркером, если длина больше ~20 KB.Тайм-аут убивает всё дерево процессов и завершает запуск ошибкой.
Устранение неполадок
Сервер не подключён (Settings → MCP показывает ошибку): неверный путь к dist или пропущен
npm run build. Путь должен быть абсолютным и указывать наdist/index.js.exit_code: 127: сама команда приёмки не найдена.
Разработка
npm install
npm test # node:test via tsx (24 tests)
npm run build # tsc → dist/Структура: src/index.ts — это тонкий stdio-загрузчик; MCP-интерфейс (buildServer) находится в src/server.ts, чтобы тесты могли управлять им в том же процессе через InMemoryTransport, плюс один холодный смоук-тест stdio через tsx. Ручной смоук-тест ниже — это тот же обмен, который выполняет stdio-тест.
Ручной смоук-тест (MCP stdio — это JSON, разделённый переводами строк):
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"gavel_acceptance","arguments":{"cmd":"test -d ."}}}' \
| node dist/index.jsAvailable Tools
1 toolgavel_acceptanceA
Run an acceptance command cold and report the mechanical verdict. The command must be one self-contained shell command; it runs from the project root via the platform shell. Exit code 0 is the only passing verdict — never paraphrase or pre-empt it. Signal deaths report 128+signal; a spawn failure reports -1; 127 means the command was not found. Output is raw merged stdout+stderr (head+tail when truncated).
| Name | Required | Description | Default |
|---|---|---|---|
| cmd | Yes | Self-contained acceptance command, e.g. `go test ./...` or `make check`. Must assert intent, not recapitulate the implementation. | |
| cwd | No | Absolute working directory. Default: the server's cwd (hosts spawn it at the workspace root). | |
| timeout_sec | No | Kill the run after this many seconds (default 600). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does so thoroughly. It discloses exit-code semantics (0 = pass, 128+signal = signal death, -1 = spawn failure, 127 = not found), raw merged stdout+stderr, truncation behavior, and the 'cold'/mechanical nature of the run. This goes well beyond a generic 'run a command' statement.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is dense but well-organized and front-loaded: the core action appears first, followed by the necessary command constraint, verdict semantics, and output details. Every sentence earns its place; there is no filler or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having no output schema and no annotations, the description fully covers what an agent needs to invoke the tool correctly: command format, working directory, exit-code interpretation, and output shape. It is complete for the tool's complexity and parameter set.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and every parameter (cmd, cwd, timeout_sec) is already documented in the schema with type, constraints, and defaults. The tool description mainly reinforces that the command must be self-contained, which adds marginal value but does not improve on the schema's parameter-level explanations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource: 'Run an acceptance command cold and report the mechanical verdict.' It makes clear this is a command-execution tool focused on acceptance verification, and the absence of sibling tools means there is no risk of confusion with alternatives.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives concrete usage constraints: the command must be a single self-contained shell command, runs from the project root, and the agent must not paraphrase or pre-empt the exit-code verdict. With no sibling tools listed, there is no alternative-routing guidance needed, but the when-and-how guidance is otherwise strong.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.5.0- First observed
gavel_acceptance
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of an agent confusing it with another. Its purpose is clearly distinct by default.
With a single tool there are no conflicting conventions to penalize. The name gavel_acceptance is clear and follows snake_case, though it is noun-oriented rather than a verb_noun pattern.
One tool is minimal, but the server appears purpose-built for a single acceptance action, so the count is slightly under the typical range yet reasonable for the stated scope.
The tool fully covers the server's apparent purpose: running an acceptance command and returning a mechanical verdict with well-specified exit-code and output handling. No obvious operations are missing for this narrow domain.
Maintenance
Related MCP Connectors
Proof of delivery for agent work: verify countersigned receipts and deliverable hashes. Free.
Agent completion verification with defects, corrections, and evidence receipts.
Hand off AI work with a signed Verification Receipt — an independent verifier proves it runs.
Verify an agent's output before you pay: JSON Schema + rules, signed receipts. Free during launch.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables acceptance gates for AI coding-agent runs by recording evidence, running deterministic validation, applying a quality gate, and rendering auditable outcomes.760 PyPIApache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables spec-driven development acceptance gate with structured receipts, audit logs, and reviewer-ready evidence.-
- FlicenseNot gradedqualityBmaintenanceEnables coding agents to submit a public preview URL and acceptance stories for independent QA, returning pass/fail evidence packs with screenshots and supporting human notes on failures.-
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to verify claims against evidence through MCP tools, returning approved, rejected, or needs_review verdicts with replayable receipts.MIT