mcp-gerrit-code-review
Provides tools for interacting with Gerrit code review system, enabling AI agents to manage changes (query, review, submit, abandon, restore), accounts, projects, and server information.
MCP Gerrit Code Review
MCP Server providing AI agents with tooling for Gerrit code review workflows via stdio transport.
Features
19 tools across 4 categories: Changes, Accounts, Projects, Server
Dual transport: HTTP (REST API) or SSH (gerrit CLI commands)
Dynamic tool registration: Tools auto-enable based on server capabilities
Basic Auth with env vars or
~/.netrcfallback (HTTP mode)SSH key auth with env vars or
~/.ssh/id_rsafallback (SSH mode)TypeScript strict mode with Zod input validation
ESM modules with stdio transport
Installation
Option 1: Install from npm (Recommended)
npx mcp-gerrit-code-reviewOr install globally:
npm install -g mcp-gerrit-code-reviewOption 2: Build from source
git clone https://github.com/coveyjorjet/mcp-gerrit-code-review.git
cd mcp-gerrit-code-review
npm install && npm run buildConfiguration
HTTP Transport (Default)
Set via environment variables:
export GERRIT_URL=https://gerrit.example.com
export GERRIT_USERNAME=your-username
export GERRIT_PASSWORD=your-http-passwordOr use ~/.netrc:
machine gerrit.example.com
login your-username
password your-http-passwordSSH Transport
Set transport mode and SSH connection details:
export GERRIT_TRANSPORT=ssh
export GERRIT_SSH_HOST=gerrit.example.com
export GERRIT_SSH_USER=your-username
export GERRIT_SSH_PORT=29418 # optional, defaults to 29418
export GERRIT_SSH_KEY=~/.ssh/id_rsa # optional, defaults to ~/.ssh/id_rsa
export GERRIT_SSH_KEY_PASSPHRASE=your-passphrase # optionalOr use SSH URL format in GERRIT_URL:
export GERRIT_TRANSPORT=ssh
export GERRIT_URL=ssh://your-username@gerrit.example.com:29418SSH credentials are resolved from ~/.netrc for username if not specified.
Usage
Using with OpenCode
Add to your opencode.json or opencode.jsonc:
Using npm package (HTTP)
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcp-gerrit-code-review": {
"type": "local",
"command": ["npx", "-y", "mcp-gerrit-code-review"],
"enabled": true,
"environment": {
"GERRIT_URL": "https://gerrit.example.com",
"GERRIT_USERNAME": "your-username",
"GERRIT_PASSWORD": "your-http-password"
}
}
}
}Using npm package (SSH)
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcp-gerrit-code-review": {
"type": "local",
"command": ["npx", "-y", "mcp-gerrit-code-review"],
"enabled": true,
"environment": {
"GERRIT_TRANSPORT": "ssh",
"GERRIT_SSH_HOST": "gerrit.example.com",
"GERRIT_SSH_USER": "your-username",
"GERRIT_SSH_KEY": "/path/to/private/key"
}
}
}
}Using local build
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcp-gerrit-code-review": {
"type": "local",
"command": ["node", "/path/to/mcp-gerrit-code-review/dist/index.js"],
"enabled": true,
"environment": {
"GERRIT_URL": "https://gerrit.example.com",
"GERRIT_USERNAME": "your-username",
"GERRIT_PASSWORD": "your-http-password"
}
}
}
}Other MCP Clients
Add to your MCP client configuration:
Using npm package (HTTP)
{
"mcpServers": {
"mcp-gerrit-code-review": {
"command": "npx",
"args": ["-y", "mcp-gerrit-code-review"],
"env": {
"GERRIT_URL": "https://gerrit.example.com",
"GERRIT_USERNAME": "your-username",
"GERRIT_PASSWORD": "your-http-password"
}
}
}
}Using npm package (SSH)
{
"mcpServers": {
"mcp-gerrit-code-review": {
"command": "npx",
"args": ["-y", "mcp-gerrit-code-review"],
"env": {
"GERRIT_TRANSPORT": "ssh",
"GERRIT_SSH_HOST": "gerrit.example.com",
"GERRIT_SSH_USER": "your-username",
"GERRIT_SSH_KEY": "/path/to/private/key"
}
}
}
}Using local build
{
"mcpServers": {
"mcp-gerrit-code-review": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"GERRIT_URL": "https://gerrit.example.com",
"GERRIT_USERNAME": "your-username",
"GERRIT_PASSWORD": "your-http-password"
}
}
}
}Tools
Category | Tools | Description |
Changes |
| Code review operations |
Accounts |
| User account management (HTTP only) |
Projects |
| Project discovery |
Server |
| Server metadata (info: HTTP only) |
⚠️ Mutation tools (
post_review,post_review_comment,submit_change,abandon_change,restore_change,add_reviewer) modify Gerrit state — confirm with user before calling.
📝 Note: Available tools depend on transport mode and Gerrit server capabilities. Tools are dynamically registered at startup based on what the server supports.
Architecture
src/
├── index.ts # Entry point, MCP server setup
├── gerrit/
│ ├── client.ts # Gerrit API wrapper with HTTP/SSH transport
│ └── types.ts # TypeScript interfaces
├── tools/
│ ├── changes.ts # 13 change-related tools
│ ├── accounts.ts # 2 account tools (HTTP only)
│ ├── projects.ts # 1 project tool
│ └── server.ts # 2 server tools
└── utils/
└── parsing.ts # Credential resolution, SSH config parsingDevelopment
npm run dev # Watch mode rebuild
npm test # Run tests once
npm run test:watch # Watch mode tests
npm run lint # Type check (tsc --noEmit)License
MIT
This server cannot be installed
Maintenance
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/coveyjorjet/mcp-gerrit-code-review'
If you have feedback or need assistance with the MCP directory API, please join our Discord server