# 0xhackerfren/pcap-analysis-mcp architecture

> Architecture diagram of the GitHub repository 0xhackerfren/pcap-analysis-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xhackerfren/pcap-analysis-mcp
- Repository: https://github.com/0xhackerfren/pcap-analysis-mcp

## Overview

PCAP Analysis MCP is a network-forensics server and Python API that turns a packet capture into analysis results and reports. The principal workflow is to load a PCAP, inspect traffic and detect suspicious activity, reconstruct an attack timeline and extract IoCs, then generate reports. MCP clients can invoke the same tool set over stdio; a CLI path is also documented. The graph preserves the README’s major analysis branches. Most domain tools share core.py; unsampled method-level links are shown only where the README documents the capability, so some internal calls remain unverified.

Main entry points: [`src/pcap_analysis_mcp/core.py`](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py) (Core traffic analysis), [`src/pcap_analysis_mcp/__main__.py`](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/__main__.py) (CLI entry), [`src/pcap_analysis_mcp/protocol.py`](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/protocol.py) (JSON-RPC stdio), [`data`](https://github.com/0xhackerfren/pcap-analysis-mcp/tree/main/data) (Detection data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and protocol"]
  node_cli["CLI entry<br/>[__main__.py]"]
  node_mcp["MCP server<br/>[core.py]"]
  node_wire["JSON-RPC stdio<br/>[protocol.py]"]
end

subgraph group_traffic["Packet analysis"]
  node_capture["PCAP loading<br/>[core.py]"]
  node_coreanalysis["Core traffic analysis<br/>[core.py]"]
  node_protocols["Protocol analysis<br/>[core.py]"]
end

subgraph group_security["Threat investigation"]
  node_recon["Reconnaissance<br/>[core.py]"]
  node_web["HTTP and exploits<br/>[core.py]"]
  node_c2["C2 detection<br/>[core.py]"]
  node_timeline["Attack timeline<br/>[core.py]"]
  node_iocs["IoC extraction<br/>[core.py]"]
  node_enrichment["IoC enrichment<br/>[core.py]"]
  node_patterns["Detection data"]
end

subgraph group_output["Findings and reports"]
  node_reporting["Report generation<br/>[core.py]"]
  node_templates["HTML templates"]
end

node_client(("MCP client"))
node_analyst(("Analyst"))
node_threatservices["Threat intelligence services"]

node_client -->|"sends requests"| node_wire
node_wire -->|"dispatches requests"| node_mcp
node_analyst -->|"runs analysis"| node_cli
node_cli -->|"loads capture"| node_capture
node_cli -->|"requests summary"| node_coreanalysis
node_cli -->|"requests detection"| node_web
node_cli -->|"requests scan detection"| node_recon
node_cli -->|"generates report"| node_reporting
node_mcp -->|"exposes tools"| node_capture
node_capture -->|"provides packets"| node_coreanalysis
node_coreanalysis -->|"analyzes traffic"| node_protocols
node_coreanalysis -->|"supports detection"| node_recon
node_coreanalysis -->|"supports detection"| node_web
node_coreanalysis -->|"supports detection"| node_c2
node_coreanalysis -->|"supports reconstruction"| node_timeline
node_coreanalysis -->|"extracts indicators"| node_iocs
node_coreanalysis -->|"loads patterns"| node_patterns
node_iocs -->|"enriches indicators"| node_enrichment
node_enrichment -->|"queries reputation"| node_threatservices
node_timeline -->|"supplies events"| node_reporting
node_iocs -->|"supplies indicators"| node_reporting
node_web -->|"supplies findings"| node_reporting
node_reporting -->|"renders HTML"| node_templates

click node_cli "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/__main__.py"
click node_mcp "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_wire "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/protocol.py"
click node_capture "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_coreanalysis "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_protocols "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_recon "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_web "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_c2 "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_timeline "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_iocs "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_enrichment "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_patterns "https://github.com/0xhackerfren/pcap-analysis-mcp/tree/main/data"
click node_reporting "https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py"
click node_templates "https://github.com/0xhackerfren/pcap-analysis-mcp/tree/main/templates"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_mcp,node_wire,node_client toneBlue
class node_capture,node_coreanalysis,node_protocols toneAmber
class node_recon,node_web,node_c2,node_timeline,node_iocs,node_enrichment,node_patterns toneMint
class node_reporting,node_templates toneRose
class node_analyst,node_threatservices toneIndigo
```

## Components

### Entry and protocol

- [CLI entry](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/__main__.py): `src/pcap_analysis_mcp/__main__.py`
- [MCP server](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [JSON-RPC stdio](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/protocol.py): `src/pcap_analysis_mcp/protocol.py`

### Packet analysis

- [PCAP loading](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [Core traffic analysis](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [Protocol analysis](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`

### Threat investigation

- [Reconnaissance](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [HTTP and exploits](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [C2 detection](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [Attack timeline](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [IoC extraction](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [IoC enrichment](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [Detection data](https://github.com/0xhackerfren/pcap-analysis-mcp/tree/main/data): `data`

### Findings and reports

- [Report generation](https://github.com/0xhackerfren/pcap-analysis-mcp/blob/main/src/pcap_analysis_mcp/core.py): `src/pcap_analysis_mcp/core.py`
- [HTML templates](https://github.com/0xhackerfren/pcap-analysis-mcp/tree/main/templates): `templates`

### Other components

- **MCP client**
- **Analyst**
- **Threat intelligence services**

## Connections

- MCP client → JSON-RPC stdio: sends requests (evidence: `README.md`)
- JSON-RPC stdio → MCP server: dispatches requests (evidence: `src/pcap_analysis_mcp/core.py`)
- Analyst → CLI entry: runs analysis (evidence: `README.md`)
- CLI entry → PCAP loading: loads capture (evidence: `src/pcap_analysis_mcp/__main__.py`)
- CLI entry → Core traffic analysis: requests summary (evidence: `src/pcap_analysis_mcp/__main__.py`)
- CLI entry → HTTP and exploits: requests detection (evidence: `src/pcap_analysis_mcp/__main__.py`)
- CLI entry → Reconnaissance: requests scan detection (evidence: `src/pcap_analysis_mcp/__main__.py`)
- CLI entry → Report generation: generates report (evidence: `src/pcap_analysis_mcp/__main__.py`)
- MCP server → PCAP loading: exposes tools (evidence: `README.md`)
- PCAP loading → Core traffic analysis: provides packets (evidence: `README.md`)
- Core traffic analysis → Protocol analysis: analyzes traffic (evidence: `README.md`)
- Core traffic analysis → Reconnaissance: supports detection (evidence: `README.md`)
- Core traffic analysis → HTTP and exploits: supports detection (evidence: `README.md`)
- Core traffic analysis → C2 detection: supports detection (evidence: `README.md`)
- Core traffic analysis → Attack timeline: supports reconstruction (evidence: `README.md`)
- Core traffic analysis → IoC extraction: extracts indicators (evidence: `README.md`)
- Core traffic analysis → Detection data: loads patterns (evidence: `src/pcap_analysis_mcp/core.py`)
- IoC extraction → IoC enrichment: enriches indicators (evidence: `README.md`)
- IoC enrichment → Threat intelligence services: queries reputation (evidence: `README.md`)
- Attack timeline → Report generation: supplies events (evidence: `src/pcap_analysis_mcp/core.py`)
- IoC extraction → Report generation: supplies indicators (evidence: `src/pcap_analysis_mcp/core.py`)
- HTTP and exploits → Report generation: supplies findings (evidence: `src/pcap_analysis_mcp/core.py`)
- Report generation → HTML templates: renders HTML (evidence: `src/pcap_analysis_mcp/core.py`)
