mozaloom/codecraft-pr-agent
If you are the rightful owner of codecraft-pr-agent and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
An intelligent MCP server that analyzes git changes and suggests the best PR template for pull requests.
PR Agent
A Model Context Protocol (MCP) server that automates pull request analysis and team notifications through Slack integration.
Overview
This project provides an intelligent PR agent that monitors GitHub workflow events, analyzes pull requests using AI, and sends structured notifications to Slack channels. It combines MCP tools and prompts to create complete team communication workflows.
Features
- Automated PR Analysis: Uses Google Gemini AI to analyze pull request content and generate insights
- GitHub Webhook Integration: Monitors GitHub Actions events and workflow runs
- Slack Notifications: Sends formatted notifications to Slack channels via webhooks
- PR Templates: Supports multiple PR types with predefined templates (bug fixes, features, documentation, etc.)
- Event Storage: Stores GitHub events for processing and analysis
- MCP Server: Exposes tools and prompts through the Model Context Protocol
Components
Core Files
server.py
- Main MCP server with Slack notification integrationwebhook_server.py
- GitHub webhook endpoint for receiving eventsmcp_gemini_client.py
- Gemini AI client for PR analysistemplates/
- PR templates for different types of changes
Templates
The project includes templates for common PR types:
- Bug fixes
- Feature implementations
- Documentation updates
- Code refactoring
- Tests
- Performance improvements
- Security fixes
Installation
- Clone the repository:
git clone https://github.com/mozaloom/codecraft-pr-agent.git
cd codecraft-pr-agent
- Install dependencies using uv (recommended):
uv sync
Or using pip:
pip install -r requirements.txt
- Set up environment variables:
Create a
.env
file with:
GEMINI_API_KEY=your_google_gemini_api_key_here
SLACK_WEBHOOK_URL=your_slack_webhook_url
Alternatively, run the setup script:
bash setup.sh
Usage
Start the MCP Server
python server.py
Start the Webhook Server
python webhook_server.py
Configure GitHub Webhooks
Set up a webhook in your GitHub repository pointing to your webhook server endpoint. The webhook should trigger on:
- Pull request events
- Workflow run events
- Check run events
Configuration
The agent can be configured through environment variables and the templates directory. Modify the templates to customize PR analysis for your team's specific needs.
Requirements
- Python 3.12+
- UV package manager (recommended) or pip
- Google Gemini API key
- Slack webhook URL
- GitHub repository with webhook access
Development
Run tests:
pytest
Or with uv:
uv run pytest
License
See LICENSE file for details.