Vibe-Code-Agent/github-review
If you are the rightful owner of github-review and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
An MCP server for comprehensive GitHub Pull Request review, code analysis, and security issue detection.
GitHub PR Review MCP Server
An MCP (Model Context Protocol) server for comprehensive GitHub Pull Request review, code analysis, and security issue detection.
Features
- 🔍 Comprehensive PR Analysis: Analyzes pull requests for code quality, security vulnerabilities, and best practices
- 🛡️ Security Scanning: Detects common security issues and vulnerabilities across multiple programming languages
- 📊 Code Quality Assessment: Evaluates code maintainability, complexity, and adherence to best practices
- 🚨 Risk Assessment: Provides overall risk ratings and actionable recommendations
- 🔧 Multi-language Support: Supports JavaScript, TypeScript, Python, Java, C#, PHP, and more
- 📋 Detailed Reporting: Generates comprehensive review reports with file-level analysis
Installation
Prerequisites
- Node.js 18.0.0 or higher
- GitHub Personal Access Token with repository access
Setup
- Clone the repository:
git clone https://github.com/doraemon0905/github-review.git
cd github-review
- Install dependencies:
npm install
- Build the project:
npm run build
- Set up environment variables:
export GITHUB_TOKEN=your_github_personal_access_token
Usage
Running the MCP Server
npm start
The server will start and listen for MCP connections on stdio.
Configuration in Cursor/Claude
Add the following configuration to your MCP settings:
{
"github-pr-review": {
"command": "node",
"args": ["/path/to/github-review/dist/index.js"],
"env": {
"GITHUB_TOKEN": "your_github_token_here"
}
}
}
Available Tools
1. get_pull_request
Fetch pull request details including metadata and file changes.
Parameters:
owner(string): Repository owner (username or organization)repo(string): Repository namepull_number(number): Pull request number
Example:
Get pull request microsoft/vscode #12345
2. review_pull_request
Perform a comprehensive review of a pull request including code analysis, issue detection, and security checks.
Parameters:
owner(string): Repository ownerrepo(string): Repository namepull_number(number): Pull request numberinclude_security(boolean, optional): Include security analysis (default: true)include_best_practices(boolean, optional): Include best practices recommendations (default: true)severity_threshold(string, optional): Minimum severity level to report - "low", "medium", "high", or "critical" (default: "medium")
Example:
Review pull request microsoft/vscode #12345 with high severity threshold
3. analyze_code_diff
Analyze specific code changes for issues and security vulnerabilities.
Parameters:
diff_content(string): Git diff content to analyzefile_path(string): Path of the file being analyzedlanguage(string, optional): Programming language (auto-detected if not provided)include_security(boolean, optional): Include security analysis (default: true)
Example:
Analyze this diff for security issues:
```diff
+function validateUser(input) {
+ return eval(input.code);
+}
4. get_repository_prs
List pull requests for a repository with filtering options.
Parameters:
owner(string): Repository ownerrepo(string): Repository namestate(string, optional): PR state filter - "open", "closed", or "all" (default: "open")limit(number, optional): Maximum number of PRs to return (default: 10, max: 100)sort(string, optional): Sort criteria - "created", "updated", "popularity", or "long-running" (default: "created")
Example:
List open pull requests for microsoft/vscode
Security Analysis
The server detects various security issues including:
JavaScript/TypeScript
- Use of
eval()and similar dangerous functions - XSS vulnerabilities via
innerHTML - Unsafe
setTimeoutusage - TypeScript
anytype usage - Hardcoded secrets and API keys
Python
- Use of
exec()andeval() - Unsafe
pickleusage - Bare
exceptclauses - Input validation issues
PHP
- SQL injection patterns
- Use of dangerous functions
- Unvalidated superglobal usage
General
- Hardcoded passwords and API keys
- Commented-out code
- TODO/FIXME markers
- Long lines and code complexity
Code Quality Assessment
The analyzer evaluates:
- Complexity: Cyclomatic complexity based on decision points
- Maintainability: Score based on line count, complexity, and readability
- Duplicate Code: Detection of repeated code patterns
- Best Practices: Language-specific coding standards
- File Risk: Assessment based on file types and patterns
Risk Assessment
Each PR receives an overall risk rating:
- Low: Minor issues, safe to merge
- Medium: Some issues present, review recommended
- High: Security concerns or multiple issues
- Critical: Serious issues that block merging
Development
Project Structure
src/
├── index.ts # Main MCP server
├── services/
│ ├── GitHubService.ts # GitHub API interactions
│ ├── CodeAnalyzer.ts # Code analysis engine
│ └── PRReviewer.ts # PR review orchestrator
Building
npm run build
Development Mode
npm run dev
Linting
npm run lint
Testing
npm test
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run the test suite:
npm test - Run the linter:
npm run lint - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Create a Pull Request
License
This project is licensed under the MIT License - see the file for details.
Security
If you discover a security vulnerability, please send an email to nguyentruonggiang91@gmail.com. All security vulnerabilities will be promptly addressed.
Changelog
Version 1.0.0
- Initial release
- GitHub PR analysis
- Multi-language security scanning
- Code quality assessment
- Risk assessment and recommendations