Bazel Mcp
@saeid-rez
About Bazel Mcp
A local MCP server that exposes Bazel build system capabilities to AI assistants.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"bazel": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/saeid-rez/bazel-mcp",
"bazel-mcp"
]
}
}
}Tools
8Run arbitrary `bazel query` expressions
List targets in a package or subtree
Direct or transitive dependencies of a target
Reverse dependencies within a scope
Rule definition via `query --output=build`
Run `bazel build`
Run `bazel test` with structured results
Read BUILD file contents for analysis
Overview
What is Bazel Mcp?
Bazel Mcp is a Model Context Protocol server that exposes Bazel build system capabilities to AI assistants. It is designed for developers who want to interact with a Bazel workspace through an MCP-enabled client such as Cursor.
How to use Bazel Mcp?
Install the server with uvx and add a configuration entry to your MCP client’s JSON file (e.g., .cursor/mcp.json). Bazel commands run in your open workspace by default; if your client does not start from that directory, pass the workspace root explicitly with the --workspace-root flag.
Features of Bazel Mcp
- Run arbitrary
bazel queryexpressions - List targets in a package or subtree
- Get direct or transitive dependencies of a target
- Get reverse dependencies within a scope
- Show rule definition via
query --output=build - Run
bazel buildandbazel test - Read BUILD file contents for analysis
Use cases of Bazel Mcp
- Ask an AI assistant for the dependencies of a specific Bazel target
- Let an AI assistant build or test a target and return structured results
- Have an AI assistant explain the contents of a BUILD file
- Query the build graph for reverse dependencies during refactoring
FAQ from Bazel Mcp
What does Bazel Mcp do?
It provides tools (bazel_query, list_targets, get_deps, get_rdeps, show_target_info, bazel_build, bazel_test, explain_build_file) that an AI assistant can invoke to inspect and control a Bazel workspace.
What runtime does it require?
The server requires uv to run.
Where are Bazel commands executed?
Commands run in the Bazel workspace that is open in your MCP client by default. If the client does not start the server from the workspace, you must supply the workspace root path via the --workspace-root flag.
Are there any optional configuration flags?
Yes. You can set --bazel-path to specify the Bazel binary (e.g., bazelisk), --timeout to change the command timeout in seconds, and --max-output-chars to limit the number of characters in command output.
Frequently asked questions
What does Bazel Mcp do?
It provides tools (bazel_query, list_targets, get_deps, get_rdeps, show_target_info, bazel_build, bazel_test, explain_build_file) that an AI assistant can invoke to inspect and control a Bazel workspace.
What runtime does it require?
The server requires [uv](https://docs.astral.sh/uv/) to run.
Where are Bazel commands executed?
Commands run in the Bazel workspace that is open in your MCP client by default. If the client does not start the server from the workspace, you must supply the workspace root path via the `--workspace-root` flag.
Are there any optional configuration flags?
Yes. You can set `--bazel-path` to specify the Bazel binary (e.g., `bazelisk`), `--timeout` to change the command timeout in seconds, and `--max-output-chars` to limit the number of characters in command output.
Basic information
More Other MCP servers
Mobile Mcp
mobile-nextModel Context Protocol Server for Mobile Automation and Scraping (iOS, Android, Emulators, Simulators and Real Devices)
ghidraMCP
LaurieWiredMCP Server for Ghidra
MCP Toolbox for Databases
googleapisMCP Toolbox for Databases is an open source MCP server for databases.

Sequential Thinking
modelcontextprotocolModel Context Protocol Servers
Activepieces
activepiecesAI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
Comments