gerrit-mcp-server
Allows AI agents to interact with Gerrit code review, enabling searching and viewing changes, reading diffs and commit messages, listing files and comments, and optionally posting reviews, adding reviewers, and managing change state (WIP, ready, abandon, revert) when write access is enabled.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gerrit-mcp-serverWhat changes am I reviewing?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gerrit-mcp-server
Connect your AI coding agent to Gerrit code review.
Ask your agent to find the changes waiting on you, read a diff, draft line comments, and publish a review — without leaving the session and without pasting code review comments back and forth.
It ships as two frontends over the same code, so you can pick how much of your agent's context you want to spend:
What it is | Context cost | |
| A command-line binary, plus an agent skill that teaches an agent to drive it | One line, until the skill triggers |
| A Model Context Protocol server over stdio | 22 tool schemas, for the whole session |
The skill route is the lighter one and works with any agent that reads skills. The MCP server needs no shell access and works with any MCP client: Claude Code, Codex, Cursor, Zed, Continue, or your own.
Either way it is a single static binary with no runtime dependencies. You self-host it; nothing is sent anywhere except to the Gerrit host you configure.
Quick start
Both routes start the same way.
Create a Gerrit auth token. In Gerrit, go to Settings → HTTP Credentials and generate one. See Credentials below if your Gerrit is older.
Node is needed only so that npm or npx can fetch the right binary for your machine. The binaries
are Go and have no Node runtime dependency.
Route A — gerrit-cli + agent skill
The lighter one. Nothing sits in your agent's context until it needs Gerrit.
1. Install the binary.
npm i -g @gyeonghokim/gerrit-cli2. Install the skill. This works for Claude Code, Codex, Cursor and many others.
npx skills add GyeongHoKim/gerrit-mcp-server3. Configure it. Run this yourself in a terminal — it asks for your token on stdin, and will refuse to run where nothing can type into it.
gerrit-cli init4. Check it. gerrit-cli config reports every setting and where it came from, naming anything
still missing. Then ask your agent: "What’s the verified score for XXX Change Id’s review?"
To allow the commands that modify Gerrit, set GERRIT_ALLOW_WRITE=true — see
Available tools and commands.
You can also use the CLI on its own, without an agent:
gerrit-cli query-changes --query "is:open reviewer:self -owner:self"
gerrit-cli get-file-diff --change-id 12345 --file src/main.go
gerrit-cli helpRoute B — MCP server
No shell access needed, and it works with any MCP client.
Add the server to your client.
claude mcp add gerrit \
--env GERRIT_URL=https://gerrit.example.com \
--env GERRIT_USER=your-username \
--env GERRIT_TOKEN=your-token \
-- npx -y @gyeonghokim/gerrit-mcp-serverAdd this to ~/.codex/config.toml, or to .codex/config.toml for a single trusted project:
[mcp_servers.gerrit]
command = "npx"
args = ["-y", "@gyeonghokim/gerrit-mcp-server"]
# npx downloads the binary on first run, which can exceed the 10s default.
startup_timeout_sec = 60
[mcp_servers.gerrit.env]
GERRIT_URL = "https://gerrit.example.com"
GERRIT_USER = "your-username"
GERRIT_TOKEN = "your-token"Or let the CLI write it for you:
codex mcp add gerrit \
--env GERRIT_URL=https://gerrit.example.com \
--env GERRIT_USER=your-username \
--env GERRIT_TOKEN=your-token \
-- npx -y @gyeonghokim/gerrit-mcp-serverAdd this to the client's MCP configuration file:
{
"mcpServers": {
"gerrit": {
"command": "npx",
"args": ["-y", "@gyeonghokim/gerrit-mcp-server"],
"env": {
"GERRIT_URL": "https://gerrit.example.com",
"GERRIT_USER": "your-username",
"GERRIT_TOKEN": "your-token"
}
}
}
}Ask for something. "What changes am I reviewing?" or "Summarise the diff on change 12345."
Related MCP server: mcp-gerrit-code-review
Credentials
Gerrit authenticates REST clients with HTTP Basic using a token from your account settings, and
expects authenticated requests to be prefixed with /a/. Both binaries handle the prefix for you.
Generate a token under Settings → HTTP Credentials. On Gerrit 3.13 and newer you can name the
token and give it a lifetime (90 days, 1 year, and so on) — worth doing, so the credential this
holds is scoped and expires on its own. Older Gerrit versions call the same thing an HTTP
password; it still works, as that endpoint is now an alias that creates a token with the id
legacy.
Where the token lives depends on which frontend you use.
gerrit-mcp-server reads the environment and only the environment, so its credentials live in your
MCP client's config file and nowhere else. It never reads a file of its own.
gerrit-cli has no client config to inherit from, so gerrit-cli init writes one under the OS
configuration directory:
OS | Path |
Linux |
|
macOS |
|
Windows |
|
Set GERRIT_CONFIG to put it somewhere else. Environment variables always take precedence over the
file, so a one-off GERRIT_TOKEN=... gerrit-cli ... works and CI never needs a file at all.
gerrit-cli config prints where each value actually came from.
What holds for both:
The token only ever travels in an
Authorizationheader. It is never passed as a process argument, so it cannot be read out ofps, and it is never written to a log line or an error message.gerrit-cli inithas no--tokenflag for exactly this reason.Nothing goes anywhere but your Gerrit host.
What is worth knowing about the file:
On Linux and macOS it is written
0600, readable only by you. On Windows it inherits the ACL of%AppData%, which is already restricted to your account plus SYSTEM and Administrators — setting a tighter one needs a dependency this project does not take. If your%AppData%is redirected to a network share, prefer keepingGERRIT_TOKENin your environment instead.gerrit-cli initechoes the token as you type it. Hiding terminal input needs a dependency this project does not take either. Pipe it in if that matters:printf 'https://gerrit.example.com alice %s ' "$TOKEN" | gerrit-cli init -non-interactiveDo not commit it, and do not commit an MCP config either. A project-level
.mcp.jsonholdingGERRIT_TOKENis a credential in your repository. Keep it in your user-level client config, or gitignore it.Use a dedicated token with a lifetime, so it can be revoked without touching your other credentials.
Your Gerrit permissions still apply. Neither frontend can see or do anything your account cannot.
Configuration
Both frontends read the same variables. For the MCP server they live in your client's config; for
the CLI they are optional, since gerrit-cli init writes the same settings to a file.
Variable | Required | Default | Description |
| yes | — | Base URL of the Gerrit host, for example |
| yes | — | Your Gerrit username |
| yes | — | Auth token from Settings → HTTP Credentials |
| no |
| Set to |
| no |
| Per-request timeout |
| no |
|
|
| no | — |
|
Available tools and commands
The two frontends expose exactly the same set, and a test in the repository holds them there.
A CLI command is its MCP tool name with the underscores written as dashes — query_changes becomes
query-changes — and gerrit-cli accepts either spelling.
Reads are always available. Writes are off unless you set GERRIT_ALLOW_WRITE=true, so an
agent cannot abandon a change or post a review by accident. The MCP server does not register the
write tools at all; gerrit-cli still lists them in its help, marked, but refuses to run one.
The same asymmetry applies to operations your Gerrit is too old for — see Supported Gerrit versions.
Read
Tool | Description |
| Search changes with Gerrit query syntax ( |
| Full summary of one change |
| Commit message of the current patch set |
| Files touched by the latest patch set |
| Diff for one file in a change |
| Published comments on a change |
| Your unpublished draft comments |
| Changes that would submit alongside this one |
| Reviewer suggestions for a change |
| Bug ids referenced in the commit message |
Every value is a flag; gerrit-cli has no positional arguments. Run gerrit-cli help <command>
for one command's flags — that is authoritative and cannot go stale.
gerrit-cli also has five commands of its own that no MCP tool corresponds to: help, version,
config, init, and doctor, which reports your host's Gerrit release and what that rules out.
There is deliberately no --json output. Everything passes through the same renderer that keeps
responses inside a sensible token budget, and handing an agent raw Gerrit JSON would undo that.
Write — requires GERRIT_ALLOW_WRITE=true
Tool | Description |
| Add a draft comment on a line, or reply in a thread |
| Publish your draft comments as a review |
| Delete one draft comment |
| Delete every draft on a change |
| Add a reviewer or CC |
| Set or clear the topic |
| Take a change out of WIP (needs Gerrit 2.15+) |
| Mark a change WIP (needs Gerrit 2.15+) |
| Create a change |
| Abandon a change |
| Revert a change |
| Revert a whole submission (needs Gerrit 3.2+) |
Exit codes
gerrit-cli reports what to do about a failure, not just that one happened. Rendered output goes to
stdout and everything else to stderr, so the answer is safe to pipe.
Code | Meaning |
0 | Success |
1 | Something else failed; read stderr |
2 | Bad arguments |
3 | Not configured — run |
4 | Not permitted — the account, |
5 | No such change, file or comment |
6 | The change is not in a state that allows this |
Supported Gerrit versions
Built and tested against the Gerrit 3.14 REST API. Supported down to 2.14.
Almost everything works unchanged on an old host — including the draft comment endpoints, which earlier versions of this document blamed. Three write operations genuinely do not exist:
Operation | Needs |
| Gerrit 2.15+ |
| Gerrit 2.15+ |
| Gerrit 3.2+ |
The two frontends handle that the same way they handle write access. gerrit-mcp-server asks the
host which release it is as it starts, and never offers a tool it cannot serve, so the tool list
your client sees is right from the first time it asks. gerrit-cli lists the commands with the
release each needs and reports exit 4 if you run one anyway, naming both the release required and
the one your host reports.
If the release cannot be determined, everything is offered. A proxy that swallows the version endpoint, or a patched internal fork that backported an endpoint, should not lose an operation that works — so an unknown version hides nothing, and anything genuinely missing still fails with a clear message.
One more difference worth knowing: Gerrit did not report comment counts before 3.0, so
get_change_details omits that line on an older host rather than claiming zero.
gerrit-cli doctor # which release your host runs, and what that rules outOther ways to install
npm is the easy path, but the binaries stand alone.
# Go toolchain
go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-mcp-server@latest
go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-cli@latestOr download the archive for your platform from the
releases page. It contains both
binaries and the agent skill, and you can point your MCP client's command straight at
gerrit-mcp-server. No Node required.
Development
mise install # toolchain, pinned in mise.toml
just setup # dependencies and git hooks
just ci # everything CI runs
just --list # all tasksIf you are AI Coding Agent(Codex, Claude Code, OpenCode, etc.), See AGENTS.md for architecture, conventions, and the Gerrit API details worth knowing before you touch the client.
License
It is prohibited to deploy this MCP server as a commercial service.
Using this at work is fine. ELv2 places exactly three restrictions on you: you may not offer this software to third parties as a hosted or managed service, you may not circumvent license key functionality, and you may not strip the copyright notices. Running it, modifying it, forking it, and deploying it across your engineering organisation are all expressly permitted.
Note that ELv2 is source-available rather than OSI-approved open source. If your organisation screens dependencies by license, it may need to be allowlisted.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides Git version control operations as structured tools for AI coding agents. It enables LLMs to programmatically manage repositories through actions like committing changes, rolling back code, and comparing diffs.10Apache 2.0
- AlicenseAqualityCmaintenanceMCP Server providing AI agents with tooling for Gerrit code review workflows via stdio transport.18141MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that generates pull request descriptions, commit messages, and code reviews from actual code changes using git diff.4MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables language models to query and manage Gerrit code reviews via the REST API.1Apache 2.0
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/GyeongHoKim/gerrit-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server