Bazel MCP Server

MCP server for interacting with Bazel

Local serverstdio

What is the Bazel MCP Server?

MCP server for interacting with Bazel

What the server does

A local MCP server that exposes functionality of the Bazel build system to MCP-enabled AI agents.

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • bazel_build_target — Build specified Bazel targets
  • bazel_query_target — Query the dependency graph for targets matching a pattern
  • bazel_test_target — Run tests for specified targets
  • bazel_list_targets — List all available targets in the workspace (requires path parameter, use "//" for all targets)
  • bazel_fetch_dependencies — Fetch external dependencies
  • bazel_set_workspace_path — Change the Bazel workspace path at runtime
  • Installation — The Installation tool exposed by this server
  • Configuration — This MCP server allows a couple different configuration methods. They will be used in the following order:

Recorded tools

  • bazel_build_target — Build specified Bazel targets
  • bazel_query_target — Query the dependency graph for targets matching a pattern
  • bazel_test_target — Run tests for specified targets
  • bazel_list_targets — List all available targets in the workspace (requires path parameter, use "//" for all targets)
  • bazel_fetch_dependencies — Fetch external dependencies
  • bazel_set_workspace_path — Change the Bazel workspace path at runtime

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
bazel_build_targetBuild specified Bazel targets
bazel_query_targetQuery the dependency graph for targets matching a pattern
bazel_test_targetRun tests for specified targets
bazel_list_targetsList all available targets in the workspace (requires path parameter, use "//" for all targets)
bazel_fetch_dependenciesFetch external dependencies
bazel_set_workspace_pathChange the Bazel workspace path at runtime

How to install the Bazel MCP Server

claude mcp add bazel --env MCP_BAZEL_PATH=your-value --env MCP_WORKSPACE_PATH=your-value --env MCP_LOG_PATH=your-value -- npx -y github

Configuration

VariableDescriptionRequired
MCP_BAZEL_PATHFilesystem location the server is allowed to use.Optional
MCP_WORKSPACE_PATHFilesystem location the server is allowed to use.Optional
MCP_LOG_PATHFilesystem location the server is allowed to use.Optional

Example prompts to try

  • “Use Bazel to bazel build target.”
  • “Use Bazel to bazel query target.”
  • “Use Bazel to bazel test target.”

Frequently asked questions

MCP server for interacting with Bazel Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.