Skip to content

bazel-mcp

Local MCP for Bazel

Give Bazel output
a context budget.

Run Bazel from coding agents without pouring build logs into the model. Get the root cause first and keep the complete evidence available locally.

brew install ewhauser/tap/bazel-mcp
Live evidence pipeline local only
bazel test //...482 KB

INFOAnalyzed target //app:server (84 packages loaded)

SUB[412 / 638] Compiling services/cache/cache.cc

SUB[529 / 638] Compiling services/api/router.cc

WARNwarning: option --remote_download_toplevel changed

ERRservices/api/router.cc:148:17: error: no matching function

SUBTarget //app:server failed to build

bazel.run1.7 KB

statefailed

target//app:server

ROOT CAUSEno matching functionservices/api/router.cc:148:17

more_availabletrue

89.73%less model contextlatest deterministic run96.43%fewer visible bytesagainst default shell0.00%median Bazel overheadpaired wall time3focused MCP toolsrun · inspect · cancel

A deliberately small interface

Three tools. The whole evidence loop.

The public surface stays easy for agents to understand while the server handles process isolation, reduction, storage, and lifecycle details locally.

01EXECUTE

bazel.run

Run an allowed Bazel command and receive a bounded, root-cause-first result.

Build · test · coverage · query
02EVIDENCE

bazel.inspect

Retrieve only the diagnostics, test logs, artifacts, or query results needed next.

Filtered · paginated · retained locally
03CONTROL

bazel.cancel

Cancel a queued or running invocation through the same durable lifecycle.

Queued · running · task-aware

Compact does not mean lossy

Start narrow. Inspect with intent.

Every result carries an invocation ID. If an agent needs more detail, it asks for a filtered, byte-bounded view instead of replaying the entire log into context.

Follow the evidence lifecycle
01Run

Root cause and invocation ID arrive inside the response budget.

02Inspect

Request a diagnostic, test log, artifact, query result, or raw log page.

03Solve

Fix the code with evidence—not noise—occupying the model context.