Skip to main content

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
bazel_query Run arbitrary bazel query expressions
list_targets List targets in a package or subtree
get_deps Direct or transitive dependencies of a target
get_rdeps Reverse dependencies within a scope
show_target_info Rule definition via query --output=build
find_affected_targets Find targets affected by changed files
bazel_build Run bazel build with structured failure diagnostics
bazel_test Run bazel test with structured target and failed-case results
explain_build_file Read BUILD file contents for analysis

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 64000

Development

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 pytest

Release files for bazel-mcp-server 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bazel-mcp-server 0.1.2
File Size Uploaded
bazel_mcp_server-0.1.2.tar.gz 66.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bazel-mcp-server 0.1.2
File Interpreter ABI Platform
bazel_mcp_server-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 82.6 kB

Release files / bazel_mcp_server-0.1.2.tar.gz

Download URL bazel_mcp_server-0.1.2.tar.gz
Size 66.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4cc1d4a33f51b9a432da4f6cfe3e00ed11831107f8e2768e3bc32c678973eb11
BLAKE2b-256 checksum
How to use checksums
86b83f06a701709b1b67e379a615ab015c9a73b31e0dea003976de4ec9839098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bazel_mcp_server-0.1.2-py3-none-any.whl

Download URL bazel_mcp_server-0.1.2-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
280508ecbd3496d5b14c9d281e7a5f2a30b40425106989f24482b3bdcf1f047b
BLAKE2b-256 checksum
How to use checksums
180d04cf5eb13077c68b8460002db55c514725188966ca27f92baee4236a8f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page