github-incident-mcp
by itsme825
README.md
# Agentic Incident Response Pipeline
An autonomous, multi-agent incident response pipeline built with **LangGraph**, **LangChain**, and official **FastMCP (Model Context Protocol)** servers for real-time incident triage, root-cause diagnostics, automated remediation, human sign-off state persistence, and Slack notification dispatching.
---
## πArchitecture Overview
```mermaid
sequenceDiagram
autonumber
actor Alert as Alert Trigger (PagerDuty / GitHub / Prometheus)
participant Triage as Triage Agent
participant OSV as OSV MCP Server
participant Diag as Diagnostic Agent
participant GH as GitHub MCP Server
participant Remed as Remediation Agent
actor Gate as Human Sign-off Gate
participant Exec as Execution Agent
participant Slack as Slack Channel
Alert->>Triage: Ingest Alert Payload
Triage->>OSV: Tool Call: osv_scan_alert_payload()
OSV-->>Triage: Vulnerability Advisories & Severity
Triage->>Diag: TriageResult (Sev1-Sev4)
Diag->>GH: Tool Call: github_list_recent_prs()
GH-->>Diag: Merged PRs & Diff Summaries
Diag->>Diag: Temporal Correlation (Error spike vs. PR merge)
Diag->>Remed: DiagnosticResult & Root Cause
Remed->>Gate: Draft Proposal (Pauses at Sign-off Gate)
alt Approve
Gate->>Exec: Approve Command
Exec->>GH: Tool Call: github_execute_revert_pr()
Exec->>Slack: Dispatch Incident Resolution Card
else Edit Command / Reject / Escalate
Gate->>Slack: Execute Overridden Command or Escalate
end
```
---
## Key Features
1. **Triage Agent & Security Cross-Check**:
- Classifies incident severity (`Sev1` to `Sev4`) and affected component.
- Integrates with **OSV MCP Server** (`https://api.osv.dev/v1/query`) to cross-check dependency vulnerabilities (CVEs).
2. **Diagnostic Agent & Temporal Root Cause Correlation**:
- Interfaces with **GitHub FastMCP Server** to query recently merged PRs and commit diffs.
- Correlates error log spikes and metric anomalies with PR merge timestamps.
3. **Remediation Agent & Feedback Loop**:
- Proposes targeted remediation actions (Git PR reverts or deployment rollbacks).
- Re-plans proposals based on human engineer feedback if rejected at the gate.
4. **Human Sign-off Gate (LangGraph State Graph Persistence)**:
- Genuinely pauses graph execution using `interrupt()` and `MemorySaver`.
- Supports 4 interactive actions: `APPROVE`, `EDIT_COMMAND`, `REJECT`, `ESCALATE`.
5. **Execution Agent & Slack Notifications**:
- Executes approved PR reverts programmatically via GitHub REST API.
- Dispatches rich Slack cards to `#oncall-incidents` or escalation alerts to `#senior-oncall-team`.
---
## Repository Structure
```text
βββ src/
β βββ agents/ # Triage, Diagnostic, Remediation, Execution Agents
β βββ mcp/ # GitHub & OSV FastMCP Servers (stdio transport)
β βββ models/ # Pydantic schemas (Alert, Triage, Diagnostic, Remediation, Execution)
β βββ pipeline/ # LangGraph IncidentPipeline state graph
β βββ services/ # GitHub, OSV, Log/Metrics, Notification Services
β βββ utils/ # Logging and utility helpers
β βββ config.py # Centralized configuration settings
βββ tests/
β βββ test_mcp_servers.py
β βββ test_pipeline_graph.py
β βββ run_test_scenario.py # E2E Multi-Agent Scenario Suite
βββ .env.example
βββ .gitignore
βββ requirements.txt
βββ README.md
```
---
## Installation & Setup
1. **Clone Repository & Install Dependencies**:
```bash
git clone https://github.com/<YOUR_USERNAME>/agentic-debugging-project.git
cd agentic-debugging-project
pip install -r requirements.txt
```
2. **Configure Environment Variables**:
Copy `.env.example` to `.env` and set your credentials:
```bash
cp .env.example .env
```
Edit `.env`:
```env
GEMINI_API_KEY=your_gemini_api_key_here
GITHUB_TOKEN=your_github_personal_access_token_here
LLM_PROVIDER=gemini
LLM_MODEL=gemini-2.5-flash
```
---
## Testing & Verification
1. **Run Unit Tests**:
```bash
python -m pytest tests/
```
2. **Run E2E Incident Scenarios**:
```bash
python -m tests.run_test_scenario
```
3. **Run Stdio FastMCP Servers**:
- GitHub FastMCP Server:
```bash
python src/mcp/github_mcp_server.py
```
- OSV FastMCP Server:
```bash
python src/mcp/osv_mcp_server.py
```
---
## Claude Desktop MCP Integration
Add the following to your `%APPDATA%\Claude\claude_desktop_config.json`:
```json
{
"mcpServers": {
"github-incident-mcp": {
"command": "python",
"args": [
"C:\\path\\to\\agentic_debugging_project_github\\src\\mcp\\github_mcp_server.py"
],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token_here",
"PYTHONUNBUFFERED": "1"
}
},
"osv-vulnerability-mcp": {
"command": "python",
"args": [
"C:\\path\\to\\agentic_debugging_project_github\\src\\mcp\\osv_mcp_server.py"
],
"env": {
"OSV_API_URL": "https://api.osv.dev/v1/query",
"PYTHONUNBUFFERED": "1"
}
}
}
}
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues