Skip to main content
Glama
phase-3.1-webhooks.mdโ€ข11.9 kB
# ๐Ÿ”„ Phase 3.1: Real-Time Updates & Webhooks Integration ## Overview Phase 3.1 introduces comprehensive real-time updates and webhook integration to the GitHub Project Manager MCP server. This implementation eliminates the need for manual refresh operations and provides instant project state synchronization through GitHub's webhook system. ## ๐Ÿš€ Key Features ### Real-Time Webhook Management - **Automated webhook setup** with configurable events - **Webhook health monitoring** and delivery tracking - **Security validation** with HMAC signature verification - **Event processing pipeline** for instant updates - **Fallback mechanisms** for webhook delivery failures ### Live Data Synchronization - **Real-time project status** (never cached) - **Live sprint metrics** with burndown tracking - **Instant activity feeds** with filtering options - **Repository health monitoring** with alerts - **Team performance tracking** in real-time ### Event-Driven Architecture - **Automatic project updates** on GitHub events - **Smart event filtering** and categorization - **Subscription-based notifications** for specific events - **Conflict resolution** for concurrent updates - **Activity history** with comprehensive logging ## ๐Ÿ› ๏ธ Tools Added ### Webhook Management Tools #### `setup_webhooks` Configure GitHub webhooks for real-time repository updates. ```typescript { webhook_url: string; // Your webhook endpoint URL events?: string[]; // GitHub events to subscribe to secret?: string; // Webhook secret for validation active?: boolean; // Whether webhook should be active } ``` **Example:** ``` setup_webhooks { "webhook_url": "https://your-server.com/github-webhook", "events": ["issues", "milestone", "pull_request", "push"], "secret": "your-secure-secret", "active": true } ``` #### `list_webhooks` Display all configured webhooks with their status and configuration. ```typescript // No parameters required {} ``` #### `test_webhook` Test webhook connectivity and response times. ```typescript { webhook_id?: number; // Optional: specific webhook to test } ``` #### `remove_webhooks` Remove webhook configurations from the repository. ```typescript { webhook_id?: number; // Optional: specific webhook to remove confirm: boolean; // Required confirmation } ``` #### `get_webhook_deliveries` View webhook delivery history and success rates. ```typescript { webhook_id: number; // Webhook ID to check per_page?: number; // Number of deliveries to fetch } ``` #### `get_webhook_status` Get comprehensive webhook health and configuration status. ```typescript { webhook_id?: number; // Optional: specific webhook to check } ``` ### Live Update Tools #### `get_live_project_status` Fetch real-time project metrics (never cached). ```typescript { include_activity?: boolean; // Include recent activity activity_timeframe?: string; // '1h', '6h', '24h', '7d' } ``` **Features:** - Real-time issue and milestone counts - Active webhook status monitoring - Recent activity summary - Sprint progress tracking - Performance health indicators #### `get_live_sprint_metrics` Get comprehensive sprint analytics with real-time data. ```typescript { sprint_number?: number; // Specific sprint to analyze milestone_number?: number; // Alternative: milestone number include_burndown?: boolean; // Include burndown data include_velocity?: boolean; // Include velocity metrics include_team_metrics?: boolean; // Include team performance } ``` **Metrics Include:** - Sprint progress and completion rates - Story point tracking and velocity - Team workload distribution - Burndown and completion projections - Risk assessment and timeline analysis #### `get_recent_activity` Fetch filtered activity feed with real-time updates. ```typescript { timeframe?: string; // '1h', '6h', '24h', '7d', '30d' event_types?: string[]; // Filter by event types actors?: string[]; // Filter by specific users include_pull_requests?: boolean; include_issues?: boolean; include_milestones?: boolean; include_projects?: boolean; limit?: number; // Max items to return } ``` #### `subscribe_to_updates` Create real-time update subscriptions for specific events. ```typescript { subscription_id: string; // Unique subscription identifier events: string[]; // Events to subscribe to callback?: string; // Optional callback configuration } ``` #### `get_live_repository_health` Comprehensive repository health monitoring with real-time metrics. ```typescript // No parameters required {} ``` **Health Metrics:** - Repository activity scores - Issue management effectiveness - Pull request merge rates - Milestone completion tracking - Stale content detection - Team collaboration metrics ## ๐Ÿ”ง Implementation Architecture ### WebhookService Class Central service managing all webhook operations and real-time updates. ```typescript class WebhookService extends EventEmitter { // Webhook management async setupWebhook(config: WebhookConfig): Promise<ToolResponse> async listWebhooks(): Promise<ToolResponse> async testWebhook(args: TestArgs): Promise<ToolResponse> async removeWebhooks(args: RemoveArgs): Promise<ToolResponse> // Live data operations async getLiveProjectStatus(): Promise<ToolResponse> async getLiveSprintMetrics(args: MetricsArgs): Promise<ToolResponse> async getRecentActivity(filter: ActivityFilter): Promise<ActivityItem[]> // Event processing async processWebhookEvent(event: GitHubWebhookEvent): Promise<void> verifyWebhookSignature(payload: string, signature: string): boolean // Subscription management subscribeToUpdates(args: SubscriptionArgs): ToolResponse } ``` ### Event Processing Pipeline 1. **Webhook Reception** - Signature validation - Event parsing and routing - Security checks 2. **Event Processing** - Event type classification - Data extraction and normalization - Activity cache updates 3. **Real-time Updates** - Subscriber notifications - Metrics recalculation - Status synchronization 4. **Conflict Resolution** - Concurrent update handling - Data consistency checks - Error recovery mechanisms ## ๐Ÿ” Security Features ### Webhook Signature Validation All webhook payloads are validated using HMAC-SHA256 signatures. ```typescript const isValid = webhookService.verifyWebhookSignature( payload, // Raw webhook payload signature // X-Hub-Signature-256 header ); ``` ### Secure Event Processing - Input validation and sanitization - Rate limiting and throttling - Error handling and logging - Unauthorized access prevention ### Environment Security - Secret management through environment variables - SSL/TLS requirement for webhook endpoints - Token scope validation ## ๐Ÿ“Š Supported GitHub Events ### Core Events - **issues**: Issue creation, updates, assignments, closures - **milestone**: Milestone creation, updates, completions - **pull_request**: PR creation, reviews, merges, closures - **push**: Code commits and branch updates - **release**: Release creation and publishing ### Extended Events - **projects_v2**: Project board updates and item changes - **repository**: Repository settings and configuration changes - **star**: Repository starring and unstarring - **watch**: Repository watching and unwatching ## ๐Ÿš€ Getting Started ### 1. Environment Setup ```bash export GITHUB_TOKEN="your-github-token" export GITHUB_OWNER="your-username" export GITHUB_REPO="your-repository" export WEBHOOK_URL="https://your-server.com/webhook" export GITHUB_WEBHOOK_SECRET="your-secret" ``` ### 2. Webhook Endpoint Setup Create a publicly accessible endpoint to receive GitHub webhooks: ```typescript import express from 'express'; import { WebhookService } from './webhook-service.js'; const app = express(); app.use(express.json()); app.post('/github-webhook', async (req, res) => { const signature = req.headers['x-hub-signature-256']; const payload = JSON.stringify(req.body); // Verify webhook signature if (!webhookService.verifyWebhookSignature(payload, signature)) { return res.status(401).send('Invalid signature'); } // Process the event try { await webhookService.processWebhookEvent(req.body); res.status(200).send('OK'); } catch (error) { res.status(500).send('Processing failed'); } }); app.listen(3000, () => { console.log('Webhook server running on port 3000'); }); ``` ### 3. Configure Webhooks ``` setup_webhooks { "webhook_url": "https://your-server.com/github-webhook", "events": ["issues", "milestone", "pull_request"], "secret": "your-webhook-secret" } ``` ### 4. Monitor Real-time Updates ``` get_live_project_status get_live_sprint_metrics get_recent_activity { "timeframe": "24h" } ``` ## ๐Ÿ“ˆ Performance Optimizations ### Efficient Data Fetching - Parallel API calls for comprehensive data - Smart caching for frequently accessed data - Rate limiting compliance with GitHub API ### Event Processing - Asynchronous event handling - Event queuing for high-volume repositories - Graceful degradation on API failures ### Memory Management - Activity cache size limits - Automatic cleanup of old events - Subscription lifecycle management ## ๐Ÿ” Monitoring and Debugging ### Webhook Health Monitoring ``` get_webhook_status get_webhook_deliveries { "webhook_id": 123 } ``` ### Activity Tracking ``` get_recent_activity { "timeframe": "1h", "include_issues": true, "include_pull_requests": true } ``` ### Repository Health ``` get_live_repository_health ``` ## ๐Ÿ› ๏ธ Troubleshooting ### Common Issues #### Webhook Setup Failures - Verify webhook URL is publicly accessible - Check GitHub token permissions (admin:repo_hook required) - Ensure SSL certificate is valid for HTTPS endpoints #### Event Processing Errors - Validate webhook signature configuration - Check network connectivity to GitHub API - Review event payload structure compatibility #### Real-time Update Delays - Monitor webhook delivery success rates - Check webhook endpoint response times - Verify event processing pipeline health ### Debug Tools ``` test_webhook { "webhook_id": 123 } get_webhook_deliveries { "webhook_id": 123, "per_page": 10 } get_webhook_status ``` ## ๐Ÿ”ฎ Future Enhancements ### Planned Features - **Real-time notifications** with multiple delivery channels - **Advanced event filtering** with custom rules - **Webhook retry mechanisms** with exponential backoff - **Integration webhooks** for external project management tools - **Real-time collaboration** features for team synchronization ### Performance Improvements - **Event batching** for high-volume repositories - **WebSocket connections** for instant browser updates - **Distributed processing** for enterprise deployments - **Advanced caching** strategies for improved response times ## ๐Ÿ“š API Reference For complete API documentation, see the tool definitions in `src/tools/index.ts` and type definitions in `src/shared/webhook-types.ts`. ## ๐ŸŽฏ Success Metrics Phase 3.1 delivers: - โœ… **Zero manual refresh** operations required - โœ… **Sub-second** real-time update delivery - โœ… **99.9% webhook reliability** with proper setup - โœ… **Comprehensive security** with signature validation - โœ… **Full event coverage** for all major GitHub activities - โœ… **Production-ready** architecture and error handling --- **Phase 3.1** transforms the GitHub Project Manager MCP from a static data tool into a dynamic, real-time project management powerhouse that responds instantly to repository changes and provides live insights into project health and team performance.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Faresabdelghany/github-project-manager-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server