bazel-mcp
This server exposes Bazel build system capabilities to AI assistants via the Model Context Protocol (MCP), allowing you to query, build, test, and analyze Bazel workspaces.
bazel_query: Run arbitrary Bazel query expressions with configurable output formats (label, build, xml, package, location, graph, etc.)list_targets: List all targets in a package, subtree, or entire workspace using patterns like//...or//pkg/...get_deps: Retrieve direct or transitive dependencies of a target up to a configurable depthget_rdeps: Find all targets that depend on a given target within a specified scopeshow_target_info: Display the BUILD rule definition for a target usingbazel query --output=buildfind_affected_targets: Identify which targets are affected by changes to specific filesbazel_build: Runbazel buildon one or more targets with optional flags, returning stdout, stderr, and exit code with structured failure diagnosticsbazel_test: Executebazel testand get structured pass/fail results including failure log excerpts and duration per test targetexplain_build_file: Read and return the contents of a BUILD file (by path relative to workspace root) for analysis
Provides tools for interacting with the Bazel build system, enabling AI assistants to run queries, list targets, get dependencies, perform builds and tests, and analyze BUILD files.
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 |
| Run arbitrary |
| List targets in a package or subtree |
| Direct or transitive dependencies of a target |
| Reverse dependencies within a scope |
| Rule definition via |
| Find targets affected by changed files |
| Run |
| Run |
| Read BUILD file contents for analysis |
Related MCP server: mcp-cli-catalog
Usage
Requires uv. Run against a Bazel workspace. Open that repo in Cursor, then add to .cursor/mcp.json.
Option 1: Run via PyPI (Recommended)
{
"mcpServers": {
"bazel": {
"command": "uvx",
"args": ["bazel-mcp-server"]
}
}
}Option 2: Run directly from GitHub
{
"mcpServers": {
"bazel": {
"command": "uvx",
"args": ["--from", "git+https://github.com/saeid-rez/bazel-mcp", "bazel-mcp-server"]
}
}
}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": [
"bazel-mcp",
"--workspace-root",
"/path/to/your/bazel/workspace"
]
}
}
}Other optional flags:
bazel-mcp-server --bazel-path bazelisk --timeout 600 --max-output-chars 64000Development
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 pytestMaintenance
Related MCP Servers
- AlicenseAqualityDmaintenanceA local MCP server that exposes Bazel build system functionality to AI agents, allowing them to build, test, query, and manage Bazel projects through natural language even in environments where Bazel can't be directly accessed.Last updated69MIT
- Alicense-qualityDmaintenanceAn MCP server that publishes CLI tools on your machine for discoverability by LLMsLast updated151MIT
- Alicense-qualityCmaintenanceThin MCP server wrapping the Gemini CLI for AI assistants, supporting workspace-aware multi-repository analysis and forward-compatible flags.Last updatedMIT
- Flicense-qualityCmaintenanceA security-first MCP server that provides LLMs with structured tools for filesystem, process, search, build/test/lint, IDE integration, and more.Last updated2
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Local-first RAG engine with MCP server for AI agent integration.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/saeid-rez/bazel-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server