gavel-mcp
gavel-mcp
El oráculo de aceptación de gavel como servidor MCP: una herramienta que convierte el "hecho" de un agente en un comprobante. gavel_acceptance ejecuta un comando en frío y notifica el código de salida. El código de salida 0 es el único veredicto que aprueba.
Configuración
1. Compilación
Requiere Node ≥ 20 y git.
cd gavel-mcp
npm install
npm run build # → dist/index.jsdist/ está en gitignore: cada clon nuevo necesita este paso antes de que el servidor pueda arrancar.
2. Integración en ZCode
Dos ámbitos; ambos se conectan automáticamente al inicio de la sesión.
Ámbito de workspace — versionado con el repositorio, compartido con el equipo. Crea <repo>/.zcode/config.json:
{
"mcp": {
"servers": {
"gavel": {
"command": "node",
"args": ["/ABS/PATH/TO/gavel-mcp/dist/index.js"]
}
}
}
}Ámbito de usuario — se aplica a todos los workspaces. Pon el mismo objeto mcp.servers en ~/.zcode/cli/config.json y combínalo con la regla de aceptación (sección 5) en ~/.zcode/AGENTS.md para que cada sesión sepa cuándo llamar a la herramienta, no solo cómo.
Una instalación de ámbito de usuario fija todos los workspaces a la compilación de esta máquina:
Después de cambiar
src/, ejecutanpm run build; las demás sesiones seguirán cargando eldist/antiguo hasta que lo hagas.Mover o eliminar el directorio del repositorio rompe todas las sesiones a la vez.
Funciona desde un remoto de git hoy mismo: no se necesita registro. El script prepare compila dist/ al instalar, así que npx se encarga del resto:
{
"command": "npx",
"args": ["-y", "github:newlix/gavel-mcp#v0.5.0"]
}Fija una etiqueta (#v0.5.0) para que la caché de npx sea estable; sin ella sigues la rama por defecto y la actualización de caché queda a discreción de npx. El primer arranque en una máquina supone un clonado + instalación + compilación únicos. Una vez publicado en npm, ["-y", "gavel-mcp"] es equivalente y omite el requisito de git. Cualquier otro host de MCP también funciona; solo difiere la forma de la configuración.
3. Reinicio de la sesión
Los servidores MCP se conectan al inicio de la sesión. Una sesión ya en ejecución no detectará el servidor.
4. Verificación
ZCode: Configuración → MCP muestra
gavelconectado.O simplemente pide al agente que llame a
gavel_acceptanceconcmd: "test -d ."— esperaverdict=pass exit=0.
5. La regla (AGENTS.md)
La herramienta es la estructura; la regla le dice al agente cuándo usarla. Coloca esto en <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.Para instalaciones de ámbito de usuario, el mismo bloque va en ~/.zcode/AGENTS.md — las instrucciones de usuario se cargan primero, así que el AGENTS.md del propio repositorio aún puede acotar la regla por proyecto.
Related MCP server: Spec Kit Acceptance Gate MCP
El contrato
El oráculo nunca se fía de un resultado parafraseado — ejecuta el comando él mismo, así que una aceptación en rojo no puede narrarse en verde. Dos capas estructurales, primero la de menor coste:
Lint (
src/lint.ts): un comando que no puede fallar (true,exit 0, echo/printf a secas,x && truesin ninguna comprobación real) se rechaza antes de ejecutarse —passed: false,refused: <reason>, no se emite ningún comprobante. Las comprobaciones de sintaxis y de patrones destructivos del linter de Go se omiten deliberadamente: la sintaxis falla de forma idéntica al ejecutarse, y vigilar comandos peligrosos es trabajo de la capa de permisos del host, no de la capa de veredicto.Ejecución en frío (
src/runner.ts): el comando se ejecuta mediante el shell de la plataforma desde la raíz del proyecto; el código de salida 0 es la única forma de aprobar. Las terminaciones por señal notifican 128+señal, fallo de spawn -1, comando no encontrado 127.
Semántica del comprobante: refused = nunca ejecutado. Repórtalo tal cual.
Herramientas
gavel_acceptance(cmd, cwd?, timeout_sec?)
→ { passed, exit_code, duration_ms, refused, output }
output: stdout+stderr combinados, sin procesar; cabeza y cola con un marcador cuando supere ~20 KB.Un timeout mata todo el árbol de procesos y hace fallar la ejecución.
Solución de problemas
Servidor no conectado (Configuración → MCP muestra un error): la ruta de dist es incorrecta o se omitió
npm run build. La ruta debe ser absoluta y apuntar adist/index.js.exit_code: 127: el propio comando de aceptación no se encontró.
Desarrollo
npm install
npm test # node:test via tsx (24 tests)
npm run build # tsc → dist/Estructura: src/index.ts es el bootstrap ligero de stdio; la interfaz MCP (buildServer) se encuentra en src/server.ts para que las pruebas puedan manejarlo en proceso a través de InMemoryTransport, más una prueba de humo de stdio en frío con tsx. La prueba de humo manual de abajo es el mismo intercambio que ejecuta la prueba de stdio.
Prueba de humo manual (MCP stdio es JSON delimitado por saltos de línea):
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.733 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 gradedqualityBmaintenanceEnables AI agents to verify claims against evidence through MCP tools, returning approved, rejected, or needs_review verdicts with replayable receipts.MIT