CVE Risk MCP Server
MCP server for CVE lookups, KEV enrichment, and “what should I patch first?” ranking. It
implements the MCP tools/list + tools/call flow over stdio and returns structured risk
assessments per CVE.
Features
- CVE detail lookups with parsed CVSS v3/v4 metrics.
- CISA KEV feed enrichment (primary + mirror fallback).
- EPSS-style risk scoring with reasons and a priority label.
- Batch ranking for patch queues.
Tools
cve_lookup- Inputs:
cve_id,include_kev,include_epss - Output: CVE summary + KEV status + risk score
- Inputs:
cve_rank- Inputs:
cve_ids,include_kev,include_epss,fail_fast - Output: ranked list (highest risk first)
- Inputs:
cve_patch_first- Inputs:
cve_ids,top_n,include_kev,include_epss,fail_fast - Output: ranked list + top-N recommendations
- Inputs:
cve_status- Inputs: none
- Output: upstream status + cache stats (timestamps + last error summary)
cve_config- Inputs: none
- Output: effective runtime config (URLs, cache, scoring, batch limits)
cve_refresh- Inputs:
cve_ids,include_epss,refresh_kev - Output: cache warm/refresh summary
- Inputs:
cve_export- Inputs:
cve_ids,include_kev,include_epss,include_markdown,fail_fast - Output: ranked list + optional markdown summary
- Inputs:
Quickstart
make setup
make check
Reliability knobs
--retriesand--retry-backoff-secondscontrol bounded retries for transient HTTP failures (429/5xx + network errors).Retry-Aftersupports both delta-seconds and HTTP-date response headers.--print-effective-configprints resolved settings and their source (CLI/config/env/built-ins) to debug precedence.--cve-timeout,--kev-timeout, and--epss-timeoutoverride the shared--timeoutfor per-source control.--config(TOML) centralizes defaults. Precedence: CLI flags > config > env > built-ins.- MCP and JSON CLI responses now include structured error data for upstream failures.
- Batch flows (
cve_rank,cve_patch_first,cve_export) are fail-soft and return per-itemerrorswithout dropping successful results. - KEV/EPSS enrichment is best-effort: enrichment failures are recorded in
errors, but results are still returned with missing enrichment fields. - Optional strict batch mode is available via
fail_fast(MCP tool arg) or--fail-fast(JSON CLI). --max-batch-sizelimits how many unique CVEs a batch request can process (0 disables).--max-parallelcontrols controlled parallelism for batch CVE lookups (default: 1).--cache-direnables a persistent on-disk cache for CVE/KEV/EPSS responses (env:CVE_RISK_CACHE_DIR).--offlinedisables all network fetches and uses cache-only mode (requires--cache-dir).- Lookup/rank/patch/export/refresh responses include a
cacheblock when stale cache entries are served in offline mode (cache.served_stale=truewith per-source details). - CVE IDs are validated and batch inputs are de-duplicated before upstream calls.
- CVE parsing tolerates legacy schema variants (alternate CVSS and reference fields).
- Structured errors include remediation hints (e.g., respect
Retry-Afteron 429s). --epss-weight(or envCVE_RISK_EPSS_WEIGHT) calibrates how strongly EPSS influences the risk score (default: 1.0).--kev-floor(envCVE_RISK_KEV_FLOOR) and--kev-boost(envCVE_RISK_KEV_BOOST) calibrate the KEV scoring behavior.--age-recent-days/--age-recent-boost(envCVE_RISK_AGE_RECENT_DAYS/CVE_RISK_AGE_RECENT_BOOST) calibrate the "new CVE" boost.--age-old-days/--age-old-penalty(envCVE_RISK_AGE_OLD_DAYS/CVE_RISK_AGE_OLD_PENALTY) calibrate the "old CVE" penalty.cve_statusincludes cache metadata plus request/latency counters, stale-cache counters, and rolling-window latency percentiles (request_count,success_count,error_count,stale_served_count,avg_latency_ms,last_latency_ms,p50_latency_ms,p95_latency_ms,latency_sample_count,latency_window_size) per source.- stdio MCP mode emits structured JSON logs to stderr (configurable via
--mcp-log-level).
Operations
See docs/OPERATIONS.md for a small operator runbook (interpreting cve_status, common remediation).
Run (stdio MCP server)
python -m cve_risk_mcp --stdio
Run (JSON CLI mode)
cve-risk-mcp lookup CVE-2023-23397 --pretty
cve-risk-mcp rank CVE-2023-23397 CVE-2021-44228 --pretty
cve-risk-mcp rank CVE-2023-23397 CVE-2021-44228 --fail-fast --pretty
cve-risk-mcp patch-first CVE-2023-23397 CVE-2021-44228 --top-n 1 --pretty
cve-risk-mcp status --pretty
cve-risk-mcp refresh --no-refresh-kev --pretty
cve-risk-mcp export CVE-2023-23397 CVE-2021-44228 --include-markdown --pretty
Config file (optional)
Use --config to set defaults in a TOML file. See cve-risk-mcp.example.toml for a starting point.
Output to file
cve-risk-mcp lookup CVE-2023-23397 --output out.json --pretty
NDJSON output
Tools 7
cve_lookupPerforms a CVE detail lookup with parsed CVSS metrics and KEV/EPSS enrichment.cve_rankRanks a list of CVEs by risk score, showing the highest risk first.cve_patch_firstProvides a ranked list of CVEs with top-N recommendations for patching.cve_statusReturns upstream status and cache statistics.cve_configReturns the effective runtime configuration.cve_refreshWarms or refreshes the local cache for specific CVEs.cve_exportGenerates a ranked list of CVEs with an optional markdown summary.Environment Variables
CVE_RISK_CACHE_DIRDirectory path for persistent on-disk cache.CVE_RISK_EPSS_WEIGHTCalibrates how strongly EPSS influences the risk score.CVE_RISK_KEV_FLOORCalibrates the KEV scoring floor.CVE_RISK_KEV_BOOSTCalibrates the KEV scoring boost.