How sc4rfurry/redquanta-mcp works
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: workflowEngine.ts Workflow engine · mcpRouter.ts MCP router · server.ts Server · base.ts Tool base
Components 25
Runtime & entrypoints
Process entrypoints and deployment launch paths
Core orchestration
Protocol routing, workflows, help, and plugins
- MCP router · Routes protocol tool requests to handlers
src/core/mcpRouter.ts - Workflow engine · Coordinates multi-step security workflows
src/core/workflowEngine.ts - Help system · Tool help and endpoint guidance
src/core/helpSystem.ts - Plugins · Loads custom tools from plugins
src/core/pluginSystem.ts - Example plugin · Custom tool plugin example
plugins/example-custom-tool.js
Tool adapters
Built-in security tool wrappers
- Tool base · Shared tool wrapper interface
src/tools/base.ts - nmap · Port scanning wrapper
src/tools/nmap.ts - masscan · High-speed scan wrapper
src/tools/masscan.ts - nikto · Web scanner wrapper
src/tools/nikto.ts - ffuf · Content discovery wrapper
src/tools/ffuf.ts - hydra · Brute-force wrapper
src/tools/hydra.ts - ddgSearch · Search-assisted recon wrapper
src/tools/ddgSearch.ts
Safety & execution
Command validation, sandboxing, and observability
- Arg guard · Command argument validation
src/utils/argGuard.ts - Path guard · Filesystem jail and path policy
src/utils/pathGuard.ts - Command runner · Invokes external binaries
src/utils/commandRunner.ts - Docker runner · Container-based tool execution
src/utils/dockerRunner.ts - Audit log · JSONL security and execution logging
src/utils/auditLogger.ts - Progress · Long-running operation status tracking
src/utils/progressTracker.ts - Cache · Local result and scan cache
src/utils/cacheManager.ts - SARIF · Structured security report output
src/utils/sarifReporter.ts
Docs & deployment
Documentation generation and deployment assets
- API docs · Generated OpenAPI specification
docs/api/openapi.json - Docs build · Documentation build and generation scripts
scripts/build-docs.ts - OpenAPI gen · OpenAPI generation script
scripts/generate-openapi.ts
Connections 27
- 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