CVE数据库集成服务器

一个生产就绪的MCP服务器,为AI代理提供无缝访问常见漏洞和暴露(CVE)数据库的功能,支持自动化威胁情报收集和漏洞评估工作流。

  • by Cyber-Agents-Fleet
  • 本地部署
  • 更新于
在 GitHub 查看 cyber-agents-fleet/cve-mcp-server

使用说明

🛡️ CVE-MCP服务器

CVE数据库集成的模型上下文协议服务器

一个生产就绪的MCP服务器,为AI代理提供对通用漏洞和暴露(CVE)数据库的无缝访问,实现自动化的威胁情报收集和漏洞评估工作流程。

🎯 概述

CVE-MCP服务器弥合了AI代理和漏洞数据库之间的差距,提供了对以下内容的标准化访问:

  • 国家脆弱性数据库(NVD)
  • MITRE CVE数据库
  • GitHub安全公告
  • 利用数据库相关性
  • CVSS评分和影响分析

✨ 特性

🔍 CVE查询功能

  • 按CVE ID、CVSS评分、供应商、产品搜索
  • 日期范围过滤和严重性分类
  • 具有多个条件的高级搜索
  • 实时漏洞馈送

📊 威胁情报

  • CVSS v3.1/v4.0评分集成
  • 利用可用性检测
  • 补丁状态和修复指南
  • 影响评估和风险评分

🔗 数据源集成

  • 带速率限制的NVD API v2.0
  • MITRE CVE JSON提要
  • GitHub安全咨询API
  • ExploitDB交叉引用
  • 自定义漏洞源

🤖 AI代理集成

  • LLM消费的结构化数据输出
  • 上下文感知漏洞摘要
  • 自动化风险评估报告
  • 与渗透测试工作流程集成

🚀 快速开始

先决条件

# Python 3.9+
python --version

# Install dependencies
pip install -r requirements.txt

安装

# Clone the repository
git clone https://github.com/Cyber-Agents-Fleet/CVE-MCP.git
cd CVE-MCP

# Install in development mode
pip install -e .

# Configure environment
cp .env.example .env
# Edit .env with your API keys

基本用法

# Start the MCP server
python -m cve_mcp.server

# Test with sample queries
python scripts/test_queries.py

📋 api参考

核心MCP工具

search_cve

使用灵活的条件搜索CVE数据库

{
  "name": "search_cve",
  "arguments": {
    "cve_id": "CVE-2024-1234",
    "severity": "HIGH",
    "vendor": "microsoft",
    "product": "windows",
    "limit": 50
  }
}

get_cve_details

检索全面的CVE信息

{
  "name": "get_cve_details",
  "arguments": {
    "cve_id": "CVE-2024-1234",
    "include_exploits": true,
    "include_references": true
  }
}

vulnerability_feed

根据标准获取最新漏洞

{
  "name": "vulnerability_feed",
  "arguments": {
    "days": 7,
    "severity_min": "MEDIUM",
    "with_exploits": true
  }
}

risk_assessment

生成AI友好的风险分析

{
  "name": "risk_assessment",
  "arguments": {
    "cve_list": ["CVE-2024-1234", "CVE-2024-5678"],
    "environment": "enterprise",
    "include_mitigations": true
  }
}

🗂️ 存储库结构

