# sc4rfurry/redquanta-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/sc4rfurry/redquanta-mcp
- Repository: https://github.com/sc4rfurry/redquanta-mcp

## Overview

1. **What this repo is**
   - RedQuanta MCP Server is a **TypeScript/Node.js security orchestration service** that exposes penetration-testing capabilities through both the **MCP protocol** and a **REST API**.
   - The architecture centers on a server that accepts tool/workflow requests, validates them through a security layer, then dispatches them to tool wrappers or plugins.

2. **Primary entry points**
   - `src/server.ts` is the runtime server entry for networked/API use.
   - `src/cli.ts` is the command-line entry point for local operator use and likely the easiest way to start or inspect the system.
   - The repo also includes platform launch scripts (`start-server.ps1`, `start-windows.bat`, `start-production.ps1`) and a `Dockerfile`/`docker-compose.yml` for containerized deployment.

3. **Protocol and request routing**
   - `src/core/mcpRouter.ts` is the central routing boundary for MCP tool calls and likely maps protocol requests to tool/workflow handlers.
   - The README and docs indicate the server also serves REST endpoints such as `/health`, `/tools`, `/help/{tool}`, and `/workflow/enum`, so the architecture supports both **LLM client integration** and **direct HTTP access**.

4. **Execution orchestration**
   - `src/core/workflowEngine.ts` coordinates multi-step security workflows such as enumeration, scanning, and reporting.
   - This layer is the main place where higher-level actions are assembled from lower-level tools, and where progress, caching, and result aggregation are likely coordinated.

5. **Tool subsystem**
   - `src/tools/` contains the built-in security tool wrappers: `nmap`, `masscan`, `nikto`, `ffuf`, `hydra`, `ddgSearch`, and the shared `base.ts`.
   - These wrappers are the execution adapters that translate a normalized request schema into actual external tool execution, parameter handling, and structured output.

6. **External command execution boundary**
   - `src/utils/commandRunner.ts` is the key boundary for invoking external binaries.
   - `src/utils/dockerRunner.ts` provides container fallback/execution for tools that are unavailable locally or require sandboxed execution.
   - The architecture depends on external security tools installed on the host or available through Docker, rather than reimplementing scanning logic in-process.

7. **Security enforcement layer**
   - The repo makes security a first-class architectural layer: `src/utils/argGuard.ts`, `src/utils/pathGuard.ts`, `src/utils/filesystem.ts`, and `src/utils/osConfig.ts` enforce command sanitization, jailed filesystem access, and OS-specific constraints.
   - `config/allowedCommands*.json`, `config/allowedPaths*.json`, and `config/deniedPatterns.json` define allow/deny policy inputs, making policy data-driven rather than hardcoded.

8. **Observability and safety controls**
   - `src/utils/auditLogger.ts` records JSONL-style audit events for tool execution and security-relevant actions.
   - `src/utils/progressTracker.ts` provides execution-phase and progress reporting for long-running operations.
   - `src/utils/telemetry.ts` and `src/utils/sarifReporter.ts` support operational metrics and security-report output, with SARIF used for CI/CD-friendly results.

9. **Caching and state**
   - `src/utils/cacheManager.ts` is a performance layer for repeat scans and workflow results.
   - The cache is a local optimization boundary inside the server; it reduces repeated tool invocations but does not appear to be the source of truth for execution results.

10. **Help, documentation, and schema generation**
   - `src/core/helpSystem.ts` exposes contextual tool help used by the LLM/MCP experience and the REST help endpoints.
   - `scripts/generate-openapi.ts` and the checked-in `docs/api/openapi.json` indicate the API surface is documented and generated as part of the build/docs pipeline.
   - `docs/`, `mkdocs.yml`, and `scripts/build-docs.ts` show that documentation is treated as a product artifact, not just a README.

11. **Plugin architecture**
   - `src/core/pluginSystem.ts` loads custom tools from `plugins/`, with `plugins/example-custom-tool.js` demonstrating the extension model.
   - The plugin boundary is separate from built-in tools, allowing new capability injection without modifying core workflows, while still subject to the same safety and routing model.

12. **Deployment shape**
   - The repository supports local, Windows, Docker, and production deployments, with dedicated deployment docs and scripts under `deployment/`, `docs/deployment/`, and top-level `*.ps1`/`*.bat` files.
   - `docker-security-tools.yml` suggests a split between the application container and auxiliary tool containers for secure or fallback execution.

