feat(mcp): contract tools for targets, scans, SBOM, CVEs and the control mapping (#273)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 8m39s

breakpilot's document service pulls a target's evidence over MCP. It had
no way to find the targets, and no SBOM document or CVE list to pull.

- list_targets: id, name, type, artifact kinds and detected type (no
  credential leaves: the record is redacted first).
- get_scan_results: a target's scan runs, newest first.
- get_sbom: the whole SBOM as one CycloneDX 1.5 or SPDX 2.3 document, built
  by the same code as the agent's export (moved to compliance_core::sbom_docs).
- list_cves: the target's CVE alerts, highest CVSS first.
- get_control_mapping: the CRA Annex I mapping (OSCAL assessment results);
  oscal_assessment stays for existing clients.
- Shared cursor/JSON helpers for the tools; the server's instructions say
  to start with list_targets.

Not in this change (remaining in #273): run_scan (the MCP process cannot
start scans), token expiry, per-call audit and entitlement checks, and
hiding runtime-only tools in source-only deployments.

Tests: the summary never carries a credential; parameters; and the four
tools against a real tenant database (skips without MongoDB). Docs: the
MCP tool tables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-09-23 17:37:48 +02:00
1 parent c62b5c7ee2
commit 9cd4ba8b1a
10 files changed
+461 -8

No files matched your search

+22
View File
@@ -47,6 +47,27 @@ endpoint itself is reachable from your client.
The MCP server exposes seven tools that LLM clients can discover and call:
### Targets and Scans
Start here: each target's id is the `repo_id` / `target_id` the other tools take.
| Tool | Description |
|------|-------------|
| `list_targets` | The tenant's targets with id, name, type, artifact kinds and the detected type. No credentials are returned. |
| `get_scan_results` | A target's scan runs, newest first (default 10, max 50): status, times, new findings, error, and the stages not run with their reasons. |
| `list_cves` | The CVE alerts of a target's dependencies and firmware libraries, highest CVSS first. |
### Compliance Tools
| Tool | Description |
|------|-------------|
| `get_control_mapping` | The target's CRA Annex I control mapping as an OSCAL 1.1 assessment-results document. |
| `oscal_assessment` | The same document (kept for existing clients). |
The whole evidence set (OSCAL, both SBOM formats, findings, CVE alerts and a
manifest of sha256 checksums) is also served as one ZIP at
`GET /api/v1/targets/{id}/evidence-pack`.
### Findings Tools
| Tool | Description |
@@ -59,6 +80,7 @@ The MCP server exposes seven tools that LLM clients can discover and call:
| Tool | Description |
|------|-------------|
| `get_sbom` | A target's whole SBOM as one CycloneDX 1.5 (default) or SPDX 2.3 document, the same the API exports. |
| `list_sbom_packages` | List SBOM packages with filters for repository, vulnerabilities, package manager, and license. |
| `sbom_vuln_report` | Generate a vulnerability report for a repository showing all packages with known CVEs. |