bazel_build_target
Build specified Bazel targets
Run Bazel from an agent — build, test, query the dependency graph, list targets, fetch dependencies, and switch workspace mid-session.
LABSCO SUMMARY
bazel_set_workspace_path means the model can point the server at whichever checkout the question is about, so one configuration entry covers every repository on the machine rather than one per project. additionalArgs keeps the escape hatch open — --test_output=all on a failing test gets you the output that the default summary hides. Set --log_path if your client swallows console logs, which is the usual reason a failure looks like silence.
A local MCP server that wraps the Bazel command line. It exists for environments where the agent has no usable shell, or where the shell it does have has an environment misconfigured enough that Bazel will not run in it.
bazel_build_target, bazel_test_targetbazel_query_target// means all of them — bazel_list_targetsbazel_fetch_dependenciesbazel_set_workspace_pathadditionalArgs on every tool except the workspace switch, for flags like --verbose_failures or --test_output=allNo account and no key — it drives your local Bazel. The npm package name is @nacgarg/bazel-mcp-server (0.1.0) and it runs straight from GitHub with npx -y github:nacgarg/bazel-mcp-server. You usually do not need to configure anything: the Bazel binary is picked up automatically and the workspace can be set at runtime by the model. Where that fails, --bazel_path and --workspace_path take absolute paths, and each has an environment-variable equivalent in MCP_BAZEL_PATH and MCP_WORKSPACE_PATH, with a config file as the third fallback. Because it runs locally, it will not work through Cursor's Remote SSH sessions.
One command — npx -y github:nacgarg/bazel-mcp-server
USE CASES
Trigger the build through the server, so a misconfigured environment in the client's shell stops mattering.
Query the dependency graph for a pattern before changing a target, so the blast radius is known rather than discovered by a broken build.
Run the test with --test_output=all passed through, instead of reading a summary that omits the reason.
List every target under // to see what the repository actually builds before picking one.
Switch the workspace path at runtime, then build and test in the new checkout without restarting anything.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
bazel_build_targetBuild specified Bazel targets
bazel_fetch_dependenciesFetch Bazel external dependencies
bazel_list_targetsList all available Bazel targets under a given path
bazel_query_targetQuery the Bazel dependency graph for targets matching a pattern
bazel_set_workspace_pathSet the current Bazel workspace path for subsequent commands
bazel_test_targetRun Bazel tests for specified targets
BEFORE YOU INSTALL
6 tools when we connected.
npx on PATH
CONTEXT COST
Rated by the size of the 6 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
Add the block to your client, or run the command directly.
{
"mcpServers": {
"bazel-mcp-server": {
"command": "npx",
"args": [
"-y",
"github:nacgarg/bazel-mcp-server"
]
}
}
}npx -y github:nacgarg/bazel-mcp-server