Trivy & Grype Container/SBOM MCP
Scan container images, Dockerfiles, IaC manifests, and CycloneDX SBOMs for reachable CVEs and secrets.
Prerequisites & Step-by-Step Installation
Copy & run inside isolated labBefore You Start (Prerequisites)
- + Aqua Trivy CLI (>= 0.56) or Anchore Grype + Syft installed
- + Local vulnerability DB synced prior to offline container checks
- + Docker / OCI image tarball or Dockerfile repository
Install Trivy and cache the local CVE database
trivy image --download-db-only
trivy --version
Pre-caching enables offline scanning inside CI runners or restricted labs.
Register Trivy MCP with severity threshold filtering
claude mcp add trivy-mcp -- trivy-mcp --severity HIGH,CRITICAL --ignore-unfixed
Filtering to fixed CVEs focuses developer prompts on actionable upgrades.
trivy --version | head -n 2
Client Integration & Configuration Files
Review scope limits before wiringclaude mcp add trivy-grype-container-mcp-server -- trivy-mcp --offline-scan --severity HIGH,CRITICAL
{
"mcpServers": {
"trivy-grype-container-mcp-server": {
"command": "trivy-mcp",
"args": [
"--offline-scan",
"--severity",
"HIGH,CRITICAL"
],
"env": {
"TOOLWAR_SAFE_MODE": "strict",
"AUTH_TOKEN": "YOUR_SCOPED_TOKEN_HERE"
}
}
}
}
{
"mcpServers": {
"trivy-grype-container-mcp-server": {
"command": "trivy-mcp",
"args": [
"--offline-scan",
"--severity",
"HIGH,CRITICAL"
]
}
}
}
services:
trivy-grype-container-mcp-server:
image: toolwar-sandbox/mcp-runner:latest
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
How to Use & Defensive Workflow
Authorized assessment protocolTypical Scenario: Audit a multi-stage Dockerfile and built OCI image for high-severity OS/library CVEs and propose minimal non-root base image upgrades.
- 01. Generate an SBOM or scan the built container image locally.
- 02. Filter to CVEs with upstream fixed versions available.
- 03. Review proposed Dockerfile USER and pinned digest patches before CI rebuild.
Scan ./Dockerfile and app:staging via trivy-mcp, list HIGH/CRITICAL vulnerabilities that have upstream fixes, and draft minimal package-bump diffs.
Bind the MCP server exclusively inside a read-only workspace or isolated container (`read_only: true`, `--cap-drop=ALL`). Enforce strict CIDR/directory allowlists and never expose local MCP stdio or SSE ports on untrusted network interfaces without mutual authentication.
Technical Architecture & Deployment Brief
Overview & Role in Security Engineering
Trivy & Grype Container/SBOM MCP (Security MCP Server) is engineered to support practitioners focused on container base-image vulnerability triage, SBOM generation, fixed-version upgrade planning, and Dockerfile CIS checks. Within the ToolWar ecosystem, it serves as an explicit bridge between AI reasoning layers and verifiable cybersecurity telemetry.
Technical Architecture & Data Flow
The Model Context Protocol (MCP) separates the language model reasoning layer from privileged binary execution. Rather than letting an AI assistant invoke unconstrained shell commands, this server exposes typed, schema-validated read/inspection tools with explicit scope boundaries.
Unlike ad-hoc prompt wrappers that execute unconstrained strings directly in a shell, structured integration enforces typed parameter validation, bounded scope allowlists, and explicit separation between untrusted analyzed artifacts (source files, telemetry logs, network banners, or binary samples) and system-level control instructions.
Recommended Deployment Practice
- Isolate the Execution Boundary: Deploy integrations inside ephemeral containers or dedicated analysis VMs so untrusted repositories, binaries, or HTTP responses cannot affect primary workstations.
- Enforce Least-Privilege Scoping: Use read-only filesystem mounts, non-privileged service tokens, and target CIDR allowlists before enabling interactive assistant sessions.
- Verify Outputs Deterministically: Pair this connector with least-privilege runtime profiles and inspect every returned JSON schema before forwarding findings into automated tickets or dashboards.
Integration & Operational Caveats
- Treat all external content ingested by an LLM (including code comments, HTML titles, log lines, and MCP responses) as potential prompt-injection vectors.
- Review configuration JSON and
SKILL.mdmanifests carefully before binding credentials or running inside automated CI/CD pipelines.