Repository navigation
Brain MCP
bin/brain-mcp is an MCP server over stdio that lets a Claude session read and write the Brain database. It is newline-delimited JSON-RPC 2.0 and uses the Python standard library only.
Every tool runs the brain CLI next to it as a subprocess with an argument list, never a shell. The schema and the rules stay in one place. A nonzero exit becomes a tool result with isError true and the stderr text.
bin/brain-mcp --self-testThe plugin registers it. .claude-plugin/plugin.json carries:
"mcpServers": {
"brain": { "command": "${CLAUDE_PLUGIN_ROOT}/bin/brain-mcp" }
}With the plugin enabled there is nothing to set up. The server uses the same LEAN_BRAIN_DB as the CLI.
| Tool | What it does |
|---|---|
brain_list |
List items. Optional filters: open, status, project, kind, tag, cycle. |
brain_show |
Show one item in full by id. |
brain_add |
Add an item, or bump the count of an open one with the same project, kind and ref. Needs project, kind, ref. |
brain_close |
Close an item by id, with optional resolution, note and wontfix. |
brain_queue_list |
List test jobs, filtered by status or cycle. |
brain_queue_add |
Queue a test job. Returns the job id at once. Do not wait for it. |
brain_queue_cancel |
Cancel a queued job and the jobs waiting on it. |
brain_queue_bump |
Move a queued job, and the jobs chained after it, to the front. |
brain_queue_route |
Choose which lanes may run a queued job: remote, local or any. |
brain_stats |
Run counts, flaky rate and durations as JSON. |
- A required string that starts with a dash (
project,kind,ref,repo_dir,test_project,to). Brain would read it as an option. Optional values go as--flag=value, so a title or note may start with a dash. - A non-integer
id,afteror job id. -
brain_queue_addwith atierother thanfastorfull. -
brain_queue_addwith afilterthat is not class names joined by|. Each piece is checked, becausetest-phasesplits the filter on|and hands each piece to dotnet. Allowed characters are letters, digits and_ . * ~and a few others. -
brain_queue_addwith extra dotnet arguments. There is no such parameter and--argsis never passed. Those arguments run on the drainer's machine, so they stay a shell-only choice. -
brain_queue_addwhererepo_diris not the top folder of a git work tree. A queued job builds and runs that folder's code, and a remote lane copies its files, so a scratch folder is refused. A subfolder of a repository is refused too. -
brain_queue_routewithtoother thanremote,localorany. - Any extra property. Every tool schema sets
additionalPropertiesto false.
Jobs queued through MCP are recorded as enqueued by mcp.
A body goes to brain on stdin (--body-file -), never on the command line. The self-test proves it with BRAIN_MCP_ARGV_LOG=FILE, which appends the argv of every brain call to a file as one JSON line. The server logs to stderr only.
Only the drainer claims and finishes jobs. bin/test-phase claims one job at a time with queue next, runs it, and records the result with queue finish. The tools a session gets cover queueing, reordering, routing and cancelling only. The self-test checks that brain_queue_next is an unknown tool and that no next or finish call appears in the argv log.
A session queues work, ends its turn, and reads the result later with brain_list or brain_queue_list. See Test Queue.
Start
The method
- 4-4a. Scripts, not instructions
- 5-6. Rework and concurrency
- 14a-14h. Field notes from parallel agents
Brain and the test queue
How the plugin runs it
- Shaping a Ticket
- Models and the Cascade
- Adversarial Review
- Review Rules
- Holdout Check
- Measuring a Batch
- Retro
Reference