Week 2 at CodeCraft Studios. Your PR Agent from Module 1 is already helping developers write better pull requests - Sarah’s latest PR had a clear description that saved Mike 20 minutes of investigation time. The team is thrilled!
But then disaster strikes.
A critical bug reaches production on Friday afternoon. The payment system is down, customers are complaining, and the team scrambles to investigate. After two stressful hours, they discover the root cause: a test failure in Tuesday’s CI run that nobody noticed.
“How did we miss this?” asks the team lead, scrolling through GitHub Actions. “The tests clearly failed, but with 47 repositories and dozens of daily commits, who has time to check every build?”
The team realizes they need real-time visibility into their CI/CD pipeline, but manually checking GitHub Actions across all their projects isn’t scalable. They need automation that watches for problems and alerts them immediately.
Your mission: Extend your MCP server with webhook capabilities to monitor GitHub Actions and never let another failure slip through unnoticed.
This module bridges the gap between static file analysis (Module 1) and dynamic team notifications (Module 3). You’ll add real-time capabilities that transform your PR Agent into a comprehensive development monitoring system.
Building on the foundation you created in Module 1, you’ll add:
The Setup: Watch how CodeCraft Studios’ new system catches failures before they reach production:
MCP Magic in Real-Time: Claude responds to three key requests:
The Silent Failures No More 🚨: Remember that critical bug from Tuesday’s failed test? With this system, Claude would have caught it immediately. The screencast shows exactly how your MCP server turns GitHub’s raw webhook data into clear, actionable alerts.
What Makes This Special: Your Module 1 PR Agent was static—it analyzed code when asked. This Module 2 enhancement is dynamic—it watches your CI/CD pipeline 24/7 and helps Claude provide real-time insights. No more Friday afternoon surprises!
By the end of this module, you’ll understand:
You’ll build directly on your work from Module 1, so make sure you have:
Prompts are reusable templates that guide Claude through complex workflows. Unlike Tools (which Claude calls automatically), Prompts are user-initiated and provide structured guidance.
Example use cases:
Your MCP server will run two services:
This allows Claude to react to real-time CI/CD events!
Architecture Insight: Running separate services for MCP communication and webhook handling is a clean separation of concerns. The webhook server handles HTTP complexity while your MCP server focuses on data analysis and Claude integration.
github-actions-integration/
├── starter/ # Your starting point
│ ├── server.py # Module 1 code + TODOs
│ ├── pyproject.toml
│ └── README.md
└── solution/ # Complete implementation
├── server.py # Full webhook + prompts
├── pyproject.toml
└── README.mdUnlike Module 1 where you worked with existing files, this module introduces real-time event handling. The starter code includes:
webhook_server.py) - Ready to receive GitHub eventsInstall dependencies (same as Module 1):
uv syncStart the webhook server (in a separate terminal):
python webhook_server.py
This server will receive GitHub webhooks and store them in github_events.json.
How webhook event storage works:
Now you’ll connect your MCP server (from Module 1) to the webhook data. This is much simpler than handling HTTP requests directly - the webhook server does all the heavy lifting and stores events in a JSON file.
Add the path to read webhook events:
# File where webhook server stores events
EVENTS_FILE = Path(__file__).parent / "github_events.json"The webhook server handles all the HTTP details - you just need to read the JSON file! This separation of concerns keeps your MCP server focused on what it does best.
Development Tip: Working with files instead of HTTP requests makes testing much easier. You can manually add events to github_events.json to test your tools without setting up webhooks.
Just like in Module 1 where you created tools for file analysis, you’ll now create tools for CI/CD analysis. These tools will work alongside your existing PR analysis tools, giving Claude a complete view of both code changes and build status.
Note: The starter code already includes the output limiting fix from Module 1, so you won’t encounter token limit errors. Focus on the new concepts in this module!
Implement two new tools:
get_recent_actions_events:
EVENTS_FILEget_workflow_status:
These tools let Claude analyze your CI/CD pipeline.
Now you’ll add your first MCP Prompts! Unlike Tools (which Claude calls automatically), Prompts are templates that help users interact with Claude consistently. Think of them as “conversation starters” that guide Claude through complex workflows.
While Module 1 focused on Tools for data access, this module introduces Prompts for workflow guidance.
Implement four prompts that demonstrate different workflow patterns:
analyze_ci_results: Comprehensive CI/CD analysiscreate_deployment_summary: Team-friendly updatesgenerate_pr_status_report: Combined code + CI reporttroubleshoot_workflow_failure: Systematic debuggingEach prompt should return a string with clear instructions for Claude to follow.
Now for the exciting part - testing your expanded MCP server with real GitHub events! You’ll run multiple services together, just like in a real development environment.
Start your MCP server (same command as Module 1):
uv run server.py
In another terminal, start Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:8080
Configure GitHub webhook with the tunnel URL
Test with Claude Code using the prompts
Create a new prompt that helps with PR reviews by combining:
Enhance get_workflow_status to:
Add a tool that:
/webhook/github@mcp.prompt()lsof -i :8080Excellent work! You’ve successfully added real-time capabilities to your MCP server. You now have a system that can:
/projects/unit3/github-actions-integration/solution/ to see different implementation approachesModule 3 will bring everything together into a complete workflow that your team can actually use!
Your monitoring system is working! CodeCraft Studios now catches CI/CD failures in real-time, and the team feels much more confident about their deployments. But next week brings a new challenge: information silos are causing duplicate work and missed opportunities. Module 3 will complete the automation system with intelligent team notifications that keep everyone in the loop.