gerrit-mcp-server

gerrit-mcp-server

A Model Context Protocol server that connects AI coding agents to Gerrit code review, enabling change search, diff review, and comment publishing without leaving the session.

Category
访问服务器

README

gerrit-mcp-server

CI npm Go License

A Model Context Protocol server that connects 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 change numbers back and forth.

It speaks MCP over stdio, so it works with any MCP client: Claude Code, Codex, Cursor, Zed, Continue, or your own. 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

You need Node installed only so that npx can fetch and run the right binary for your machine. The server itself is Go and has no Node runtime dependency.

1. Create a Gerrit auth token. In Gerrit, go to Settings → HTTP Credentials and generate one. See Authentication below if your Gerrit is older.

2. Add the server to your MCP client.

<details open> <summary><b>Claude Code</b></summary>

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-server

</details>

<details> <summary><b>Codex</b></summary>

Add 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-server

</details>

<details> <summary><b>Cursor, Zed, and other clients</b></summary>

Add 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"
      }
    }
  }
}

</details>

3. Ask for something. "What changes am I reviewing?" or "Summarise the diff on change 12345."

Authentication

Gerrit authenticates REST clients with HTTP Basic using a token from your account settings, and expects authenticated requests to be prefixed with /a/. This server handles 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 server holds is scoped and expires on its own.

Older Gerrit versions call the same thing an HTTP password. It still works: that endpoint is now an alias that creates a token with the id legacy.

The token is sent in an Authorization header. It never appears in a command line, a log line, or an error message.

Configuration

All configuration is environment variables, so it lives in your MCP client config and nowhere else.

Variable Required Default Description
GERRIT_URL yes — Base URL of the Gerrit host, for example https://gerrit.example.com
GERRIT_USER yes — Your Gerrit username
GERRIT_TOKEN yes — Auth token from Settings → HTTP Credentials
GERRIT_ALLOW_WRITE no false Set to true to register the tools that modify Gerrit
GERRIT_TIMEOUT no 30s Per-request timeout
GERRIT_LOG_LEVEL no info debug, info, warn, or error. Logs go to stderr

Available tools

Read-only tools are always registered. Write tools are off unless you set GERRIT_ALLOW_WRITE=true, so an agent cannot abandon a change or post a review by accident.

Read

Tool Description
query_changes Search changes with Gerrit query syntax (status:open owner:self)
get_change_details Full summary of one change
get_commit_message Commit message of the current patch set
list_change_files Files touched by the latest patch set
get_file_diff Diff for one file in a change
list_change_comments Published comments on a change
list_draft_comments Your unpublished draft comments
changes_submitted_together Changes that would submit alongside this one
suggest_reviewers Reviewer suggestions for a change
get_bugs_from_cl Bug ids referenced in the commit message

Write — requires GERRIT_ALLOW_WRITE=true

Tool Description
post_review_comment Add a draft comment on a line, or reply in a thread
publish_drafts Publish your draft comments as a review
delete_draft_comment Delete one draft comment
delete_draft_comments Delete every draft on a change
add_reviewer Add a reviewer or CC
set_topic Set or clear the topic
set_ready_for_review Take a change out of WIP
set_work_in_progress Mark a change WIP
create_change Create a change
abandon_change Abandon a change
revert_change Revert a change
revert_submission Revert a whole submission

Security

  • The token stays in a header. It is never passed as a process argument, so it cannot be read out of ps, and it is never written to logs.
  • Read-only by default. Destructive tools are not registered unless you opt in.
  • Don't commit your MCP config. A project-level .mcp.json with GERRIT_TOKEN in it is 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. This server cannot see or do anything your account cannot.

Supported Gerrit versions

Built against the Gerrit 3.14 REST API and tested against it. Expected to work with 3.12 and newer; older versions are missing some of the draft comment endpoints.

Other ways to install

npx is the easy path, but the binary stands alone.

# Go toolchain
go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-mcp-server@latest

Or download a binary for your platform from the releases page and point your MCP client's command at it directly. 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 tasks

See AGENTS.md for architecture, conventions, and the Gerrit API details worth knowing before you touch the client.

License

Elastic License 2.0.

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选