CVE-MCP/
├── src/
│   └── cve_mcp/
│       ├── __init__.py
│       ├── server.py              # Main MCP server
│       ├── handlers/
│       │   ├── __init__.py
│       │   ├── cve_search.py      # CVE search handlers
│       │   ├── nvd_client.py      # NVD API client
│       │   ├── mitre_client.py    # MITRE integration
│       │   └── exploit_db.py      # Exploit database
│       ├── models/
│       │   ├── __init__.py
│       │   ├── cve.py             # CVE data models
│       │   └── vulnerability.py   # Vulnerability schemas
│       └── utils/
│           ├── __init__.py
│           ├── cvss.py            # CVSS calculations
│           ├── cache.py           # Caching utilities
│           └── rate_limiter.py    # API rate limiting
├── tests/
│   ├── __init__.py
│   ├── test_server.py
│   ├── test_handlers.py
│   └── fixtures/
├── scripts/
│   ├── setup_database.py
│   ├── test_queries.py
│   └── data_sync.py
├── docs/
│   ├── API.md
│   ├── DEPLOYMENT.md
│   ├── CONFIGURATION.md
│   └── EXAMPLES.md
├── docker/
│   ├── Dockerfile
│   └── docker-compose.yml
├── .env.example
├── .gitignore
├── requirements.txt
├── setup.py
├── pyproject.toml
└── README.md

⚙️ 配置

环境变量

# API Keys
NVD_API_KEY=your_nvd_api_key
GITHUB_TOKEN=your_github_token

# Database
DATABASE_URL=sqlite:///cve_cache.db
REDIS_URL=redis://localhost:6379

# Rate Limiting
NVD_REQUESTS_PER_SECOND=0.5
GITHUB_REQUESTS_PER_HOUR=5000

# Caching
CACHE_TTL=3600
ENABLE_CACHE=true

数据源配置

# config/sources.yml
data_sources:
  nvd:
    enabled: true
    api_version: "2.0"
    base_url: "https://services.nvd.nist.gov/rest/json/cves/2.0"
    
  mitre:
    enabled: true
    feed_url: "https://cve.mitre.org/data/downloads/allitems.csv"
    
  github:
    enabled: true
    api_url: "https://api.github.com/advisories"
    
  exploitdb:
    enabled: true
    csv_url: "https://gitlab.com/exploit-database/exploitdb/-/raw/main/files_exploits.csv"

🔧 发展

建立开发环境

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run tests
pytest tests/ -v

# Run with coverage
pytest --cov=cve_mcp tests/

运行测试

# Unit tests
pytest tests/unit/

# Integration tests
pytest tests/integration/

# Performance tests
pytest tests/performance/

🐳 Docker部署

Docker快速入门

# Build and run
docker-compose up -d

# View logs
docker-compose logs -f cve-mcp

# Scale for high availability
docker-compose up -d --scale cve-mcp=3

生产部署

# Production build
docker build -f docker/Dockerfile.prod -t cve-mcp:prod .

# Deploy with orchestration
kubectl apply -f k8s/

📚 使用示例

与AI代理集成

from mcp import ClientSession
from cve_mcp.client import CVEMCPClient

# Connect to CVE-MCP server
client = CVEMCPClient("http://localhost:8000")

# Search for recent high-severity CVEs
recent_cves = await client.vulnerability_feed(
    days=30,
    severity_min="HIGH",
    with_exploits=True
)

# Generate risk assessment for AI agent
risk_report = await client.risk_assessment(
    cve_list=[cve["id"] for cve in recent_cves],
    environment="enterprise",
    include_mitigations=True
)

渗透测试工作流程

# Find vulnerabilities for specific target
target_cves = await client.search_cve(
    vendor="microsoft",
    product="exchange",
    severity="CRITICAL"
)

# Check for available exploits
exploitable = [
    cve for cve in target_cves 
    if cve.get("exploit_available")
]

🔒 安全考虑

  • API密钥管理:API凭据的安全存储
  • 速率限制:遵守上游API限制
  • 数据验证:输入净化和验证
  • 访问控制:生产部署的身份验证
  • 审计日志:全面的请求/响应日志记录

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🤝 贡献

请阅读 贡献.md 有关我们的行为准则和提交pull请求流程的详细信息。

📞 支持

  • 电子邮件: support@popdocs.net
  • 文档: https://www.popdocs.net/
  • 问题: GitHub问题

⚠️ 免责声明

此工具仅用于授权的安全测试和研究目的。用户有责任遵守适用的法律法规。


CVE-MCP服务器 - 为AI代理提供漏洞智能