Skip to main content
Glama
Gerrit MCP Server

Gerrit MCP Server

Official

🐍 Gerrit MCP Server

An MCP (Model Context Protocol) server that brings Gerrit code-review workflows to AI clients including the Gemini CLI, Claude Code, and OpenAI Codex. It provides tools to search changes, inspect diffs and review metadata, manage reviewers, comments, and change state, and analyze related or dependent changes. Optional extensions add tools backed by Gerrit plugins.

Use it as a Gemini CLI extension, Claude Code plugin, or Codex plugin, or run it directly as a persistent HTTP server or on-demand via STDIO.

πŸ“š Documentation

For detailed information, please see the documents in the docs/ directory:

  • Configuration: A detailed guide to the gerrit_config.json file and all authentication methods.

  • Testing Guide: Instructions on how to run the unit, integration, and E2E tests.

  • Gemini CLI Setup: How to configure the Gemini CLI to use this server.

  • Claude Code Setup: How to use this server as a Claude Code plugin.

  • Codex Setup: How to use this server as a Codex plugin.

  • Best Practices: Tips for using the server effectively.

  • Contributing: Guidelines for contributing to the project.

  • Available Tools: A list of all available tools and their descriptions.

  • Extensions: How to register additional MCP tools without modifying the core server.

  • Example Use Cases: Scenarios demonstrating how to use the server.

Related MCP server: Gerrit MCP Server

Reporting bugs and feature requests

Please report bugs and feature requests in the Gerrit MCP Server component of the Gerrit issue tracker.

Due to spam abuse, membership in the repo-discuss Google Group is required to create issues. See the announcement for more information.

πŸš€ Getting Started

1. Prerequisites

Before you begin, ensure you have the following tools installed and available in your system's PATH.

  • Python 3.12+: Required by the server.

  • uv: Used for dependency management and running the server. Optional β€” the build script will install it via pip if absent.

  • curl: The standard command-line tool for transferring data with URLs.

2. Build the Environment

Run the build script from the root of the gerrit-mcp-server project directory. This will create a virtual environment in .venv via uv sync and install all dependencies.

./build-gerrit.sh

3. Configure the Server

