Get started
bazel-mcp is a local MCP server. It runs beside your coding agent, invokes the
Bazel already configured for your workspace, and returns a bounded result.
Requirements
Section titled “Requirements”- macOS, Linux, or Windows x86_64 (preview)
- Bazel 8 or 9, Bazelisk, or an executable workspace-local
tools/bazel - An MCP-compatible client
Install
Section titled “Install”The shortest path on macOS or Linux with Homebrew is:
brew install ewhauser/tap/bazel-mcpYou can also download a prebuilt archive from the latest GitHub release. The release includes shell and PowerShell installers.
Connect your client
Section titled “Connect your client”Register the installed binary as a local stdio MCP server. MCP clients use different settings files, but the server entry has this shape:
{ "mcpServers": { "bazel": { "command": "bazel-mcp" } }}Restart the client after changing its MCP configuration.
Run the first build
Section titled “Run the first build”Open a Bazel workspace in your coding agent and ask:
Build
//app:server.
The agent calls bazel.run with the workspace, command, and argument array. A
successful result is limited to 2 KiB and a failed result to 8 KiB. If more
evidence exists, the result includes an invocation ID the agent can pass to
bazel.inspect.
Try these next:
- “Run the tests under
//services/...and explain any failures.” - “Which targets depend on
//lib:core?” - “Show the failed test log from the last invocation.”
Optional configuration
Section titled “Optional configuration”No configuration file is required. The defaults can use any Bazel workspace available to the current user and retain invocation evidence in a local cache.
For shared environments, workspace restrictions, custom redaction, retention, or task settings, continue to the configuration reference.