github-pr-review

github-pr-review

Enables LLM clients to list, read, review, and comment on GitHub pull requests, turning an AI assistant into a fully capable code reviewer.

Category
访问服务器

README

GitHub PR Review MCP Server

An MCP server that gives any LLM client the ability to list, read, review, and comment on GitHub pull requests — turning your AI assistant into a fully capable code reviewer.


Overview

This server wraps the GitHub REST API using FastMCP, exposing pull request operations as tools any MCP-compatible client can call. Connect it to Claude Desktop and you can ask Claude to review your open PRs, read diffs, post inline comments, approve, or request changes — all without leaving your conversation.

The server maintains a single authenticated httpx client across its lifetime, initialised on startup and shared across all tool calls via FastMCP's lifespan context.


Tools

Tool Description
list_open_prs List all open PRs with author, title, draft status, and URL
get_pr_diff Get file changes and unified diffs for a specific PR
get_pr_comments Get all existing review comments on a PR
post_review_comment Post an inline comment on a specific file and line
approve_pr Approve a PR with an optional review message
request_changes Request changes on a PR with a review message

Note: approve_pr and request_changes require the authenticated user to be different from the PR author. GitHub does not permit self-review.


Project Structure

github-pr-mcp/
├── server.py          # FastMCP instance, lifespan, tool registration
├── config.py          # Environment variables and constants
├── tools/
│   ├── __init__.py
│   ├── prs.py         # list_open_prs, get_pr_diff
│   └── reviews.py     # get_pr_comments, post_review_comment, approve_pr, request_changes
├── .env               # Your secrets (never committed)
├── .env.example       # Template
├── requirements.txt
├── Dockerfile
└── README.md

Requirements

  • Python 3.11+
  • uv
  • A GitHub Personal Access Token with repo scope

Setup

1. Clone the repository:

git clone https://github.com/Festuskipkoech/github-pr-mcp.git
cd github-pr-mcp

2. Install dependencies:

uv sync

3. Configure your environment:

cp .env.example .env

Edit .env and fill in your values:

GITHUB_TOKEN=your_personal_access_token
GITHUB_OWNER=your_github_username
GITHUB_REPO=your_repository_name

Generate a token at GitHub Settings → Developer Settings → Personal Access Tokens. Enable full repo scope for read and write access.


Running Locally

uv run python server.py

Or with the FastMCP CLI on Streamable HTTP transport:

fastmcp run server.py:mcp --transport streamable-http

Testing with MCP Inspector

Start the server in one terminal:

fastmcp run server.py:mcp --transport streamable-http

Launch the Inspector in a second terminal:

npx -y @modelcontextprotocol/inspector

In the Inspector UI:

  • Transport: Streamable HTTP
  • URL: http://127.0.0.1:8000/mcp
  • Click Connect

Recommended test sequence:

Step Tool Input
1 list_open_prs (no arguments)
2 get_pr_diff {"pr_number": 1}
3 get_pr_comments {"pr_number": 1}
4 post_review_comment {"pr_number": 1, "body": "Looks good", "path": "file.py", "line": 1}

Using with Claude Desktop

Add the following to ~/.config/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "github-pr-review": {
      "command": "/home/your-user/.local/bin/uv",
      "args": [
        "run",
        "--directory",
        "/absolute/path/to/github-pr-mcp",
        "python",
        "server.py"
      ]
    }
  }
}

Use the full path to uv (find it with which uv). Credentials are read from the .env file automatically — no need to pass them in the config.

Restart Claude Desktop, then try:

List all open pull requests in my repo and show me the diff for PR number 1

Claude calls list_open_prs and get_pr_diff and returns structured results:

Claude listing open PRs and fetching the diff

Full PR diff and file changes returned inline:

PR diff results in Claude Desktop


Running with Docker

docker build -t github-pr-mcp .
docker run --env-file .env -p 8000:8000 github-pr-mcp

For Streamable HTTP transport, update server.py to run with:

mcp.run(transport="streamable-http", host="0.0.0.0", port=8000)

Troubleshooting

Error Cause Fix
401 Unauthorized Invalid or expired token Regenerate PAT on GitHub
403 Forbidden Token lacks write scope Enable full repo scope on your PAT
404 Not Found Wrong owner or repo name Check .env — use just the repo name, not the full URL
422 Unprocessable on approve Self-review attempt GitHub blocks approving your own PRs by design

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选