mcp-gerrit-code-review

mcp-gerrit-code-review

MCP Server providing AI agents with tooling for Gerrit code review workflows via stdio transport.

Category
Visit Server

README

MCP Gerrit Code Review

npm TypeScript License: MIT

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 ~/.netrc fallback (HTTP mode)
  • SSH key auth with env vars or ~/.ssh/id_rsa fallback (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-review

Or install globally:

npm install -g mcp-gerrit-code-review

Option 2: Build from source

git clone https://github.com/coveyjorjet/mcp-gerrit-code-review.git
cd mcp-gerrit-code-review
npm install && npm run build

Configuration

HTTP Transport (Default)

Set via environment variables:

export GERRIT_URL=https://gerrit.example.com
export GERRIT_USERNAME=your-username
export GERRIT_PASSWORD=your-http-password

Or use ~/.netrc:

machine gerrit.example.com
  login your-username
  password your-http-password

SSH 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  # optional

Or use SSH URL format in GERRIT_URL:

export GERRIT_TRANSPORT=ssh
export GERRIT_URL=ssh://your-username@gerrit.example.com:29418

SSH 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 query_changes, get_change_details, list_change_files, get_file_diff, get_commit_message, post_review, post_review_comment, list_change_comments, submit_change, abandon_change, restore_change, list_reviewers, add_reviewer Code review operations
Accounts get_account, query_accounts User account management (HTTP only)
Projects list_projects Project discovery
Server get_server_version, get_server_info 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 parsing

Development

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured