@mazhu/mcp-code-review
v1.0.0
Published
MCP Server for AI-powered code review - read GitHub PRs and generate structured review reports
Maintainers
Readme
MCP Code Review Server
AI-powered code review MCP server for GitHub pull requests
A Model Context Protocol (MCP) server that enables AI assistants like Claude to perform comprehensive code reviews on GitHub pull requests. Built with TypeScript and the official @modelcontextprotocol/sdk.
✨ Features
🔍 Automated Code Analysis
- Security vulnerability detection (SQL injection, XSS, secrets exposure, etc.)
- Performance issue detection (memory leaks, N+1 queries, blocking I/O)
- Code style checking (naming conventions, complexity, formatting)
- Logic error detection (null checks, error handling, race conditions)
📊 PR Context
- Fetch PR details, files, comments, and reviews
- Access full diff content
- Get comprehensive PR context for review
📝 Review Reports
- Generate structured review reports in Markdown or JSON
- Categorized issues with severity levels
- Actionable recommendations
🤖 Claude Integration
- Works seamlessly with Claude Desktop
- Pre-built prompts for common review workflows
- Real-time code review assistance
🚀 Quick Start
Installation
# Install globally
npm install -g @deepdadou/mcp-code-review
# Or with npx
npx @deepdadou/mcp-code-reviewClaude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"code-review": {
"command": "npx",
"args": ["@deepdadou/mcp-code-review"]
}
}
}GitHub Authentication (Optional)
For private repositories and higher rate limits, set a GitHub token:
export GITHUB_TOKEN=your_github_personal_access_tokenThe token requires the following scopes:
repo- Access to private repositoriespublic_repo- Access to public repositories
📖 Usage
Tools
The server provides the following tools for code review:
| Tool | Description |
|------|-------------|
| fetch_pr | Fetch PR details, files, and metadata |
| review_security | Check for security vulnerabilities |
| review_performance | Check for performance issues |
| review_style | Check code style and conventions |
| review_logic | Check for logic errors |
| generate_report | Generate comprehensive review report |
| get_file_contents | Fetch specific file content |
Resources
Access PR data directly via resource URIs:
| Resource URI | Description |
|--------------|-------------|
| pr://{owner}/{repo}/{prNumber} | PR details |
| pr://{owner}/{repo}/{prNumber}/files | Changed files |
| pr://{owner}/{repo}/{prNumber}/diff | Full diff |
| pr://{owner}/{repo}/{prNumber}/comments | All comments |
| pr://{owner}/{repo}/{prNumber}/reviews | PR reviews |
| pr://{owner}/{repo}/{prNumber}/commits | PR commits |
| pr://{owner}/{repo}/{prNumber}/context | Full context |
Prompts
Built-in prompts for common workflows:
| Prompt | Description |
|--------|-------------|
| review-pr | Comprehensive PR review |
| compare-prs | Compare two PRs for conflicts |
| quick-security-check | Quick security audit |
| suggest-tests | Suggest test cases |
| explain-changes | Explain changes in plain language |
| find-related-issues | Find related issues and edge cases |
💡 Example Usage in Claude
Review a Pull Request
Please review pull request #42 in facebook/react using the review-pr prompt.Security Focus
Perform a security review of PR #123 in myorg/myrepo.
Focus on SQL injection and XSS vulnerabilities.Generate Report
Generate a comprehensive review report for PR #456 in owner/repo.
Include the diff snippets and format as markdown.🔧 Development
# Clone the repository
git clone https://github.com/deepdadou/mcp-code-review.git
cd mcp-code-review
# Install dependencies
npm install
# Build
npm run build
# Test
npm test
# Run locally
npm run dev🎯 Roadmap
v1.1.0
- [ ] Support for more security patterns (CSRF, SSRF)
- [ ] Custom pattern configuration
- [ ] Integration with CI/CD pipelines
v1.2.0
- [ ] Support for GitLab and Bitbucket
- [ ] AI-powered suggestion generation
- [ ] Review history and metrics
v2.0.0
- [ ] Enterprise features: SSO, audit logs
- [ ] Team review workflows
- [ ] Custom review templates
🤝 Contributing
Contributions are welcome! Please read our Contributing Guide for details.
📄 License
MIT License - see LICENSE for details.
🙏 Acknowledgments
- Model Context Protocol by Anthropic
- GitHub API
- All contributors and supporters
Made with ❤️ by Mike Wang
