-
-
Notifications
You must be signed in to change notification settings - Fork 0
MCP server
commitbrief mcp runs a Model Context Protocol
server over stdio so an AI agent or host can invoke CommitBrief as a tool —
typically a self-review gate the agent runs before it submits code. It speaks
JSON-RPC 2.0 over the MCP stdio transport, is implemented with the Go standard
library only (no MCP SDK, no extra dependency), and is fully opt-in: enabling it
changes nothing about the other commands.
Note
The server exposes the same review pipeline as commitbrief --json — diff
acquisition, the three-layer filtering, the pre-send guard and secret scanner,
the cost preflight, the response cache, the flaky-test pre-pass, and signal
control all run exactly as they do for a terminal review. The MCP path reuses
the review code rather than re-implementing it.
A single tool, review, that reviews the current repository's diff and
returns the structured findings (JSON schema v1) plus a short text summary.
All arguments are optional. With no arguments it reviews the staged diff
(commitbrief --staged).
| Argument | Type | Default | Meaning |
|---|---|---|---|
staged |
boolean | true |
review the staged diff |
unstaged |
boolean | false |
review the working-tree diff instead (mutually exclusive with staged) |
diff |
string[] | — |
git diff arguments for a range review, e.g. ["HEAD~3","HEAD"] or ["main...feature"]; forwarded verbatim to git |
provider |
string | configured | override the provider for this review |
model |
string | configured | override the model for this review |
fail_on |
string | — |
critical | high | medium | low | info | any | none — report a gate failure when a finding meets/exceeds this severity. Findings are still returned. |
min_severity |
string | — |
critical | high | medium | low | info | none — hide findings below this severity in the returned set (the gate still sees the full set) |
no_flaky |
boolean | false |
skip the deterministic flaky-test detector |
The tool result has two content blocks:
-
A text summary — finding counts by severity, the provider/model used,
whether the response was cached, and a
GATE FAILED: …note whenfail_ontripped. -
The JSON schema-v1 document — the same bytes
commitbrief --jsonemits.
A genuine failure (no git repo, no changes to review, a provider error, or an
aborted secret-scan guard) is returned as an MCP tool error (isError: true)
carrying the message, so the agent can react. The fail_on gate is not a tool
error — the findings are valid and returned; the gate is reported in the summary.
Register commitbrief mcp as a stdio MCP server in your host's configuration.
{
"mcpServers": {
"commitbrief": {
"command": "commitbrief",
"args": ["mcp"]
}
}
}If commitbrief is not on the host's PATH, use an absolute path for command
(e.g. /usr/local/bin/commitbrief). Provider credentials are resolved the same
way as for any review — from ~/.commitbrief/config.yml, the repo config, or
environment variables (see Configuration files and
Environment variables). Run commitbrief setup once
first so the server has a working provider.
The host launches the process, performs the initialize handshake, discovers the
review tool via tools/list, and invokes it via tools/call. The process reads
JSON-RPC requests on stdin and writes responses on stdout until the host
closes the stream; human-readable diagnostics go to stderr and never pollute
the JSON-RPC channel.
-
Transport: line-delimited JSON over stdio — one JSON-RPC 2.0 message per
line. (The optional
Content-Lengthheader framing is not used; the newline form is the stdio default.) -
Protocol version:
2024-11-05. -
Methods:
initialize,tools/list,tools/call,ping. Notifications (id-less requests, e.g.notifications/initialized) are accepted and not answered.
Requests the host sends (one per line), and the responses the server returns:
- One review at a time. The server is single-connection and processes requests sequentially — a review is a blocking operation and there is exactly one host on the other end of stdio.
- Guards still apply. Because the agent host is non-interactive, a triggered secret-scan or cost preflight aborts (rather than auto-approving) and the abort is surfaced as a tool error — a review that would prompt a human is never silently approved for an agent.
-
Config is re-read per call, so editing
~/.commitbrief/config.ymlbetween calls takes effect without restarting the server.
- JSON schema v1 — the exact shape of the returned findings.
- Review (default command) — the pipeline the tool reuses.
- Configuration files · Environment variables — how the provider/credentials resolve.
-
--fail-onand exit codes — the gate semanticsfail_onmirrors.
Home · Installation · Quick start · Troubleshooting · GitHub repo · Issues
CommitBrief — local, LLM-powered code review for git diffs. This wiki documents only what ships in the binary.
Getting started
Commands · reviewing
Commands · summarizing
Commands · committing
Commands · setup
Commands · integration
Commands · inspect
Commands · maintenance
Configuration
Providers
Output
Operations
Reference