GitHub PR Reviewer
Enables reviewing GitHub pull requests via ChatGPT, including listing PRs, viewing diffs, posting comments, approving, and requesting changes.
README
ChatGPT GitHub PR Reviewer
A ChatGPT app that helps you review GitHub Pull Requests directly from within ChatGPT conversations. Built using OpenAI's Apps SDK with the Model Context Protocol (MCP).
Features
- Connect GitHub - OAuth login to connect your GitHub account
- List Pull Requests - View PRs you authored, need to review, or are involved in
- Get PR Context - Full PR details including files changed, diffs, and metadata
- Post Comments - Add general comments or inline comments on specific files/lines
- Approve PRs - Approve pull requests with optional comment
- Request Changes - Request changes with feedback
- Idempotency Protection - Prevents duplicate comments on retries
- OAuth 2.1 Compliant - Full MCP authorization spec with PKCE and discovery endpoints
MCP Tools
1. check_github_auth_status
Connect and check GitHub authentication status.
Input: None
Output (not authenticated):
{
"authenticated": false,
"authUrl": "https://github.com/login/oauth/authorize?..."
}
Output (authenticated):
{
"authenticated": true,
"user": { "login": "username", "name": "Full Name" }
}
2. list_pull_requests
List pull requests with priority cascade.
Input:
{
"username": "octocat" // Optional: filter by author
}
Default behavior (no username):
- First shows PRs where YOU are the author
- If none, shows PRs where you are a reviewer
- If none, shows PRs where you are involved
Output:
{
"pullRequests": [...],
"searchType": "authored" | "reviewing" | "involved" | "user_authored",
"totalCount": 5
}
3. get_pr_context
Get full context for a PR including files changed and diffs.
Input:
{
"pr_name": "owner/repo#123"
}
Output:
{
"pr": { "number": 123, "title": "...", "author": "..." },
"description": "PR description...",
"files": [
{ "filename": "src/index.ts", "status": "modified", "additions": 10, "deletions": 5, "patch": "..." }
],
"commits": 3,
"additions": 50,
"deletions": 20
}
4. post_review_comments
Post review comments to a PR. Supports general and inline comments.
Input:
{
"pr_name": "owner/repo#123",
"comments": [
{ "body": "Looks good!" },
{ "body": "Use async here", "path": "src/index.ts", "line": 42 }
],
"event": "COMMENT" | "APPROVE" | "REQUEST_CHANGES",
"idempotency_key": "unique-key-123"
}
Comment Types:
- General comment: Only
body- appears in PR conversation - Inline comment:
body+path+line- appears on specific line
Output:
{
"success": true,
"reviewId": 12345,
"prUrl": "https://github.com/owner/repo/pull/123",
"commentsPosted": 2
}
Example Prompts
1. Connect GitHub
| Prompt | Output |
|---|---|
| "Connect my GitHub" | Shows GitHub OAuth login button |
| "Login to GitHub" | Shows GitHub OAuth login button |
2. List Pull Requests
| Prompt | Output |
|---|---|
| "List my PRs" | Lists your PRs in priority: authored → reviewing → involved |
| "Show my PRs for review" | Lists PRs where you are a reviewer |
| "List m-musaz PRs" | Lists all open PRs by m-musaz |
3. Get PR Context
| Prompt | Output |
|---|---|
| "Review owner/repo#123" | Returns full PR details: title, description, files, diffs |
| "Get context for PR 123" | Returns full PR details with code changes |
4. Post Review Comments
| Prompt | Output |
|---|---|
| "Add comment: 'Looks good!'" | Posts general comment on PR |
| "Comment on line 42 of src/index.ts: 'Use async here'" | Posts inline comment |
| "Approve this PR" | Approves the PR |
| "Request changes: 'Please add tests'" | Requests changes with feedback |
Project Structure
chatgpt-github-pr-reviewer/
├── package.json # Root package with npm workspaces
├── server/
│ └── src/
│ ├── index.ts # Express server with OAuth endpoints
│ ├── mcp-server.ts # MCP protocol handler
│ ├── mcp-oauth.ts # OAuth 2.1 implementation
│ ├── github-auth.ts # GitHub OAuth logic
│ ├── github-api.ts # GitHub API integration
│ ├── idempotency-service.ts # Duplicate prevention
│ ├── token-store.ts # GitHub token storage
│ └── types.ts # TypeScript types
└── widget/
└── src/
├── GitHubWidget.tsx # Main widget component
└── components/ # UI components
Environment Variables
# GitHub OAuth (from GitHub Developer Settings)
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_REDIRECT_URI=http://localhost:3000/github/callback
# Server
PORT=3000
NODE_ENV=development
# MCP OAuth (for ChatGPT authentication)
MCP_OAUTH_CLIENT_ID=chatgpt-mcp-client
MCP_OAUTH_CLIENT_SECRET=chatgpt-mcp-secret-key-2024
# Widget Base URL
WIDGET_BASE_URL=https://your-app.railway.app
GitHub OAuth App Setup
Step 1: Create GitHub OAuth App
- Go to GitHub Developer Settings
- Click "OAuth Apps" → "New OAuth App"
- Fill in:
- Application name: ChatGPT PR Reviewer
- Homepage URL:
https://your-app.railway.app - Authorization callback URL:
https://your-app.railway.app/github/callback
- Copy Client ID and Client Secret to
.env
Step 2: Required Scopes
| Scope | Purpose |
|---|---|
read:user |
Read user profile |
read:org |
Read organization/team membership |
repo |
Full repository access (required for posting reviews) |
Local Development
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Edit .env with your GitHub OAuth credentials
# Start development server
npm run dev
Deployment
Railway
- Connect your GitHub repo to Railway
- Add environment variables:
GITHUB_CLIENT_ID=your_client_id GITHUB_CLIENT_SECRET=your_client_secret GITHUB_REDIRECT_URI=https://your-app.railway.app/github/callback PORT=3000 NODE_ENV=production WIDGET_BASE_URL=https://your-app.railway.app
ChatGPT Integration
- Create a new ChatGPT App
- Configure MCP:
- Discovery URL:
https://your-app.railway.app/.well-known/oauth-authorization-server
- Discovery URL:
- Test with: "Connect my GitHub" or "List my PRs"
Credits
Built with:
Happy PR Reviewing!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。