# heisenbergg4/mcploit architecture

> Architecture diagram of the GitHub repository heisenbergg4/mcploit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/heisenbergg4/mcploit
- Repository: https://github.com/heisenbergg4/mcploit

## Overview

#### Purpose and CLI Entry Point
MCPloit is a Python security assessment tool for Model Context Protocol (MCP) servers. It supports live-server enumeration, passive and active scanning, exploit execution, and source-code auditing. The command dispatcher is `mcploit.py`, which coordinates target connection and modes such as `connect`, `enum`, `scan`, `audit`, `exploit`, and `full-scan`.

Paths: `mcploit.py`, `core/mcp_client.py`, `utils/output.py`

#### MCP Transport and Interactive Access
`MCPClient` is the boundary to MCP targets, handling auto-detected STDIO, SSE, and HTTP transports. It exposes MCP operations used throughout the product: discover tools/resources/prompts, call tools, read resources, and render prompts. Interactive mode wraps that client in a command shell for manual reconnaissance and custom calls.

Paths: `core/mcp_client.py`, `core/interactive.py`, `core/enumerator.py`

#### Capability Enumeration
The enumerator retrieves a target’s exposed MCP surface and normalizes it for CLI output and downstream security analysis. This is the primary reconnaissance stage and feeds tool names, schemas, resources, and prompts into scanner and exploitation workflows.

Paths: `core/enumerator.py`, `analysis/metadata_extractor.py`, `analysis/report.py`

#### Black-Box Analysis Pipeline
Live-target analysis is coordinated by `analysis/engine.py`. Passive scanning uses vulnerability-specific detector modules against enumerated capability metadata; optional active probing sends controlled payloads to validate suspected findings. Schema analysis and network-oriented inspection extend live assessment beyond static tool descriptions.

Paths: `analysis/engine.py`, `modules/scanner.py`, `analysis/blackbox/active_prober.py`, `analysis/blackbox/schema_analyzer.py`

#### Detector Architecture
Each vulnerability family is modeled as a detector behind a shared base abstraction. The scanner selects detectors for categories including prompt injection, code execution, path traversal, secret exposure, token theft, tool poisoning, and typosquatting. Findings are represented centrally for aggregation and reporting.

Paths: `modules/detectors/base_detector.py`, `modules/detectors/prompt_injection.py`, `modules/detectors/code_execution.py`, `analysis/finding.py`

#### White-Box Source Audit
Source auditing combines regex/SAST scanning, AST-driven MCP entry-point and data-flow inspection, and optional AI-assisted triage. AST analysis identifies likely tool functions and risky behavior; the AI reviewer sends selected code/findings to Anthropic when explicitly enabled, making the Anthropic API an external data boundary.

Paths: `analysis/whitebox/sast_scanner.py`, `analysis/whitebox/entry_point_detector.py`, `analysis/whitebox/desc_vs_behavior.py`, `analysis/whitebox/ai_reviewer.py`

#### Exploit and Payload Execution
The exploit engine orchestrates module-targeted attacks, selecting payloads from a categorized library and executing them through the MCP client. Base exploit and payload abstractions separate execution mechanics from payload definitions. Safety controls are enforced at the CLI/workflow level for active probing, CVE execution, and unsafe payload sets.

Paths: `exploits/engine.py`, `exploits/base_exploit.py`, `payloads/manager.py`, `payloads/base.py`

#### Reporting and Integrations
Assessment stages produce structured findings and reports, with JSON and Markdown-oriented output implied by CLI workflows. Burp integration provides an external proxy boundary for intercepting or observing traffic. Runtime dependencies are Python packages declared in `requirements.txt`; targets may be local Python/Node processes or remote HTTP/SSE MCP services.

Paths: `analysis/report.py`, `integrations/burp_proxy.py`, `utils/logger.py`, `requirements.txt`

