Bazel MCP Server
@nacgarg
About Bazel MCP Server
MCP server for Bazel
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"bazel-mcp-server": {
"command": "npx",
"args": [
"-y",
"github:nacgarg/bazel-mcp-server"
]
}
}
}Tools
6Build specified Bazel targets
Query the dependency graph for targets matching a pattern
Run tests for specified targets
List all available targets in the workspace (requires path parameter, use "//" for all targets)
Fetch external dependencies
Change the Bazel workspace path at runtime
Overview
What is Bazel MCP Server?
Bazel MCP Server is a local MCP server that exposes functionality of the Bazel build system to MCP-enabled AI agents. It is useful when MCP environments lack a command-line tool or have a misconfigured shell that prevents Bazel from being used.
How to use Bazel MCP Server?
Install by adding a configuration entry to .cursor/mcp.json (for Cursor) or launching standalone with npx -y github:nacgarg/bazel-mcp-server. Configuration can be provided via CLI arguments, environment variables, or a configuration file. The AI agent can change the workspace path at runtime using the bazel_set_workspace_path tool.
Key features of Bazel MCP Server
- Build specified Bazel targets
- Query the dependency graph for matching targets
- Run tests for specified targets
- List all available targets in the workspace
- Fetch external dependencies
- Change the Bazel workspace path at runtime
- Pass additional arguments to underlying Bazel commands
Use cases of Bazel MCP Server
- Build specific targets from an AI agent without a working shell
- Query the Bazel dependency graph to understand target relationships
- Run tests and view results through the agent
- List all targets in a workspace to explore available build rules
- Fetch external dependencies before building or testing
FAQ from Bazel MCP Server
What does Bazel MCP Server do that the regular Bazel CLI cannot?
It provides an MCP-compatible interface so that AI agents can interact with Bazel even when the invoked shell is misconfigured or lacks the Bazel command-line tool.
What are the runtime dependencies?
The server requires Node.js (to run via npx) and the Bazel binary. The path to the Bazel binary can be specified via --bazel_path or the MCP_BAZEL_PATH environment variable.
How do I set the Bazel workspace path?
The workspace path can be set at startup via the --workspace_path CLI argument, the MCP_WORKSPACE_PATH environment variable, or a configuration file. At runtime, the AI agent can use the bazel_set_workspace_path tool to change it.
Does the server work with Cursor Remote SSH sessions?
No, the server runs locally and will not work when using Cursor with Remote SSH sessions.
Can I pass extra flags to Bazel commands?
Yes, each tool (except bazel_set_workspace_path) accepts an optional additionalArgs parameter to supply extra flags like --verbose_failures or --test_output=all.
More Other MCP servers
Unity MCP ✨
justinpbarnettUnity MCP acts as a bridge between AI assistants and your Unity Editor. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.
Awesome-MCP-ZH
yzflyMCP 资源精选, MCP指南,Claude MCP,MCP Servers, MCP Clients
🚀 Model Context Protocol (MCP) Curriculum for Beginners
microsoftThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable,
Maestro
mobile-dev-incPainless E2E Automation for Mobile and Web
Awesome Mcp Servers
punkpeyeA collection of MCP servers.
Comments