
Bazel MCP
โ 2from saeid-rez
A local MCP server that exposes Bazel build system capabilities to AI assistants.
๐ฅ๐ฅ๐ฅโ VerifiedFreeAdvanced setup
Bazel MCP
A Model Context Protocol server that exposes Bazel build system capabilities to AI assistants.
Repo: github.com/saeid-rez/bazel-mcp
Tools
| Tool | Description |
|---|---|
bazel_query | Run arbitrary bazel query expressions |
list_targets | List targets in a package or subtree |
get_deps | Direct or transitive dependencies of a target |
get_rdeps | Reverse dependencies within a scope |
show_target_info | Rule definition via query --output=build |
bazel_build | Run bazel build with structured failure diagnostics |
bazel_test | Run bazel test with structured target and failed-case results |
explain_build_file | Read BUILD file contents for analysis |
Development
Clone the repo and run tests locally:
git clone https://github.com/saeid-rez/bazel-mcp
cd bazel-mcp
uv sync --group dev
uv run pytestCopy & paste โ that's it
git clone https://github.com/saeid-rez/bazel-mcp
cd bazel-mcp
uv sync --group dev
uv run pytestUsage
Run against a Bazel workspace. Open that repo in Cursor, then add to .cursor/mcp.json:
{
"mcpServers": {
"bazel": {
"command": "uvx",
"args": ["--from", "git+https://github.com/saeid-rez/bazel-mcp", "bazel-mcp"]
}
}
}Requires uv. Bazel commands run in your open workspace by default.
If your MCP client does not start the server from the Bazel workspace, pass the workspace explicitly:
{
"mcpServers": {
"bazel": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/saeid-rez/bazel-mcp",
"bazel-mcp",
"--workspace-root",
"/path/to/your/bazel/workspace"
]
}
}
}Other optional flags:
bazel-mcp --bazel-path bazelisk --timeout 600 --max-output-chars 64000No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under MITโ you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub โ