Skip to main content
Glama

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

Related MCP server: gemini-cli-mcp-slim

Usage

Requires uv. Run against a Bazel workspace. Open that repo in Cursor, then add to .cursor/mcp.json.

{
  "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

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that publishes CLI tools on your machine for discoverability by LLMs
    14
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for gavel, a code-quality gate for Bazel monorepos. Exposes judge, findings, coverage and architecture tools so a coding agent can check its change against the quality gate (lint, coverage, layer rules) before declaring it done — all off the Bazel build graph, over just what changed.
    8
    10
    Apache 2.0

View all related MCP servers

Latest Blog Posts

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