nuclei-mcp
by retc0rn
README.md
# nuclei-mcp
MCP adapter for the [nuclei](https://github.com/projectdiscovery/nuclei) CLI,
part of the ARTEX scanner control plane. Unlike the Nessus/Burp/MobSF adapters
there is no REST API to wrap — nuclei is a CLI — so this adapter owns the
processes: `start_scan` spawns nuclei with a targets list and `-jsonl -o`,
`scan_status` polls the process and the JSONL so far, `fetch_results` delivers
the raw JSONL verbatim.
Results land in the task workspace and enter ARTEX through the ingestion
machinery (`ingest_scan_output` with format `nuclei-jsonl`) as **unverified
leads** — never as findings.
## Install
```sh
pip install .
```
Python 3.10+, the only runtime dependency is `fastmcp`. A nuclei binary must be
on the host (`NUCLEI_BIN`); install it from the projectdiscovery releases or
`go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest`.
## Configure
Environment-only; no secrets are needed (nuclei has none):
| env | default | meaning |
| --- | --- | --- |
| `NUCLEI_BIN` | `nuclei` | executable path or name |
| `NUCLEI_MCP_TRANSPORT` | `stdio` | `stdio` or `http` |
| `NUCLEI_MCP_HOST` | `127.0.0.1` | http bind host |
| `NUCLEI_MCP_PORT` | `8768` | http bind port |
| `NUCLEI_MCP_OUTPUT_ROOT` | — | confinement root for `fetch_results` `dest_path` |
| `NUCLEI_MCP_STATE_DIR` | `~/.nuclei-mcp/scans` | per-scan state (`targets.txt`, `output.jsonl`, `stderr.log`) |
| `NUCLEI_RATE_LIMIT` | `150` | default `-rl` |
| `NUCLEI_EXTRA_FLAGS` | — | extra argv tokens appended to every scan (e.g. a `-proxy` for an upstream Squid) |
## Run
```sh
# stdio (single-host setup; register the command in ARTEX System → MCP)
nuclei-mcp
# http next to the scanner host (register http://<host>:8768/mcp)
NUCLEI_MCP_TRANSPORT=http nuclei-mcp
```
## Tools
- `adapter_info` — nuclei version output, binary path, state dir, defaults.
- `start_scan(targets, name, templates, tags, severity, rate_limit, include_rr, extra_args)`
— spawns nuclei (`-l`, `-jsonl -o`, `-rl`, `-duc`, `-silent`; `-t`/`-tags`/`-s`
as given; `-irr` when `include_rr` is set). `targets` is a comma- or
newline-separated list — confirm scope before calling.
- `scan_status(scan_id)` — running/completed/failed plus result and severity
counts parsed from the JSONL so far.
- `stop_scan(scan_id)` — SIGTERM, then SIGKILL after a grace period; partial
results remain fetchable.
- `fetch_results(scan_id, dest_path)` — raw JSONL verbatim to `dest_path`
(confined to `NUCLEI_MCP_OUTPUT_ROOT` when set) or base64 inline under 8 MiB.
- `list_scans(limit)` — scans launched by this adapter.
## Evidence rules
- The JSONL output is **always preserved verbatim** — no filtering, no
summarizing, no truncation by the adapter. A stopped scan still delivers
what it produced (`partial: true`).
- `include_rr` turns on nuclei's `-irr`: every result then carries its raw
HTTP request/response, which ARTEX streams into its evidence store at
ingest time. Leave it on for engagements where evidence completeness
matters; it roughly doubles output size.
- ARTEX ingests results as unverified leads at medium severity and above;
verification happens agent-side before anything becomes a finding.
## Tests
```sh
.venv/Scripts/python -m pytest tests/ # unit tests (fake nuclei binary)
.venv/Scripts/python tests/smoke_mcp.py # e2e: real MCP HTTP transport
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues