# nguyentin2068/devsecops-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/nguyentin2068/devsecops-mcp
- Repository: https://github.com/nguyentin2068/devsecops-mcp

## Overview

DevSecOps MCP provides a CLI-driven security scanning workflow for CI: validate and configure a target, run a scanner, persist JSON/SARIF results, and apply a policy gate. Its separate read-only MCP interface lets clients list, inspect, summarize, and report on stored scans over HTTP or stdio. The graph preserves the documented SAST, SCA, container, and DAST stages. Source excerpts do not show every scanner invocation or storage write; those relationships are included only where the index or README supports them.

Main entry points: [`src/core/scan-runner.ts`](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scan-runner.ts) (Scan runner), [`src/cli.ts`](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/cli.ts) (Scan CLI), [`src/core/process.ts`](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/process.ts) (Process runner), [`src/mcp/tools.ts`](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/tools.ts) (Read-only tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Scan execution"]
  node_cli["Scan CLI<br/>[cli.ts]"]
  node_config["Rules config<br/>[config.ts]"]
  node_guards["Target guards<br/>[guards.ts]"]
  node_runner["Scan runner<br/>[scan-runner.ts]"]
  node_process["Process runner<br/>[process.ts]"]
end

subgraph group_adapters["Scanner adapters"]
  node_opengrep["Opengrep adapter<br/>[opengrep.ts]"]
  node_osv["OSV adapter<br/>[osv-scanner.ts]"]
  node_trivy["Trivy adapter<br/>[trivy.ts]"]
  node_katana["Katana crawler<br/>[katana.ts]"]
  node_nuclei["Nuclei adapter<br/>[nuclei.ts]"]
end

subgraph group_results["Results and policy"]
  node_store[("Report store<br/>[report-store.ts]")]
  node_policy["Policy gate<br/>[policy.ts]"]
  node_report["Report renderer<br/>[report.ts]"]
  node_sarif["SARIF formatter<br/>[sarif.ts]"]
end

subgraph group_mcp["Read-only MCP"]
  node_http["HTTP transport<br/>[http.ts]"]
  node_server["MCP server<br/>[mcp.ts]"]
  node_tools["Read-only tools<br/>[tools.ts]"]
  node_stdio["Stdio transport<br/>[mcp.ts]"]
end

node_ci(("CI / operator"))
node_mcpclient(("MCP client"))

node_ci -->|"invokes"| node_cli
node_cli -->|"loads rules"| node_config
node_cli -->|"starts scan"| node_runner
node_cli -->|"loads results"| node_store
node_cli -->|"evaluates gate"| node_policy
node_cli -->|"renders report"| node_report
node_runner -->|"resolves settings"| node_config
node_runner -->|"validates targets"| node_guards
node_runner -->|"dispatches SAST"| node_opengrep
node_runner -->|"dispatches SCA"| node_osv
node_runner -->|"dispatches scans"| node_trivy
node_runner -->|"dispatches DAST"| node_nuclei
node_runner -->|"starts crawl"| node_katana
node_runner -->|"stores results"| node_store
node_opengrep -->|"runs binary"| node_process
node_osv -->|"runs binary"| node_process
node_trivy -->|"runs binary"| node_process
node_nuclei -->|"runs binary"| node_process
node_katana -->|"runs binary"| node_process
node_store -->|"formats SARIF"| node_sarif
node_report -->|"formats SARIF"| node_sarif
node_mcpclient -->|"connects HTTP"| node_http
node_http -->|"serves MCP"| node_server
node_server -->|"dispatches tools"| node_tools
node_tools -->|"reads scans"| node_store
node_tools -->|"evaluates policy"| node_policy
node_tools -->|"renders report"| node_report
node_mcpclient -->|"connects stdio"| node_stdio
node_stdio -->|"hosts MCP"| node_server

click node_cli "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/cli.ts"
click node_config "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/config.ts"
click node_guards "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/guards.ts"
click node_runner "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scan-runner.ts"
click node_process "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/process.ts"
click node_opengrep "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/opengrep.ts"
click node_osv "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/osv-scanner.ts"
click node_trivy "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/trivy.ts"
click node_katana "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/katana.ts"
click node_nuclei "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/nuclei.ts"
click node_store "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/report-store.ts"
click node_policy "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/policy.ts"
click node_report "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/report.ts"
click node_sarif "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/sarif.ts"
click node_http "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/http.ts"
click node_server "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/mcp.ts"
click node_tools "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/tools.ts"
click node_stdio "https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/mcp.ts"

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_config,node_guards,node_runner,node_process,node_mcpclient toneBlue
class node_opengrep,node_osv,node_trivy,node_katana,node_nuclei toneAmber
class node_store,node_policy,node_report,node_sarif toneMint
class node_http,node_server,node_tools,node_stdio toneRose
class node_ci toneIndigo
```

## Components

### Scan execution

- [Scan CLI](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/cli.ts): `src/cli.ts`
- [Rules config](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/config.ts): `src/core/config.ts`
- [Target guards](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/guards.ts): `src/core/guards.ts`
- [Scan runner](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scan-runner.ts): `src/core/scan-runner.ts`
- [Process runner](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/process.ts): `src/core/process.ts`

### Scanner adapters

- [Opengrep adapter](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/opengrep.ts): `src/core/scanners/opengrep.ts`
- [OSV adapter](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/osv-scanner.ts): `src/core/scanners/osv-scanner.ts`
- [Trivy adapter](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/trivy.ts): `src/core/scanners/trivy.ts`
- [Katana crawler](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/katana.ts): `src/core/scanners/katana.ts`
- [Nuclei adapter](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/scanners/nuclei.ts): `src/core/scanners/nuclei.ts`

### Results and policy

- [Report store](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/report-store.ts): `src/core/report-store.ts`
- [Policy gate](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/policy.ts): `src/core/policy.ts`
- [Report renderer](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/report.ts): `src/core/report.ts`
- [SARIF formatter](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/core/sarif.ts): `src/core/sarif.ts`

### Read-only MCP

- [HTTP transport](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/http.ts): `src/mcp/http.ts`
- [MCP server](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/mcp.ts): `src/mcp/mcp.ts`
- [Read-only tools](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/tools.ts): `src/mcp/tools.ts`
- [Stdio transport](https://github.com/nguyentin2068/devsecops-mcp/blob/main/src/mcp/mcp.ts): `src/mcp/mcp.ts`

### Other components

- **CI / operator**
- **MCP client**

## Connections

- CI / operator → Scan CLI: invokes (evidence: `README.md`)
- Scan CLI → Rules config: loads rules (evidence: `src/cli.ts`)
- Scan CLI → Scan runner: starts scan (evidence: `src/cli.ts`)
- Scan CLI → Report store: loads results (evidence: `src/cli.ts`)
- Scan CLI → Policy gate: evaluates gate (evidence: `src/cli.ts`)
- Scan CLI → Report renderer: renders report (evidence: `src/cli.ts`)
- Scan runner → Rules config: resolves settings (evidence: `src/core/scan-runner.ts`)
- Scan runner → Target guards: validates targets (evidence: `src/core/scan-runner.ts`)
- Scan runner → Opengrep adapter: dispatches SAST (evidence: `src/core/scan-runner.ts`)
- Scan runner → OSV adapter: dispatches SCA (evidence: `src/core/scan-runner.ts`)
- Scan runner → Trivy adapter: dispatches scans (evidence: `src/core/scan-runner.ts`)
- Scan runner → Nuclei adapter: dispatches DAST (evidence: `src/core/scan-runner.ts`)
- Scan runner → Katana crawler: starts crawl (evidence: `src/core/scan-runner.ts`)
- Scan runner → Report store: stores results (evidence: `src/core/scan-runner.ts`)
- Opengrep adapter → Process runner: runs binary (evidence: `src/core/scanners/opengrep.ts`)
- OSV adapter → Process runner: runs binary (evidence: `src/core/scanners/osv-scanner.ts`)
- Trivy adapter → Process runner: runs binary (evidence: `src/core/scanners/trivy.ts`)
- Nuclei adapter → Process runner: runs binary (evidence: `src/core/scanners/nuclei.ts`)
- Katana crawler → Process runner: runs binary (evidence: `src/core/scanners/katana.ts`)
- Report store → SARIF formatter: formats SARIF (evidence: `src/core/report-store.ts`)
- Report renderer → SARIF formatter: formats SARIF (evidence: `src/core/report.ts`)
- MCP client → HTTP transport: connects HTTP (evidence: `README.md`)
- HTTP transport → MCP server: serves MCP (evidence: `src/mcp/http.ts`)
- MCP server → Read-only tools: dispatches tools (evidence: `src/mcp/mcp.ts`)
- Read-only tools → Report store: reads scans (evidence: `src/mcp/tools.ts`)
- Read-only tools → Policy gate: evaluates policy (evidence: `src/mcp/tools.ts`)
- Read-only tools → Report renderer: renders report (evidence: `src/mcp/tools.ts`)
- MCP client → Stdio transport: connects stdio (evidence: `README.md`)
- Stdio transport → MCP server: hosts MCP (evidence: `src/mcp/mcp.ts`)