Create the shared user config file described in the Configuration Guide. Copy the sample to the default location (using the project virtual environment's Python):

config_path=$(uv run python -c 'from platformdirs import user_config_path; print(user_config_path("gerrit-mcp") / "gerrit_config.json")')
mkdir -p "$(dirname "$config_path")"
cp gerrit_mcp_server/gerrit_config.sample.json "$config_path"

Customize it for your environment. GERRIT_CONFIG_PATH overrides the default. Existing repo-local configs must be moved or explicitly selected with that variable; they are not migrated automatically.

Alternatively, if your harness supports skills (tested with Claude Code), the /gerrit:setup skill can create or repair this file for you interactively. See Interactive Setup.

4. Run the Server (HTTP Mode)

To run the server as a persistent background process, use the server.sh script:

  • Start the server:

    ./server.sh start
  • Check the status:

    ./server.sh status
  • Stop the server:

    ./server.sh stop

For on-demand STDIO mode or client-specific installation instructions, see the Gemini CLI Setup Guide, Claude Code Setup Guide, or Codex Setup Guide.

Contributing

To contribute code or other changes, use the canonical gerrit-mcp-server repository hosted on Gerrit and follow the contribution guidelines. This project does not accept GitHub pull requests.

Security

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

Available Tools

25 tools
abandon_changeC

Abandons a change.

Inputs: change_id (required), message, gerrit_base_url.

add_reviewerA

Adds a user or a group to a CL as either a reviewer or a CC.

Inputs: reviewer (required), change_id (required), state, gerrit_base_url.

changes_submitted_togetherC

Computes and lists all changes that would be submitted together with a given CL.

Inputs: change_id (required), options, gerrit_base_url.

create_changeC

Creates a new change in Gerrit.

Inputs: branch (required), project (required), subject (required), topic, +2 more.

delete_draft_commentB

Deletes a single draft comment on a CL by its draft ID.

Inputs: draft_id (required), change_id (required), gerrit_base_url.

delete_draft_commentsB

Deletes ALL draft comments on a CL.

Inputs: change_id (required), gerrit_base_url.

get_bugs_from_clB

Extracts bug IDs from the commit message of a CL.

Inputs: change_id (required), gerrit_base_url.

get_change_detailsC

Retrieves a comprehensive summary of a single CL.

Inputs: change_id (required), options, gerrit_base_url.

get_commit_messageB

Gets the commit message of a change from the current patch set.

Inputs: change_id (required), gerrit_base_url.

get_file_diffB

Retrieves the diff for a single, specified file within a CL.

Inputs: change_id (required), file_path (required), gerrit_base_url.

get_most_recent_clC

Gets the most recent CL for a user.

Inputs: user (required), gerrit_base_url.

list_change_commentsC

list_change_comments is useful for reviewing feedback, reading comments on a change, analyzing comments, and responding to comments.

Inputs: change_id (required), gerrit_base_url.

list_change_filesB

Lists all files modified in the most recent patch set of a CL.

Inputs: change_id (required), gerrit_base_url.

list_draft_commentsA

Lists all draft comments on a CL.

Inputs: change_id (required), gerrit_base_url.

post_draft_commentA

Creates a draft review comment on a specific line of a file in a CL. Draft comments are only visible to the author until explicitly published. Use in_reply_to with a parent comment ID to create a threaded reply.

Inputs: message (required), change_id (required), file_path (required), line_number (required), +8 more.

post_review_commentB

Posts a review comment on a specific line of a file in a CL.

Inputs: message (required), change_id (required), file_path (required), line_number (required), +3 more.

publish_draftsA

Publishes all pending draft comments on a CL as a single review. This is equivalent to clicking "Send" in the Gerrit web UI β€” all draft comments become visible to other reviewers in one batch.

Inputs: change_id (required), labels, message, gerrit_base_url.

query_changesC

Searches for CLs matching a given query string.

Inputs: query (required), limit, options, gerrit_base_url.

query_changes_by_date_and_filtersA

Searches for Gerrit changes within a specified date range, optionally filtered by project, a substring in the commit message, and change status. This tool provides a flexible way to find changes based on their dates and content.

Args: start_date: The start date for the changes (e.g., "2025-08-18"). end_date: The end date for the changes (e.g., "2025-08-19"). gerrit_base_url: The base URL of the Gerrit instance. limit: The maximum number of changes to return. project: Optional project name to filter by. This filter is only applied if gerrit_base_url is not explicitly provided, in which case the default Gerrit instance will be queried. message_substring: An optional substring to search for in the commit message. status: The status of the changes to search for (e.g., "merged", "open", "abandoned"). Defaults to "merged".

Inputs: end_date (required), start_date (required), limit, status, +3 more.

revert_changeB

Reverts a single change, creating a new CL.

Inputs: change_id (required), message, gerrit_base_url.

revert_submissionB

Reverts an entire submission, creating one or more new CLs.

Inputs: change_id (required), message, gerrit_base_url.

set_ready_for_reviewC

Sets a CL as ready for review.

Inputs: change_id (required), gerrit_base_url.

set_topicB

Sets the topic of a change. An empty string deletes the topic.

Inputs: topic (required), change_id (required), gerrit_base_url.

set_work_in_progressC

Sets a CL as work-in-progress.

Inputs: change_id (required), message, gerrit_base_url.

suggest_reviewersC

Suggests reviewers for a change based on a query.

Inputs: query (required), change_id (required), limit, exclude_groups, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools target distinct actions and resources, but there is minor overlap between query_changes and query_changes_by_date_and_filters, and between delete_draft_comments (all) and delete_draft_comment (single). The descriptions clarify these boundaries, so an agent can generally select correctly.

    Naming Consistency4/5

    The overwhelming majority follow a verb_noun pattern (query_, get_, list_, delete_, set_, create_, etc.). The notable exception is 'changes_submitted_together', which is a noun phrase rather than a verb-first name, and 'query_changes_by_date_and_filters' is longer but still verb-initial.

    Tool Count3/5

    With 25 tools, the server sits at the high end of what is typically considered heavy. While each tool has a specific purpose for Gerrit operations, the count is borderline and may feel bloated compared to more focused servers.

    Completeness4/5

    The server covers the core Gerrit lifecycle well: create, query, get details, modify state, comment, add reviewers, revert, and abandon. However, it lacks a direct 'submit' operation, which is a notable gap for a Gerrit client, and also misses actions like restoring an abandoned change or editing a commit message.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers