AI Incident Monitoring RCA MCP Server
Provides telemetry tools for retrieving recent logs and system metrics to support root-cause analysis of infrastructure incidents. Enables autonomous incident triage with grounded verification and human-in-the-loop remediation.
README
🤖 Enterprise AI System Monitoring & Autonomous RCA Agent
An autonomous, production-inspired Level-1 SRE Incident Triage Agent built with LangGraph, FastMCP, and FastAPI. It intercepts infrastructure alerts via authenticated webhooks, dynamically queries application stack traces and time-series metrics via FastMCP tools, performs grounded root-cause analysis, and provides human-in-the-loop remediation guardrails.
Key Metric: Cuts manual incident triage time from 40 minutes to under 3 seconds (~99.5% MTTR reduction) while eliminating hallucinations using a deterministic Grounding Verification Guardrail.
🏗️ System Architecture
[ External Alerting / Prometheus ] │ (Authenticated HTTP POST / X-API-Key) ▼ ┌───────────────────────┐ │ FastAPI Webhook API │ └───────────┬───────────┘ │ (Idempotency Check via SQLite) ▼ ┌───────────────────────────┐ │ LangGraph State Machine │ ├───────────────────────────┤ │ 1. Ingest Incident │ │ 2. Fetch Telemetry ───────┼───► [ FastMCP Server Tools ] │ 3. Analyze Root Cause ────┼───► [ Resilient LLM Router (Groq / OpenRouter) ] │ 4. Verify Grounding │ └─────────────┬─────────────┘ │ ▼ ┌───────────────────────────┐ ┌──────────────────────────────────┐ │ Streamlit Operator UI │ ───► │ Human-in-the-Loop Safeguard │ └───────────────────────────┘ │ (Approve / Reject Remediation) │ └──────────────────────────────────┘
⭐ Core Enterprise Features
-
Multi-Incident Failure Simulation: Built-in telemetry engine generating realistic multi-variate metrics for Database Pool Exhaustion, Heap Memory Leaks (OOM), and Upstream API Latency Cascades.
-
Deterministic LangGraph Orchestration: Async state-machine workflow executing sequential DAG steps (
ingest→fetch→analyze→verify). -
Decoupled FastMCP Tool Architecture: Isolated Model Context Protocol server exposing
get_recent_logs()andget_system_metrics()without polluting core agent logic. -
Zero-Hallucination Grounding Safeguard: Programmatic verification node cross-referencing LLM claims against raw stack trace evidence before marking diagnostics as valid.
-
Resilient Multi-Provider LLM Router: 15-second timeout limits with exponential backoff retries and automatic failover from primary (Groq Llama 3.1 8B) to secondary (OpenRouter).
-
Webhook Authentication & Idempotency Store: Secured with
X-API-Keyheaders and SQLite-backed deduplication (DUPLICATE_CACHED) to prevent duplicate LLM calls on repeated alerts. -
FinOps Token & Cost Observability: Real-time token usage, execution latency, and dollar cost tracking per incident logged via
structlogand SQLite. -
Automated Pytest Regression Suite: Mocked async test suite running regression checks in < 1s without spending paid API credits.
📊 Evaluation & Benchmark Performance
Evaluated against evaluation/eval_dataset.json across realistic incident scenarios:
| Metric | Benchmark Result |
|---|---|
| Total Test Scenarios | 3 / 3 Passed |
| Root Cause Accuracy Score | 100.0% |
| Grounding Guardrail Pass Rate | 100.0% (0% Hallucination Rate) |
| Average AI Execution Speed | ~2.8 seconds |
| MTTR Reduction Efficiency | 99.5% Faster than Manual Triage |
🚀 Quickstart & Setup
Prerequisites
- Python 3.11+
- Docker & Docker Compose (Optional for containerization)
- Free Groq API Key
Local Installation
# 1. Clone Repository
git clone [https://github.com/lokeshkundi15/ai-incident-monitoring-rca-agent.git](https://github.com/lokeshkundi15/ai-incident-monitoring-rca-agent.git)
cd ai-incident-monitoring-rca-agent
Linkedin Profile : https://www.linkedin.com/in/lokesh-kundi-3a08b9318/
# 2. Create Virtual Environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install Dependencies
pip install -r requirements.txt
# 4. Environment Variables Setup
cp .env.example .env
# Edit .env and paste your GROQ_API_KEY and WEBHOOK_API_KEY
Running the Services:
# Start FastAPI Webhook Server
python app/main_api.py
# In a new terminal, launch the Streamlit Operations Dashboard
streamlit run ui/dashboard.py
# Execute Evaluation Suite
python evaluation/evaluate.py
# Run Automated Test Suite
pytest -v
Running via Docker:
docker-compose up --build
🛠️ Project Structure:
ai-incident-monitoring-rca-agent/
├── app/
│ ├── logger.py # Structlog JSON Audit Logger
│ ├── llm_router.py # Resilient Fallback LLM Router
│ ├── main_api.py # Authenticated FastAPI Webhook
│ ├── idempotency.py # SQLite Deduplication Store
│ └── cost_tracker.py # FinOps Token & Cost Observability
├── agents/
│ ├── state.py # IncidentState Schema
│ ├── nodes.py # Async Graph Nodes
│ └── graph.py # LangGraph Workflow Orchestrator
├── mcp_server/
│ └── tools.py # FastMCP Telemetry Tools
├── data/
│ ├── generator.py # Multi-Scenario Incident Simulator
│ └── simulated/ # SQLite Metrics & Log Files
├── evaluation/
│ ├── eval_dataset.json # Benchmark Scenarios
│ └── evaluate.py # Quantitative Evaluation Runner
├── tests/
│ └── test_suite.py # Pytest Async Regression Suite
├── ui/
│ └── dashboard.py # Streamlit Operator UI
├── Dockerfile
├── docker-compose.yml
└── requirements.txt
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。