A Model Context Protocol (MCP) server that automates pull request analysis and team notifications through Slack integration.
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.
- 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
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
The project includes templates for common PR types:
- Bug fixes
- Feature implementations
- Documentation updates
- Code refactoring
- Tests
- Performance improvements
- Security fixes
- Clone the repository:
git clone https://github.com/mozaloom/codecraft-pr-agent.git
cd codecraft-pr-agent- Install dependencies using uv (recommended):
uv syncOr using pip:
pip install -r requirements.txt- Set up environment variables:
Create a
.envfile with:
GEMINI_API_KEY=your_google_gemini_api_key_here
SLACK_WEBHOOK_URL=your_slack_webhook_url
Alternatively, run the setup script:
bash setup.shpython server.pypython webhook_server.pySet 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
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.
- Python 3.12+
- UV package manager (recommended) or pip
- Google Gemini API key
- Slack webhook URL
- GitHub repository with webhook access
Run tests:
pytestOr with uv:
uv run pytestSee LICENSE file for details.