vuln-scan-mcp
by RezinChow
README.md
# vuln-scan-mcp
**Engine-neutral, multi-agent source vulnerability scanning over the Model Context Protocol (MCP).**
[中文说明](README.zh-CN.md) · [API reference](MCP_API.md) · [Architecture](MCP_DESIGN.md) · [Security](SECURITY.md) · [License](LICENSE)
`vuln-scan-mcp` lets an MCP-compatible agent submit a trusted local Git repository for asynchronous static analysis. The service coordinates multiple analysis roles, validates reported source locations, and returns structured findings with evidence, dataflow, coverage limitations, and remediation guidance.
> **Status: alpha / local MVP.** The server is intended for trusted repositories and protocol integration testing. It is not a sandboxed, multi-tenant, or remotely exposed security service.
## Highlights
- **Standard MCP interface:** six asynchronous tools plus artifact resources.
- **Multi-agent workflow:** two parallel scouting roles and one trace-linking role, with an optional repair role for invalid source locations.
- **Replaceable execution engines:** Kimi CLI and Aster headless adapters behind one request/result contract.
- **Structured results:** stable finding IDs, fingerprints, severity, confidence, CWE, source/sink evidence, dataflow, and coverage limitations.
- **Deterministic checks:** repository revision, relative paths, line numbers, code snippets, and Git worktree state.
- **Operable scans:** idempotent creation, incremental events, long-wait status, cancellation, concurrency limits, and persistent artifacts.
- **Harness roadmap:** engine-neutral Offer/Need collaboration and a documented DeepSeek Harness compatibility design.
## How it works
```text
MCP host / agent / CI
│
▼
vuln_scan_start → scan_id
│
▼
ScanOrchestrator
├─ Entry-point scout ────────┐
├─ Critical-operation scout ─┼─ Evidence board → Trace linker
└─ Task state and events ────┘ │
▼
Deterministic source checks
│
Optional location repair
▼
Structured findings + artifacts
```
The two scouts run independently. The linker reads their evidence and actual source code to construct candidate dataflows. Source validation checks that reported locations exist and match the fixed revision; it does **not** prove exploitability.
## Requirements
- Linux
- Python 3.10 or later
- Git
- At least one configured execution engine:
- [Kimi CLI](https://www.kimi.com/code/docs/en/kimi-code-cli/), using its existing authentication and model configuration; or
- Aster CLI, with `KIMI_API_KEY` supplied through the server environment and the appropriate Aster configuration.
## Installation
### From source with uv
```bash
git clone https://github.com/RezinChow/vuln-scan-mcp.git
cd vuln-scan-mcp
uv sync
```
### From source with pip
```bash
python -m venv .venv
. .venv/bin/activate
python -m pip install .
```
Both installation methods provide the `vuln-scan-mcp` console command.
## Start the server
Register each allowed repository explicitly. The workspace must be a clean Git worktree.
```bash
vuln-scan-mcp \
--workspace my-repo=/absolute/path/to/my-repo \
--state-root /absolute/path/to/vuln-scan-runs \
--max-concurrent-scans 2
```
During development, use `uv run vuln-scan-mcp` with the same arguments.
The server uses local stdio. Logs go to stderr; stdout is reserved for MCP protocol messages.
## Configure an MCP host
A Kimi CLI configuration template is provided at [`examples/mcp.kimi.json`](examples/mcp.kimi.json):
```json
{
"mcpServers": {
"vuln-scan": {
"command": "vuln-scan-mcp",
"args": [
"--workspace", "my-repo=/absolute/path/to/my-repo",
"--state-root", "/absolute/path/to/vuln-scan-runs"
]
}
}
}
```
Replace both absolute paths and merge this server entry into your host's MCP configuration. For a project-scoped Kimi CLI setup, copy the template to `.kimi-code/mcp.json`; that local configuration is intentionally excluded from Git.
For Aster, [`examples/aster-config.acl`](examples/aster-config.acl) shows how to reference an API key through an environment variable. Never put credentials in the MCP request, JSON configuration, or repository files.
## MCP tools
| Tool | Purpose |
|---|---|
| `vuln_scan_capabilities` | Inspect available engines and server limits |
| `vuln_scan_start` | Create an asynchronous scan and return `scan_id` |
| `vuln_scan_status` | Read phase, progress, budget, and errors; supports up to 60 seconds of long waiting |
| `vuln_scan_events` | Read persistent events incrementally with a sequence cursor |
| `vuln_scan_result` | Retrieve structured findings and artifact references after a terminal state |
| `vuln_scan_cancel` | Stop creating roles and terminate the current scan's engine processes |
Artifact resources use:
```text
artifact://{scan_id}/{artifact_name}
```
Supported artifacts are `request.json`, `status.json`, `events.jsonl`, `evidence-board.json`, and `result.json`.
See [MCP_API.md](MCP_API.md) for complete schemas, examples, error codes, and a Python client.
## Example agent prompt
```text
Use the vuln-scan MCP server to scan the my-repo workspace with the kimi_cli
engine and quick profile. Poll status with wait_seconds=60 until the scan
reaches a terminal state, then read its events and final result. Report the
findings, source evidence, coverage limitations, and artifact locations.
```
## Result semantics
- `succeeded` means the workflow completed; it does not mean the repository is secure.
- An empty `findings` array does not prove the absence of vulnerabilities.
- Static findings are currently reported as `likely`, even when their source locations pass validation.
- `confidence` is an evidence-strength estimate, not a calibrated probability.
- `files_analyzed` is `null` when a headless engine cannot provide reliable coverage data.
- Failed and cancelled scans retain their events and structured error information.
Results remain candidates for human review. No exploit is executed by this MVP.
## Security boundary
The current version:
- accepts only pre-registered local workspaces;
- does not expose arbitrary shell execution through MCP;
- uses fixed argument arrays rather than shell command strings;
- checks that the target Git worktree remains unchanged;
- keeps API keys out of scan request schemas.
However, engine agents still run with the current user's permissions. Read-only prompts and Git diff verification are **not** an OS security boundary. Do not scan untrusted repositories or expose this MVP as a remote multi-user service without adding isolation, authentication, authorization, and resource controls. See [SECURITY.md](SECURITY.md).
## DeepSeek Harness compatibility
The public MCP contract is designed to remain independent of the agent harness. DeepSeek Harness can be evaluated first as an external MCP caller, and later as an internal collaboration runtime.
The design maps Offer/Need collaboration to Team Tasks, explicit message wakeup, dependency DAGs, compare-and-swap updates, claim leases, and read-before-retry persistence handling. **The DeepSeek Harness adapter is not implemented yet.** See [DS_HARNESS_COMPATIBILITY.md](DS_HARNESS_COMPATIBILITY.md).
## Documentation
- [中文使用说明](README.zh-CN.md)
- [MCP API reference](MCP_API.md)
- [Engine-neutral architecture](MCP_DESIGN.md)
- [Native Harness collaboration plan](HARNESS_COLLABORATION_PLAN.md)
- [DeepSeek Harness compatibility plan](DS_HARNESS_COMPATIBILITY.md)
- [Architecture diagrams](architecture-diagrams/)
- [Contributing](CONTRIBUTING.md)
- [Changelog](CHANGELOG.md)
Raw vulnerability corpora, local experiment logs, model output, credentials, and scan state are intentionally excluded from the public repository.
## License
MIT. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues