feat(mcp): contract tools for targets, scans, SBOM, CVEs and the control mapping (#273) #353

Merged
sharang merged 1 commits from feat/mcp-contract-tools into main 2026-09-23 15:54:40 +00:00
Owner

Part of #273. Pilot P2, item K (MCP). Stacked on the evidence-pack PR.

Why

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.

What

  • New tools:
    • list_targets: id, name, type, artifact kinds and detected type. The record is redacted before anything is read from it, so no credential can leave.
    • get_scan_results: a target's scan runs, newest first (default 10, max 50).
    • get_sbom: the whole SBOM as one CycloneDX 1.5 (default) or SPDX 2.3 document, built by the same code as the API export. sbom_docs moves to compliance_core::sbom_docs for that.
    • list_cves: the target's CVE alerts, highest CVSS first.
    • get_control_mapping: the CRA Annex I mapping (OSCAL). oscal_assessment stays for existing clients.
  • Shared collect / json_result / db_error helpers for the tools.
  • The server instructions now say to start with list_targets; the MCP docs are updated.

Not in this PR (keeps #273 open)

  • run_scan: the MCP process cannot start scans.
  • Token expiry, per-call audit and entitlement/ladder checks.
  • Hiding runtime-only tools in source_only deployments.
  • Updating the §6 list in Collectives.

Verification

  • Unit tests: the summary never carries a credential; parameter parsing.
  • the_contract_tools_answer_for_a_target runs the four tools against a real tenant database (MongoDB; skips without it): target listed, SPDX document with the component, the CVE, and empty scan runs.
  • 37 MCP tests pass; clippy with the CI flags; fmt.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Part of #273. Pilot P2, item K (MCP). **Stacked on the evidence-pack PR.** ## Why 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. ## What - New tools: - **`list_targets`**: id, name, type, artifact kinds and detected type. The record is redacted before anything is read from it, so no credential can leave. - **`get_scan_results`**: a target's scan runs, newest first (default 10, max 50). - **`get_sbom`**: the whole SBOM as one CycloneDX 1.5 (default) or SPDX 2.3 document, built by the same code as the API export. `sbom_docs` moves to `compliance_core::sbom_docs` for that. - **`list_cves`**: the target's CVE alerts, highest CVSS first. - **`get_control_mapping`**: the CRA Annex I mapping (OSCAL). `oscal_assessment` stays for existing clients. - Shared `collect` / `json_result` / `db_error` helpers for the tools. - The server instructions now say to start with `list_targets`; the MCP docs are updated. ## Not in this PR (keeps #273 open) - `run_scan`: the MCP process cannot start scans. - Token expiry, per-call audit and entitlement/ladder checks. - Hiding runtime-only tools in `source_only` deployments. - Updating the §6 list in Collectives. ## Verification - Unit tests: the summary never carries a credential; parameter parsing. - `the_contract_tools_answer_for_a_target` runs the four tools against a real tenant database (MongoDB; skips without it): target listed, SPDX document with the component, the CVE, and empty scan runs. - 37 MCP tests pass; clippy with the CI flags; fmt. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang changed target branch from feat/evidence-zip to main 2026-09-23 15:37:53 +00:00
sharang added 1 commit 2026-09-23 15:37:53 +00:00
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
9cd4ba8b1a
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
sharang force-pushed feat/mcp-contract-tools from b821ad8ce6 to 9cd4ba8b1a 2026-09-23 15:37:53 +00:00 Compare
sharang merged commit 48c113bc41 into main 2026-09-23 15:54:40 +00:00
Sign in to join this conversation.