Main entry points: [`analysis/engine.py`](https://github.com/heisenbergg4/mcploit/blob/main/analysis/engine.py) (Analysis engine), [`core/mcp_client.py`](https://github.com/heisenbergg4/mcploit/blob/main/core/mcp_client.py) (MCP client), [`mcploit.py`](https://github.com/heisenbergg4/mcploit/blob/main/mcploit.py) (MCPloit dispatcher), [`core/enumerator.py`](https://github.com/heisenbergg4/mcploit/blob/main/core/enumerator.py) (Capability enumerator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI &amp; Access"]
  node_dispatcher["MCPloit dispatcher<br/>Python CLI<br/>[mcploit.py]"]
  node_client{{"MCP client<br/>transport boundary<br/>[mcp_client.py]"}}
  node_interactive["Interactive shell<br/>manual access<br/>[interactive.py]"]
end

subgraph group_recon["Reconnaissance"]
  node_enumerator["Capability enumerator<br/>recon stage<br/>[enumerator.py]"]
  node_metadata["Metadata extractor<br/>normalizer"]
end

subgraph group_analysis["Security Analysis"]
  node_engine["Analysis engine<br/>workflow coordinator<br/>[engine.py]"]
  node_scanner["Vulnerability scanner<br/>detector runner<br/>[scanner.py]"]
  node_detectors["Detector families<br/>shared detector abstraction<br/>[base_detector.py]"]
  node_active_prober["Active prober<br/>controlled validation<br/>[active_prober.py]"]
  node_schema_analyzer["Schema analyzer<br/>black-box inspection<br/>[schema_analyzer.py]"]
  node_sast["SAST scanner<br/>source audit<br/>[sast_scanner.py]"]
  node_entry_points["AST entry-point analysis<br/>source audit"]
  node_ai_reviewer["AI reviewer<br/>optional triage<br/>[ai_reviewer.py]"]
end

subgraph group_exploit["Exploitation"]
  node_exploit_engine["Exploit engine<br/>attack orchestrator<br/>[engine.py]"]
  node_payload_manager["Payload manager<br/>payload library<br/>[manager.py]"]
end

subgraph group_output["Reporting &amp; Integrations"]
  node_findings["Findings<br/>security model<br/>[finding.py]"]
  node_report["Reports<br/>structured output<br/>[report.py]"]
  node_burp{{"Burp proxy<br/>external proxy integration<br/>[burp_proxy.py]"}}
end

node_target{{"MCP target<br/>external server"}}
node_anthropic{{"Anthropic API<br/>external API"}}

node_dispatcher -->|"connects"| node_client
node_dispatcher -->|"starts"| node_interactive
node_dispatcher -->|"runs enum"| node_enumerator
node_dispatcher -->|"runs scan/audit"| node_engine
node_dispatcher -->|"runs exploit"| node_exploit_engine
node_client -->|"MCP transport"| node_target
node_interactive -->|"manual MCP calls"| node_client
node_enumerator -->|"discovers capabilities"| node_client
node_enumerator -->|"normalizes"| node_metadata
node_metadata -->|"capability metadata"| node_engine
node_engine -->|"passive scan"| node_scanner
node_scanner -->|"selects and runs"| node_detectors
node_engine -.->|"optional validation"| node_active_prober
node_engine -->|"inspects schemas"| node_schema_analyzer
node_active_prober -->|"controlled payloads"| node_client
node_engine -->|"source audit"| node_sast
node_engine -->|"AST audit"| node_entry_points
node_engine -.->|"optional triage"| node_ai_reviewer
node_ai_reviewer -.->|"selected code/findings"| node_anthropic
node_scanner -->|"findings"| node_findings
node_engine -->|"aggregates"| node_findings
node_findings -->|"renders"| node_report
node_exploit_engine -->|"selects payloads"| node_payload_manager
node_exploit_engine -->|"executes via"| node_client
node_client -.->|"proxy traffic"| node_burp

click node_dispatcher "https://github.com/heisenbergg4/mcploit/blob/main/mcploit.py"
click node_client "https://github.com/heisenbergg4/mcploit/blob/main/core/mcp_client.py"
click node_interactive "https://github.com/heisenbergg4/mcploit/blob/main/core/interactive.py"
click node_enumerator "https://github.com/heisenbergg4/mcploit/blob/main/core/enumerator.py"
click node_metadata "https://github.com/heisenbergg4/mcploit/blob/main/analysis/metadata_extractor.py"
click node_engine "https://github.com/heisenbergg4/mcploit/blob/main/analysis/engine.py"
click node_scanner "https://github.com/heisenbergg4/mcploit/blob/main/modules/scanner.py"
click node_detectors "https://github.com/heisenbergg4/mcploit/blob/main/modules/detectors/base_detector.py"
click node_active_prober "https://github.com/heisenbergg4/mcploit/blob/main/analysis/blackbox/active_prober.py"
click node_schema_analyzer "https://github.com/heisenbergg4/mcploit/blob/main/analysis/blackbox/schema_analyzer.py"
click node_sast "https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/sast_scanner.py"
click node_entry_points "https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/entry_point_detector.py"
click node_ai_reviewer "https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/ai_reviewer.py"
click node_findings "https://github.com/heisenbergg4/mcploit/blob/main/analysis/finding.py"
click node_report "https://github.com/heisenbergg4/mcploit/blob/main/analysis/report.py"
click node_exploit_engine "https://github.com/heisenbergg4/mcploit/blob/main/exploits/engine.py"
click node_payload_manager "https://github.com/heisenbergg4/mcploit/blob/main/payloads/manager.py"
click node_burp "https://github.com/heisenbergg4/mcploit/blob/main/integrations/burp_proxy.py"

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_dispatcher,node_client,node_interactive toneBlue
class node_enumerator,node_metadata toneAmber
class node_engine,node_scanner,node_detectors,node_active_prober,node_schema_analyzer,node_sast,node_entry_points,node_ai_reviewer toneMint
class node_exploit_engine,node_payload_manager toneRose
class node_findings,node_report,node_burp toneIndigo
class node_target,node_anthropic toneNeutral
```

## Components

### CLI & Access

- [MCPloit dispatcher](https://github.com/heisenbergg4/mcploit/blob/main/mcploit.py): Python CLI · Coordinates connect, enum, scan, audit, exploit, and full-scan modes. · `mcploit.py`
- [MCP client](https://github.com/heisenbergg4/mcploit/blob/main/core/mcp_client.py): transport boundary · Auto-detects STDIO, SSE, and HTTP MCP transports. · `core/mcp_client.py`
- [Interactive shell](https://github.com/heisenbergg4/mcploit/blob/main/core/interactive.py): manual access · `core/interactive.py`

### Reconnaissance

- [Capability enumerator](https://github.com/heisenbergg4/mcploit/blob/main/core/enumerator.py): recon stage · Retrieves tools, resources, prompts, and schemas. · `core/enumerator.py`
- [Metadata extractor](https://github.com/heisenbergg4/mcploit/blob/main/analysis/metadata_extractor.py): normalizer · `analysis/metadata_extractor.py`

### Security Analysis

- [Analysis engine](https://github.com/heisenbergg4/mcploit/blob/main/analysis/engine.py): workflow coordinator · Coordinates passive and optional active live-target assessment. · `analysis/engine.py`
- [Vulnerability scanner](https://github.com/heisenbergg4/mcploit/blob/main/modules/scanner.py): detector runner · `modules/scanner.py`
- [Detector families](https://github.com/heisenbergg4/mcploit/blob/main/modules/detectors/base_detector.py): shared detector abstraction · Covers injection, execution, traversal, secrets, tokens, poisoning, and typosquatting. · `modules/detectors/base_detector.py`
- [Active prober](https://github.com/heisenbergg4/mcploit/blob/main/analysis/blackbox/active_prober.py): controlled validation · `analysis/blackbox/active_prober.py`
- [Schema analyzer](https://github.com/heisenbergg4/mcploit/blob/main/analysis/blackbox/schema_analyzer.py): black-box inspection · `analysis/blackbox/schema_analyzer.py`
- [SAST scanner](https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/sast_scanner.py): source audit · Performs regex and static source scanning. · `analysis/whitebox/sast_scanner.py`
- [AST entry-point analysis](https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/entry_point_detector.py): source audit · Finds MCP tools and risky data flows. · `analysis/whitebox/entry_point_detector.py`
- [AI reviewer](https://github.com/heisenbergg4/mcploit/blob/main/analysis/whitebox/ai_reviewer.py): optional triage · Sends selected code and findings only when enabled. · `analysis/whitebox/ai_reviewer.py`

### Exploitation

- [Exploit engine](https://github.com/heisenbergg4/mcploit/blob/main/exploits/engine.py): attack orchestrator · Runs module-targeted attacks through the MCP client. · `exploits/engine.py`
- [Payload manager](https://github.com/heisenbergg4/mcploit/blob/main/payloads/manager.py): payload library · Selects categorized payloads for exploit execution. · `payloads/manager.py`

### Reporting & Integrations

- [Findings](https://github.com/heisenbergg4/mcploit/blob/main/analysis/finding.py): security model · Central aggregation of assessment results. · `analysis/finding.py`
- [Reports](https://github.com/heisenbergg4/mcploit/blob/main/analysis/report.py): structured output · Produces assessment reports for CLI workflows. · `analysis/report.py`
- [Burp proxy](https://github.com/heisenbergg4/mcploit/blob/main/integrations/burp_proxy.py): external proxy integration · Intercepts or observes MCP traffic. · `integrations/burp_proxy.py`

### Other components

- **MCP target**: external server · Local process or remote HTTP/SSE MCP service.
- **Anthropic API**: external API · External code and finding data boundary.

## Connections

- MCPloit dispatcher → MCP client: connects
- MCPloit dispatcher → Interactive shell: starts
- MCPloit dispatcher → Capability enumerator: runs enum
- MCPloit dispatcher → Analysis engine: runs scan/audit
- MCPloit dispatcher → Exploit engine: runs exploit
- MCP client → MCP target: MCP transport
- Interactive shell → MCP client: manual MCP calls
- Capability enumerator → MCP client: discovers capabilities
- Capability enumerator → Metadata extractor: normalizes
- Metadata extractor → Analysis engine: capability metadata
- Analysis engine → Vulnerability scanner: passive scan
- Vulnerability scanner → Detector families: selects and runs
- Analysis engine → Active prober: optional validation
- Analysis engine → Schema analyzer: inspects schemas
- Active prober → MCP client: controlled payloads
- Analysis engine → SAST scanner: source audit
- Analysis engine → AST entry-point analysis: AST audit
- Analysis engine → AI reviewer: optional triage
- AI reviewer → Anthropic API: selected code/findings
- Vulnerability scanner → Findings: findings
- Analysis engine → Findings: aggregates
- Findings → Reports: renders
- Exploit engine → Payload manager: selects payloads
- Exploit engine → MCP client: executes via
- MCP client → Burp proxy: proxy traffic
