Skip to main content
Glama
README.md
# rapid7-mcp ยท Gemini SOC AI Assistant

![Python](https://img.shields.io/badge/python-3.11%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![Streamlit](https://img.shields.io/badge/UI-Gemini%20Chat-purple)

An intelligent **NLP AI Chat Assistant** and unified MCP server for Rapid7 (**InsightIDR** and **InsightVM**). Designed with a modern **Google Gemini-style UI/UX**, it retains monthly security operations data and allows analysts, CISOs, and stakeholders to query any metric, incident, user risk, or SLA trend using natural language with **automatic interactive chart and graph generation**.

---

## โœจ Features

- **Google Gemini Chat UI/UX:** Clean, elegant dark aesthetic with Gemini sparkle branding, responsive prompt chips, metric KPI cards, and smooth markdown formatting.
- **Dynamic Charts & Graphs:** Every quantitative query dynamically renders interactive visualizations:
  - ๐Ÿ“Š **Horizontal Bar Charts:** Top risky users ranked by UBA risk score.
  - โฑ๏ธ **SLA Comparison Charts:** Achieved closure rates vs 90% SLA targets per priority level.
  - ๐Ÿ” **CVSS Distribution Breakdown:** Severity distribution across exploitable vulnerabilities.
  - ๐Ÿ“ˆ **Multi-Month Investigation Trajectory:** 4-month historical volume and priority trends.
  - ๐ŸŽฏ **Attack Trends:** Frequency rankings of top triggered detection rules.
- **Retained Monthly SOC Telemetry:** High-fidelity retention of monthly SOC reports (including October 2026 for NAPSA / StarLabs SOC):
  - **Top Risky Users:** Chikwa Luputa, Chusi Mwanza, Priscilla Samakesa, James Phiri, Yvonne Admin, etc.
  - **SLA & MTTR:** Target vs actual closure rates, Mean Time to Resolution (2h 50m 47s), and pending closures.
  - **Incident Attribution:** Phishing / malicious link clicks (Office 365), administrator impersonation, and impossible travel.
  - **Event Source Health:** Real-time health, connection timeouts, and prescribed fixes for Active Directory WMI, SQL Server, and Cisco syslog.
  - **Vulnerability Management:** Total exploitable count (476,361), CVSSv3 breakdown, and top CVEs.
- **Seamless Rapid7 Connection:**
  - 1-click toggle between **Retained Monthly Archive** (instant zero-credential exploration) and **Live Rapid7 Insight Platform API**.
  - Built-in connection tester verifying API keys and platform regions in seconds.
  - Dual reasoning mode: Built-in local semantic NLP (offline & instant) or external LLMs (Google Gemini API, OpenAI, DeepSeek).

---

## ๐Ÿš€ Quick Start

### 1. Launch the Gemini SOC Chat UI
```bash
streamlit run app.py
```
Open your browser at `http://localhost:8501`.

### 2. Example Natural Language Questions to Ask
- *"Who were the top 5 risked users last month?"*
- *"Did we meet our SLAs for High and Medium priority incidents in October?"*
- *"Show exploitable vulnerabilities by CVSS score"*
- *"Which event sources currently have issues?"*
- *"Compare investigations over the last 4 months"*
- *"Which users clicked on malicious Office 365 links?"*
- *"What were the top 10 detection rules triggered?"*

---

## ๐Ÿ›ก๏ธ Architecture

```text
User (SOC Analyst / Manager / CISO)
       โ”‚ Plain Natural Language Query
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Gemini SOC Chat Interface (app.py)             โ”‚
โ”‚  - Gemini Dark Surface & Sparkle Theme                 โ”‚
โ”‚  - Interactive Altair / Native Streamlit Charts        โ”‚
โ”‚  - Instant 1-Click Connection & Period Selector        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ–ผ                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Built-in SOC NLP Engine  โ”‚  โ”‚ LLM Agent (Gemini/OpenAI)โ”‚
โ”‚ (Offline, Zero-Config)   โ”‚  โ”‚ via Rapid7 MCP Tools     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚                           โ”‚
             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚             Rapid7 MCP Telemetry & Storage             โ”‚
โ”‚  โ€ข Retained Monthly Data Store (October 2026 NAPSA)   โ”‚
โ”‚  โ€ข Live Rapid7 InsightIDR REST APIs                    โ”‚
โ”‚  โ€ข Live Rapid7 InsightVM REST APIs                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

---

## โš™๏ธ Configuration & Connection

Configure via the Streamlit sidebar or `.env`:

```env
# Rapid7 Live API (Optional โ€” Retained mode works out-of-the-box)
IDR_REGION=us
IDR_API_KEY=your_insight_platform_api_key

# LLM API (Optional โ€” Built-in engine works offline)
GEMINI_API_KEY=your_gemini_api_key
# or
OPENAI_API_KEY=your_openai_api_key
```

---

## ๐Ÿ“„ License
MIT License.