CG

cayirtepeomer/gerrit-code-review-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

38 stars 12 forks 质量 58 趋势 0

cayirtepeomer/gerrit-code-review-mcp 是从 https://github.com/cayirtepeomer/gerrit-code-review-mcp. 导入的 MCP 服务器候选。

概览

cayirtepeomer/gerrit-code-review-mcp 是从 https://github.com/cayirtepeomer/gerrit-code-review-mcp. 导入的 MCP 服务器候选。

概述(AI 翻译)

该MCP服务器与Gerrit代码审查系统集成,使AI助手通过简便界面审查代码变更及其细节。

特色

该服务器提供了一套简化的代码审查工具集:

找零详情

  • 获取完整变更信息,包括文件和补丁集
  • 显示每个修改文件的详细差异信息
  • 显示文件的变更、插入和删除
  • 支持评测特定音色集
  • 申报全面的变更细节,包括:
  • 项目及分支信息
  • 作者与审稿人详情
  • 评论与评论历史
  • 带有不同内容的文件修改
  • 当前音色集信息

比较音色组差异

  • 比较变更中两个贴片集的差异
  • 查看具体文件差异或所有更改文件
  • 分析不同版本的代码修改
  • 通过审查迭代跟踪变更的演变

提交评价反馈

  • 发布摘要反馈、投票标签(例如,{"Code-Review": 1})以及内联/文件级评论
  • 针对特定补丁集或默认使用最新版本

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Gerrit Review MCP Server

This MCP server provides integration with Gerrit code review system, allowing AI assistants to review code changes and their details through a simple interface.

Features

The server provides a streamlined toolset for code review:

Fetch Change Details

fetch_gerrit_change(change_id: str, patchset_number: Optional[str] = None)
  • Fetches complete change information including files and patch sets
  • Shows detailed diff information for each modified file
  • Displays file changes, insertions, and deletions
  • Supports reviewing specific patch sets
  • Returns comprehensive change details including:
    • Project and branch information
    • Author and reviewer details
    • Comments and review history
    • File modifications with diff content
    • Current patch set information

Compare Patchset Differences

fetch_patchset_diff(change_id: str, base_patchset: str, target_patchset: str, file_path: Optional[str] = None)
  • Compare differences between two patchsets of a change
  • View specific file differences or all changed files
  • Analyze code modifications across patchset versions
  • Track evolution of changes through review iterations

Submit Review Feedback

submit_gerrit_review(
    change_id: str,
    message: Optional[str] = None,
    patchset_number: Optional[str] = None,
    labels: Optional[Dict[str, int]] = None,
    comments: Optional[List[Dict[str, Any]]] = None,
    notify: str = "OWNER",
)
  • Post summary feedback, vote labels (e.g., {"Code-Review": 1}), and inline/file-level comments
  • Target a specific patchset or default to the latest revision
  • Control Gerrit’s notification behaviour (notify: NONE, OWNER, OWNER_REVIEWERS, ALL)
  • Comment payloads accept dictionaries with path, message, and optional Gerrit comment fields (line, side, range, …)

Example Usage

Review a complete change:

# Fetch latest patchset of change 23824
change = fetch_gerrit_change("23824")

Submit review feedback with a vote and inline comment:

submit_gerrit_review(
    change_id="23824",
    message="Looks good overall",
    labels={"Code-Review": 1},
    comments=[{"path": "src/app.py", "line": 42, "message": "Nice refactor."}],
    patchset_number="2",           # optional: target a specific patchset
    notify="OWNER_REVIEWERS",      # optional: adjust notification scope
)

Compare specific patchsets:

# Compare differences between patchsets 1 and 2 for change 23824
diff = fetch_patchset_diff("23824", "1", "2")

View specific file changes:

# Get diff for a specific file between patchsets
file_diff = fetch_patchset_diff("23824", "1", "2", "path/to/file.swift")

Prerequisites

  • Python 3.10 or higher (Python 3.11 recommended)
  • Gerrit HTTP access credentials
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @cayirtepeomer/gerrit-code-review-mcp --client claude
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "gerrit-review-mcp": { "command": "/path/to/your/workspace/gerrit-code-review-mcp/.venv/bin/python", "args": [ "/path/to/your/workspace/gerrit-code-review-mcp/server.py", "--transport", "stdio" ], "cwd": "/path/to/your/workspace/gerrit-code-review-mcp", "env": { "PYTHONPATH": "/path/to/your/workspace/gerrit-code-review-mcp", "VIRTUAL_ENV": "/path/to/your/workspace/gerrit-code-review-mcp/.venv", "PATH": "/path/to/your/workspace/gerrit-code-review-mcp/.venv/bin:/usr/local/bin:/usr/bin:/bin" }, "stdio": true } } }