MCP and judge-cli for agents
crates/agent exposes the pipeline to other programs in two transports over one set of
operations. judge-mcp is an MCP server on stdio. judge-cli has one subcommand
per operation and prints JSON. judge-api --mcp also serves the same MCP tools over HTTP
at /mcp, for agents that are not on the host. It needs an MCP_TOKEN too, and the flag
without a token is refused at startup.
Pipeline and sessions
Section titled “Pipeline and sessions”judge runs the built-in pipeline: extraction and synthesis on the configured models,
citation validation, one retry. It spends model budget under the process’s JUDGE_MAX_USD
and, over /mcp, counts against MCP_JUDGE_LIMIT.
Sessions turn the pipeline inside out. The agent asks for a session, receives the
extraction prompt and answers it itself. It then receives the synthesis prompt, rendered
from the same retrieved context the bot would use. It may ask for one round of extra
rules. Then it submits a verdict, which is admitted only through the same citation
validation, with the same rejection notice and one retry. The judge makes no model call,
because the agent is the model. This is how Claude Code answers rules questions in this
repository (the judge skill under .claude/skills/), and how a reported bad answer is
reproduced for free.
judge-cli begin "does bob's trigger count goyf's mana value as 0?" # → session id + extraction promptjudge-cli extract <session> extraction.json # the agent's extraction → synthesis promptjudge-cli rules <session> 202.3 702.19 # optional, oncejudge-cli verdict <session> verdict.json --persist # validated, or a rejection to correctSession-persisted calls are thread history only. Nothing can rate them, so the prior-call
leg never shows them as examples. Session thread ids carry an agent: prefix that a
Discord thread id cannot have, so a session cannot read a channel’s history.
Lookups
Section titled “Lookups”card <name>, card-info <uuid>, get-rules <id>..., search <query> [--limit N] and
glossary <term> query the database directly and cost nothing. config prints the
resolved provider and model setup with secrets redacted. about prints the source offer:
the repository holding this instance’s source, the commit it was built from, the licence
and copyright. Over MCP the same offer is the tail of the server’s initialization
instructions and the about tool, so a client sees it before calling anything.
Connecting an MCP client
Section titled “Connecting an MCP client”Locally, .mcp.json in the repository starts target/release/judge-mcp for Claude Code
(cargo build --release -p judge-agent first). Remotely:
claude mcp add --transport http judge https://judge.example.com/mcp \ --header "Authorization: Bearer <MCP_TOKEN>"MCP_ALLOWED_HOSTS must name the public hostname, and the token must be at least 24
printable ASCII bytes. The deployment runbook
covers the rest.
MTG Judgebot is unofficial Fan Content permitted under the Fan Content Policy. Not approved or endorsed by Wizards of the Coast. Portions of the materials used are property of Wizards of the Coast. ©Wizards of the Coast LLC.
The Comprehensive Rules come from Wizards of the Coast. Card data, rulings and card symbols come from Scryfall, which is not affiliated with this project. Rule links go to the Yawgatog mirror. License and attribution.