PR Review MCP Server

PR Review MCP Server

Enables management of GitHub pull request review threads through natural language, allowing users to list, reply to, and resolve PR review comments using GitHub's GraphQL API.

Category
Visit Server

README

PR Review MCP Server

CI/CD License: MIT

GitHub PR レビューコメントを取得・応答・解決するためのMCPサーバーです。

機能

このMCPサーバーは以下の4つのツールを提供します:

  1. list_review_threads - PRのレビュースレッド一覧を取得
  2. reply_to_review_thread - レビュースレッドに返信
  3. resolve_review_thread - レビュースレッドを解決
  4. reply_and_resolve - 返信と解決を一度に実行

前提条件

  • GitHub CLI (gh) がインストールされ、認証済みであること
    gh auth login
    
  • uv (Python 3.10以上)

インストール

uvを使用する方法(推奨)

# uvのインストール(まだの場合)
curl -LsSf https://astral.sh/uv/install.sh | sh

# プロジェクトディレクトリに移動
cd /path/to/CodeReviewResolvedMcp

# 依存関係のインストール
uv sync

# 開発用依存関係も含める場合
uv sync --dev

従来のpipを使用する方法

# プロジェクトディレクトリに移動
cd /path/to/CodeReviewResolvedMcp

# インストール
pip install -e .

# 開発用の依存関係も含める場合
pip install -e ".[dev]"

MCPクライアントでの使用

Claude Desktopの設定

uvを使用する場合(推奨)

~/.config/Claude/claude_desktop_config.json (Linux):

{
  "mcpServers": {
    "pr-review": {
      "command": "uv",
      "args": ["run", "pr-review-mcp"],
      "cwd": "/path/to/CodeReviewResolvedMcp"
    }
  }
}

python3を使用する場合

{
  "mcpServers": {
    "pr-review": {
      "command": "python3",
      "args": ["-m", "pr_review_mcp.server"],
      "cwd": "/path/to/CodeReviewResolvedMcp"
    }
  }
}

使用例

1. レビュースレッド一覧の取得

未解決のレビューコメントを確認したいので、owner/repo の PR #123 のレビュースレッドを表示してください

2. レビューコメントに返信

thread_id: PRRT_xxx のスレッドに "修正しました。ご確認ください。" と返信してください

3. レビュースレッドの解決

thread_id: PRRT_xxx のスレッドを解決済みにしてください  

4. 返信と解決を一度に実行

thread_id: PRRT_xxx のスレッドに "対応完了しました" と返信し、解決してください

ツールの詳細

list_review_threads

PRのレビュースレッド一覧を取得します。

パラメータ:

  • owner (string, 必須): リポジトリオーナー
  • repo (string, 必須): リポジトリ名
  • pull_number (integer, 必須): PR番号
  • unresolved_only (boolean, オプション): 未解決のみ取得 (デフォルト: true)

出力例:

{
  "pull_request": "owner/repo#123",
  "thread_count": 2,
  "threads": [
    {
      "id": "PRRT_kwDOABC...",
      "is_resolved": false,
      "file": "src/main.py",
      "line": 42,
      "first_comment": {
        "author": "reviewer",
        "body": "このロジックを改善できますか?",
        "created_at": "2025-12-10T12:00:00Z"
      }
    }
  ]
}

reply_to_review_thread

レビュースレッドに返信を追加します。

パラメータ:

  • owner (string, 必須): リポジトリオーナー
  • repo (string, 必須): リポジトリ名
  • pull_number (integer, 必須): PR番号
  • thread_id (string, 必須): スレッドID
  • body (string, 必須): 返信内容(Markdownサポート)

resolve_review_thread

レビュースレッドを解決済みとしてマークします。

パラメータ:

  • thread_id (string, 必須): スレッドID

reply_and_resolve

レビュースレッドに返信し、即座に解決します。

パラメータ:

  • owner (string, 必須): リポジトリオーナー
  • repo (string, 必須): リポジトリ名
  • pull_number (integer, 必須): PR番号
  • thread_id (string, 必須): スレッドID
  • body (string, 必須): 返信内容(Markdownサポート)

技術詳細

このMCPサーバーは以下の技術を使用しています:

  • GitHub GraphQL API: レビュースレッドの取得と操作
  • gh CLI: GitHub APIへのアクセス(認証を含む)
  • MCP (Model Context Protocol): AIアシスタントとの統合

GraphQL APIの使用

このサーバーは主に以下のGraphQL操作を使用します:

  • クエリ: repository.pullRequest.reviewThreads - レビュースレッド取得
  • ミューテーション: addPullRequestReviewThreadReply - 返信追加
  • ミューテーション: resolveReviewThread - スレッド解決

トラブルシューティング

gh command failed エラー

gh CLIが正しくインストール・認証されているか確認してください:

gh auth status

認証されていない場合:

gh auth login

Pull request not found エラー

  • リポジトリ名、オーナー、PR番号が正しいか確認
  • PRが実際に存在するか確認
  • ghコマンドで該当リポジトリにアクセス権限があるか確認

GraphQL errors エラー

  • thread_idが正しいか確認(list_review_threadsで取得したIDを使用)
  • PR番号が正しいか確認
  • リポジトリへの書き込み権限があるか確認

ライセンス

このプロジェクトはMITライセンスの下で公開されています。

開発

依存関係の管理

# 依存関係の追加
uv add <package-name>

# 開発用依存関係の追加
uv add --dev <package-name>

# 依存関係の同期
uv sync

コード品質チェック

# Ruffでリント
uv run ruff check .

# Ruffでフォーマット
uv run ruff format .

# 型チェック(追加予定)
# uv run mypy src/

テストの実行

# すべてのテストを実行
uv run pytest

# 詳細表示で実行
uv run pytest -v

# 特定のテストファイルを実行
uv run pytest tests/test_gh_api.py

# カバレッジ付きで実行(pytest-covが必要)
# uv add --dev pytest-cov
# uv run pytest --cov=pr_review_mcp

CI/CD

このプロジェクトはGitHub Actionsを使用した自動CI/CDパイプラインを備えています。

ワークフロー

CI/CD(.github/workflows/ci.yml

プッシュとプルリクエストで自動実行されます:

  • Lint: Ruffによるコードのリント
  • Format Check: Ruffによるフォーマットチェック
  • Test: Python 3.10、3.11、3.12での自動テスト
# 実行タイミング
- main ブランチへのプッシュ
- develop ブランチへのプッシュ  
- main/develop ブランチへのプルリクエスト

Release(.github/workflows/release.yml

バージョンタグがプッシュされた時に自動実行されます:

# リリース方法
git tag v0.1.0
git push origin v0.1.0

このワークフローは:

  1. パッケージをビルド
  2. GitHub Releaseを作成
  3. (オプション)PyPIに公開

Dependabot(.github/dependabot.yml

依存関係の自動更新:

  • GitHub Actionsの更新(週次)
  • Python依存関係の更新(週次)

ローカルでCI/CDと同じチェックを実行

# リント
uv run ruff check .

# フォーマットチェック
uv run ruff format --check .

# テスト
uv run pytest -v

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
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
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
Qdrant Server

Qdrant Server

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

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

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
E2B

E2B

Using MCP to run code via e2b.

Official
Featured