13. **Testing and quality boundaries**
   - `tests/` covers both core security guards and tool behavior, including `tests/utils/argGuard.test.ts`, `tests/utils/pathGuard.test.ts`, and `tests/tools/nmap.test.ts`.
   - This indicates the main test boundaries are around **security policy enforcement** and **tool adapter correctness**, which are the highest-risk parts of the system.

14. **How data flows through the system**
   - A client request enters via MCP or REST, is routed by the core layer, validated by the security guards, optionally enriched by workflow/help/plugin logic, then executed through a tool wrapper and command runner.
   - Results flow back through progress/audit/reporting layers, and may be cached or emitted as structured formats like JSON, SARIF, or API responses.

Main entry points: [`src/core/workflowEngine.ts`](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/workflowEngine.ts) (Workflow engine), [`src/core/mcpRouter.ts`](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/mcpRouter.ts) (MCP router), [`src/server.ts`](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/server.ts) (Server), [`src/tools/base.ts`](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/base.ts) (Tool base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_runtime["Runtime & entrypoints"]
  node_node_cli["CLI<br/>entrypoint<br/>[cli.ts]"]
  node_node_server["Server<br/>entrypoint<br/>[server.ts]"]
end

subgraph group_grp_core["Core orchestration"]
  node_node_mcp_router{{"MCP router<br/>[mcpRouter.ts]"}}
  node_node_workflow_engine{{"Workflow engine<br/>orchestrator<br/>[workflowEngine.ts]"}}
  node_node_help_system["Help system<br/>docs API<br/>[helpSystem.ts]"]
  node_node_plugin_system{{"Plugins<br/>extensibility<br/>[pluginSystem.ts]"}}
  node_node_plugins_example["Example plugin<br/>plugin sample"]
end

subgraph group_grp_tools["Tool adapters"]
  node_node_tool_base["Tool base<br/>adapter base<br/>[base.ts]"]
  node_node_nmap["nmap<br/>tool adapter<br/>[nmap.ts]"]
  node_node_masscan["masscan<br/>tool adapter<br/>[masscan.ts]"]
  node_node_nikto["nikto<br/>tool adapter<br/>[nikto.ts]"]
  node_node_ffuf["ffuf<br/>tool adapter<br/>[ffuf.ts]"]
  node_node_hydra["hydra<br/>tool adapter<br/>[hydra.ts]"]
  node_node_ddg["ddgSearch<br/>tool adapter<br/>[ddgSearch.ts]"]
end

subgraph group_grp_safety["Safety & execution"]
  node_node_arg_guard{{"Arg guard<br/>security filter<br/>[argGuard.ts]"}}
  node_node_path_guard{{"Path guard<br/>security filter<br/>[pathGuard.ts]"}}
  node_node_command_runner["Command runner<br/>execution boundary<br/>[commandRunner.ts]"]
  node_node_docker_runner["Docker runner<br/>fallback executor<br/>[dockerRunner.ts]"]
  node_node_audit_logger["Audit log<br/>observability<br/>[auditLogger.ts]"]
  node_node_progress["Progress<br/>observability<br/>[progressTracker.ts]"]
  node_node_cache[("Cache<br/>state<br/>[cacheManager.ts]")]
  node_node_sarif["SARIF<br/>reporting<br/>[sarifReporter.ts]"]
end

subgraph group_grp_ops["Docs & deployment"]
  node_node_api_docs["API docs<br/>generated docs<br/>[openapi.json]"]
  node_node_build_docs["Docs build<br/>docs pipeline<br/>[build-docs.ts]"]
  node_node_generate_openapi["OpenAPI gen<br/>docs pipeline"]
end

node_node_cli -->|"requests"| node_node_mcp_router
node_node_server -->|"routes"| node_node_mcp_router
node_node_mcp_router -->|"orchestrates"| node_node_workflow_engine
node_node_mcp_router -->|"help"| node_node_help_system
node_node_mcp_router -->|"loads"| node_node_plugin_system
node_node_workflow_engine -->|"uses"| node_node_tool_base
node_node_workflow_engine -->|"caches"| node_node_cache
node_node_workflow_engine -->|"reports"| node_node_progress
node_node_workflow_engine -->|"audits"| node_node_audit_logger
node_node_tool_base -->|"validates"| node_node_arg_guard
node_node_tool_base -->|"constrains"| node_node_path_guard
node_node_tool_base -->|"executes"| node_node_command_runner
node_node_command_runner -->|"fallback"| node_node_docker_runner
node_node_command_runner -->|"logs"| node_node_audit_logger
node_node_command_runner -->|"reports"| node_node_sarif
node_node_plugin_system -->|"example"| node_node_plugins_example
node_node_workflow_engine -->|"invokes"| node_node_nmap
node_node_workflow_engine -->|"invokes"| node_node_masscan
node_node_workflow_engine -->|"invokes"| node_node_nikto
node_node_workflow_engine -->|"invokes"| node_node_ffuf
node_node_workflow_engine -->|"invokes"| node_node_hydra
node_node_workflow_engine -->|"invokes"| node_node_ddg
node_node_generate_openapi -->|"generates"| node_node_api_docs
node_node_build_docs -->|"includes"| node_node_api_docs
node_node_server -->|"observes"| node_node_audit_logger
node_node_server -->|"streams"| node_node_progress
node_node_server -->|"exports"| node_node_sarif

click node_node_cli "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/cli.ts"
click node_node_server "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/server.ts"
click node_node_mcp_router "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/mcpRouter.ts"
click node_node_workflow_engine "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/workflowEngine.ts"
click node_node_help_system "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/helpSystem.ts"
click node_node_plugin_system "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/pluginSystem.ts"
click node_node_tool_base "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/base.ts"
click node_node_nmap "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/nmap.ts"
click node_node_masscan "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/masscan.ts"
click node_node_nikto "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/nikto.ts"
click node_node_ffuf "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/ffuf.ts"
click node_node_hydra "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/hydra.ts"
click node_node_ddg "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/ddgSearch.ts"
click node_node_arg_guard "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/argGuard.ts"
click node_node_path_guard "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/pathGuard.ts"
click node_node_command_runner "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/commandRunner.ts"
click node_node_docker_runner "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/dockerRunner.ts"
click node_node_audit_logger "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/auditLogger.ts"
click node_node_progress "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/progressTracker.ts"
click node_node_cache "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/cacheManager.ts"
click node_node_sarif "https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/sarifReporter.ts"
click node_node_api_docs "https://github.com/sc4rfurry/redquanta-mcp/blob/main/docs/api/openapi.json"
click node_node_build_docs "https://github.com/sc4rfurry/redquanta-mcp/blob/main/scripts/build-docs.ts"
click node_node_generate_openapi "https://github.com/sc4rfurry/redquanta-mcp/blob/main/scripts/generate-openapi.ts"
click node_node_plugins_example "https://github.com/sc4rfurry/redquanta-mcp/blob/main/plugins/example-custom-tool.js"

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_node_cli,node_node_server toneBlue
class node_node_mcp_router,node_node_workflow_engine,node_node_help_system,node_node_plugin_system,node_node_plugins_example toneAmber
class node_node_tool_base,node_node_nmap,node_node_masscan,node_node_nikto,node_node_ffuf,node_node_hydra,node_node_ddg toneMint
class node_node_arg_guard,node_node_path_guard,node_node_command_runner,node_node_docker_runner,node_node_audit_logger,node_node_progress,node_node_cache,node_node_sarif toneRose
class node_node_api_docs,node_node_build_docs,node_node_generate_openapi toneIndigo
```

## Components

### Runtime & entrypoints

Process entrypoints and deployment launch paths

- [CLI](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/cli.ts): entrypoint · Local operator entrypoint · `src/cli.ts`
- [Server](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/server.ts): entrypoint · Networked MCP/REST server entrypoint · `src/server.ts`

### Core orchestration

Protocol routing, workflows, help, and plugins

- [MCP router](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/mcpRouter.ts): router · Routes protocol tool requests to handlers · `src/core/mcpRouter.ts`
- [Workflow engine](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/workflowEngine.ts): orchestrator · Coordinates multi-step security workflows · `src/core/workflowEngine.ts`
- [Help system](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/helpSystem.ts): docs API · Tool help and endpoint guidance · `src/core/helpSystem.ts`
- [Plugins](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/core/pluginSystem.ts): extensibility · Loads custom tools from plugins · `src/core/pluginSystem.ts`
- [Example plugin](https://github.com/sc4rfurry/redquanta-mcp/blob/main/plugins/example-custom-tool.js): plugin sample · Custom tool plugin example · `plugins/example-custom-tool.js`

### Tool adapters

Built-in security tool wrappers

- [Tool base](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/base.ts): adapter base · Shared tool wrapper interface · `src/tools/base.ts`
- [nmap](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/nmap.ts): tool adapter · Port scanning wrapper · `src/tools/nmap.ts`
- [masscan](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/masscan.ts): tool adapter · High-speed scan wrapper · `src/tools/masscan.ts`
- [nikto](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/nikto.ts): tool adapter · Web scanner wrapper · `src/tools/nikto.ts`
- [ffuf](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/ffuf.ts): tool adapter · Content discovery wrapper · `src/tools/ffuf.ts`
- [hydra](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/hydra.ts): tool adapter · Brute-force wrapper · `src/tools/hydra.ts`
- [ddgSearch](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/tools/ddgSearch.ts): tool adapter · Search-assisted recon wrapper · `src/tools/ddgSearch.ts`

### Safety & execution

Command validation, sandboxing, and observability

- [Arg guard](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/argGuard.ts): security filter · Command argument validation · `src/utils/argGuard.ts`
- [Path guard](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/pathGuard.ts): security filter · Filesystem jail and path policy · `src/utils/pathGuard.ts`
- [Command runner](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/commandRunner.ts): execution boundary · Invokes external binaries · `src/utils/commandRunner.ts`
- [Docker runner](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/dockerRunner.ts): fallback executor · Container-based tool execution · `src/utils/dockerRunner.ts`
- [Audit log](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/auditLogger.ts): observability · JSONL security and execution logging · `src/utils/auditLogger.ts`
- [Progress](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/progressTracker.ts): observability · Long-running operation status tracking · `src/utils/progressTracker.ts`
- [Cache](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/cacheManager.ts): state · Local result and scan cache · `src/utils/cacheManager.ts`
- [SARIF](https://github.com/sc4rfurry/redquanta-mcp/blob/main/src/utils/sarifReporter.ts): reporting · Structured security report output · `src/utils/sarifReporter.ts`

### Docs & deployment

Documentation generation and deployment assets

- [API docs](https://github.com/sc4rfurry/redquanta-mcp/blob/main/docs/api/openapi.json): generated docs · Generated OpenAPI specification · `docs/api/openapi.json`
- [Docs build](https://github.com/sc4rfurry/redquanta-mcp/blob/main/scripts/build-docs.ts): docs pipeline · Documentation build and generation scripts · `scripts/build-docs.ts`
- [OpenAPI gen](https://github.com/sc4rfurry/redquanta-mcp/blob/main/scripts/generate-openapi.ts): docs pipeline · OpenAPI generation script · `scripts/generate-openapi.ts`

## Connections

- CLI → MCP router: requests · CLI drives the core request boundary
- Server → MCP router: routes · Server forwards MCP and REST actions into routing
- MCP router → Workflow engine: orchestrates · Router delegates multi-step operations
- MCP router → Help system: help · Router serves contextual help responses
- MCP router → Plugins: loads · Router includes plugin-provided tools
- Workflow engine → Tool base: uses · Workflows assemble tool adapters through the shared base
- Workflow engine → Cache: caches · Workflow results may be cached locally
- Workflow engine → Progress: reports · Workflows emit progress updates
- Workflow engine → Audit log: audits · Workflow execution is recorded for safety and traceability
- Tool base → Arg guard: validates · Tool adapters normalize and validate arguments
- Tool base → Path guard: constrains · Tool adapters respect filesystem policy
- Tool base → Command runner: executes · Tool adapters invoke external binaries through the runner
- Command runner → Docker runner: fallback · Runner can delegate to containerized execution
- Command runner → Audit log: logs · Command execution is audited
- Command runner → SARIF: reports · Security-oriented results can be emitted as SARIF
- Plugins → Example plugin: example · Example plugin demonstrates the extension model
- Workflow engine → nmap: invokes · Enumeration workflows use built-in tools
- Workflow engine → masscan: invokes · Enumeration workflows use built-in tools
- Workflow engine → nikto: invokes · Scanning workflows use built-in tools
- Workflow engine → ffuf: invokes · Discovery workflows use built-in tools
- Workflow engine → hydra: invokes · Credential attacks use built-in tools
- Workflow engine → ddgSearch: invokes · Recon workflows can include search-assisted steps
- OpenAPI gen → API docs: generates · Script produces the checked-in API specification
- Docs build → API docs: includes · Docs build incorporates generated API docs
- Server → Audit log: observes · Server-level events are captured for auditability
- Server → Progress: streams · Server exposes long-running operation progress
- Server → SARIF: exports · Server can return structured security reports
