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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.