mcp-nvd-server
README.md
# mcp-nvd-server
MCP server for NIST NVD
### This project is not endorsed or supported by the US Government and is for personal development only.
Starter MCP server for the [NIST National Vulnerability Database (NVD)](https://nvd.nist.gov/) - the US government repository of standards based vulnerability management data.
The NVD includes databases of security checklist references, security-related software flaws, product names, and impact metrics.
## Vulnerability Concepts
Common Vulnerabilities and Exposures (CVE): NVD uses unique identifiers cve_id to identify vulnerabilities and to associate specific versions of code bases (e.g., software and shared libraries) with the Common Platform Enumeration (CPE) to those vulnerabilities.
Known Exploited Vulnerabilities (KEV): Subset of CVEs that have been observed in the wild and have a clear remediation action available. NVD flags CVEs considered KEVs, while the KEV catalog provides more information about required actions and mitigation.
Common Vulnerability Scoring System (CVSS): Standardized evaluation method used to supply a measure of severity. Metrics result in a numerical score ranging from 0 to 10 (Critical).
Common Platform Enumeration (CPE): Structured naming scheme for information technology systems, software, and packages, which helps with asset management and allows mapping vulnerabilities (CVEs) to specific systems.
## Vulnerability resources
[CVE Foundation](https://www.thecvefoundation.org/resources)
[KEV Catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog)
[Common Vulnerability Scoring System](https://www.first.org/cvss/)
[Common Platform Enumeration](https://nvd.nist.gov/products/cpe)
## Current status
This is an MVP, not a finished production server. It currently focuses on:
- single CVE lookup from NVD with normalized CVSS, CWE, CPE, references, and optional CISA KEV enrichment
- risk summary output that combines CVSS, KEV, CWE, exploit references, and affected CPEs
- CVE search from NVD by keyword, CPE, CVE ID, CVSS v3 severity, and date windows
- CPE dictionary search from NVD
- CPE match criteria lookup from NVD
- CISA KEV direct lookup and filtered search
- NVD source-organization metadata lookup and search
- CVE change history lookup from NVD
- Check for changed/increased severity scores for existing CVEs
- cyber-tool integration helpers for asset inventory, SBOMs, SIEM/SOAR exports, ticket payloads, scanner correlation, threat intelligence, and prioritization
- stdio, SSE, and streamable HTTP MCP transports
- optional shared-token auth for remote deployments
- input validation, response normalization, retry/backoff, TTL caching, optional SQLite persistence, sync jobs, and observability
## NVD API coverage
This server targets the NIST NVD API v2.0 using these endpoints:
`cves/2.0` for CVE lookup and search,
`cvehistory/2.0` for CVE change history,
`cpes/2.0` for official CPE dictionary records,
`cpematch/2.0` for CPE match criteria,
`source/2.0` for source-organization metadata.
Base URLs:
- `https://services.nvd.nist.gov/rest/json/cves/2.0`
- `https://services.nvd.nist.gov/rest/json/cvehistory/2.0`
- `https://services.nvd.nist.gov/rest/json/cpes/2.0`
- `https://services.nvd.nist.gov/rest/json/cpematch/2.0`
- `https://services.nvd.nist.gov/rest/json/source/2.0`
## What this repo includes
- MCP server using `FastMCP`
- `nvd_get_cve` tool
- `nvd_search_cves` tool
- `nvd_search_cpes` tool
- `nvd_get_cpe_matches` tool
- `nvd_get_cve_history` tool
- `nvd_find_severity_changes` tool
- `nvd_get_kev` tool
- `nvd_search_kev` tool
- `nvd_get_source` tool
- `nvd_search_sources` tool
- `nvd_match_inventory` tool
- `nvd_match_sbom` tool
- `nvd_export_findings` tool
- `nvd_generate_ticket` tool
- `nvd_enrich_threat_intel` tool
- `nvd_correlate_scanner_findings` tool
- `nvd_prioritize_findings` tool
- `nvd_run_sync` tool
- `nvd_start_sync_scheduler` tool
- `nvd_stop_sync_scheduler` tool
- `nvd_get_sync_status` tool
- `nvd_get_observability` tool
- `nvd_get_lookup_history` tool
- NVD API client
- CISA KEV client used to enrich single-CVE lookups and power KEV tools
- EPSS client for threat-intelligence enrichment
- CVE, CPE, CPE match, history, CVSS, KEV, source, and risk-summary normalization models
- retry/backoff for transient NVD failures and rate-limit responses
- in-memory TTL caching for NVD responses and the KEV catalog, with optional SQLite persistence
- structured logging and observability counters
Not yet included:
- live writes into Jira, ServiceNow, GitHub, SIEMs, SOARs, or scanners; tools generate normalized payloads for those systems
- a separate external worker process; recurring sync runs in-process when enabled
## Quick start
### 1. Create a virtual environment and install dependencies
```bash
uv sync --all-groups
```
### 2. Optional: add a `.env` file
```bash
NVD_API_KEY= <your key here>
NVD_API_BASE=https://services.nvd.nist.gov/rest/json
HTTP_TIMEOUT_SECONDS=30
CACHE_TTL_SECONDS=900
NVD_MAX_RETRIES=3
NVD_RETRY_BACKOFF_SECONDS=0.5
LOG_LEVEL=INFO
ENABLE_KEV=true
KEV_SOURCE_URL=https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json
MCP_TRANSPORT=stdio
MCP_HOST=127.0.0.1
MCP_PORT=8000
MCP_AUTH_TOKEN=
PERSISTENCE_ENABLED=false
PERSISTENCE_PATH=.cache/mcp_nvd_server.sqlite3
EPSS_API_BASE=https://api.first.org/data/v1
SYNC_ENABLED=false
SYNC_INTERVAL_SECONDS=86400
SYNC_WINDOW_DAYS=7
SYNC_SEVERITIES=CRITICAL,HIGH
```
### 3. Run the server locally
```bash
uv run python -m mcp_nvd_server.server
```
For remote MCP transport, set `MCP_TRANSPORT` to `streamable-http` or `sse`:
```bash
MCP_TRANSPORT=streamable-http MCP_HOST=0.0.0.0 MCP_PORT=8000 MCP_AUTH_TOKEN=change-me uv run python -m mcp_nvd_server.server
```
Streamable HTTP defaults to `/mcp`; SSE defaults to `/sse` and `/messages/`. When `MCP_AUTH_TOKEN` is set, pass the same value as each tool's `auth_token` argument.
### 4. (Optional) Test with MCP inspector
```bash
npx -y @modelcontextprotocol/inspector
```
Open browser link created to launch Inspector. Enter the bash command from step 3 above into the Command field and click Connect. Select the tools tab and enter a CVE Id (eg. CVE-2017-0144) to test and check the response.
### 5. (Optional) Run with Docker
```bash
docker build -t mcp-nvd-server .
docker run --rm -p 8000:8000 -e MCP_AUTH_TOKEN=change-me -v mcp-nvd-data:/data mcp-nvd-server
```
Or use `docker-compose.example.yml` as a starting point.
## Example tools
### `nvd_get_cve`
Returns a normalized CVE record for a single CVE ID.
The response includes:
- CVSS scores, preferred CVSS, and plain-English CVSS interpretation
- CWE classifications
- affected CPE criteria
- references and exploit-oriented references
- optional CISA KEV metadata
- `risk_summary` with priority, score, reasons, CVSS context, KEV context, CWE, exploit references, and affected CPEs
### `nvd_search_cves`
Searches NVD CVEs using common filters such as keyword, CPE, severity score (CVSS), and time frame windows.
Parameters include:
- `keyword`
- `cpe_name`
- `cve_id`
- `cvss_v3_severity`: `LOW`, `MEDIUM`, `HIGH`, or `CRITICAL`
- `pub_start_date` and `pub_end_date`
- `last_mod_start_date` and `last_mod_end_date`
- `limit`: 1-50
- `start_index`: zero-based pagination offset
Date windows must provide both start and end values, use ISO 8601 date-time strings, and stay within 120 days.
### `nvd_search_cpes`
Searches the official NVD CPE dictionary by keyword, CPE match string, or CPE name ID.
Parameters include `keyword`, `cpe_match_string`, `cpe_name_id`, `limit`, and `start_index`.
### `nvd_get_cpe_matches`
Returns NVD CPE Match Criteria records by CVE ID, match criteria UUID, CPE match string search, or last-modified date window.
Parameters include:
- `cve_id`
- `match_criteria_id`
- `match_string_search`
- `last_mod_start_date` and `last_mod_end_date`
- `limit`: 1-500
- `start_index`: zero-based pagination offset
### `nvd_get_cve_history`
Returns NVD change-history records by CVE ID or change date window.
Parameters include `cve_id`, `change_start_date`, `change_end_date`, `event_name`, `limit`, and `start_index`.
### `nvd_find_severity_changes`
Finds CVEs with increases in severity
Parameters include `cve_id`, `change_start_date`, `change_end_date`, `minimum_score_increase`, and `start_index`.
### `nvd_get_kev`
Returns a CISA KEV catalog record for a single CVE ID.
### `nvd_search_kev`
Searches the CISA KEV catalog by `vendor`, `product`, and `ransomware_only`, with `limit` and `start_index` pagination.
### `nvd_get_source`
Returns NVD source-organization metadata for an exact `source_identifier`.
### `nvd_search_sources`
Searches NVD source metadata by `source_identifier` or last-modified date window, with `limit` and `start_index` pagination.
### Cyber workflow tools
`nvd_match_inventory` accepts host software/package inventory and maps entries to CPEs, then matching CVEs.
`nvd_match_sbom` accepts CycloneDX or SPDX JSON and returns component-to-CPE/CVE matches.
`nvd_export_findings` builds JSON records for Splunk, Sentinel, Elastic, Cortex XSOAR, or TheHive.
`nvd_generate_ticket` creates remediation ticket payloads for GitHub Issues, Jira, or ServiceNow.
`nvd_enrich_threat_intel` adds EPSS, KEV, vendor advisory, ExploitDB, Metasploit, and GitHub PoC signals.
`nvd_correlate_scanner_findings` normalizes scanner findings from Nessus, OpenVAS, Qualys, Rapid7, Defender VM, or generic CVE-bearing records and enriches them through NVD.
`nvd_prioritize_findings` scores findings using risk summary, KEV, EPSS, internet exposure, and business criticality.
### Operational tools
`nvd_run_sync` refreshes KEV context and queries recent high-priority CVEs for configured severities.
`nvd_start_sync_scheduler`, `nvd_stop_sync_scheduler`, and `nvd_get_sync_status` control the in-process recurring sync scheduler. Set `SYNC_ENABLED=true` to start it automatically with the server.
`nvd_get_observability` returns request counters, latency summaries, cache hits, errors, transport settings, and freshness timestamps.
`nvd_get_lookup_history` returns persisted lookup history when `PERSISTENCE_ENABLED=true`.
## Work in progress
1. Add live push connectors for SIEM/SOAR/ticketing platforms
2. Add richer third-party threat intelligence such as OSV and commercial feeds
3. Add broader end-to-end test coverage against recorded NVD/KEV/EPSS fixtures
## NVD attribution
This product uses the NIST NVD API but is not endorsed or supported by NIST or any other US Government agency.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues