CVE MCP Server

CVE MCP Server

Provides conversational access to a local CVE (Common Vulnerabilities and Exposures) database, enabling natural language queries to search vulnerabilities, retrieve detailed CVE information, and view security statistics.

Category
访问服务器

README

CVE MCP Server (Prototype)

A local, containerized Model Context Protocol (MCP) server that provides conversational access to a CVE (Common Vulnerabilities and Exposures) database.

PROTOTYPE: This is a project demonstrating MCP server implementation. It is functional but not production-ready.

Overview

This project enables natural-language queries against a local CVE database using any MCP-compatible client. All data is stored locally for privacy and can be refreshed from public CVE sources.

Features

  • Fully Local: All data stored on your machine (stdio transport only)
  • Refreshable: Update CVE data from GitHub CVE database
  • Containerized: Runs in Docker for portability
  • MCP Compatible: Works with MCP Inspector and other MCP clients
  • Three Tools:
    • get_cve_details: Retrieve detailed CVE information by ID
    • search_cves: Search vulnerabilities by keyword
    • get_statistics: View database metadata and counts

Prerequisites

  • Docker (with docker compose support)
  • Python 3.11+ (for local development)
  • Node.js 18+ (for MCP Inspector)

Quick Start with Docker

1. Clone the Repository

git clone https://github.com/yourusername/cve-mcp-server.git
cd cve-mcp-server

2. Build Docker Image

docker build -t cve-mcp-server .

3. Load CVE Data

./scripts/docker_load_data.sh

This downloads ~100 recent CVEs from GitHub (takes 1-2 minutes).

4. Start Container

docker compose up -d

Verify it's running:

docker ps

5. Test with MCP Inspector

npx @modelcontextprotocol/inspector

In the Inspector UI, configure:

  • Command: docker
  • Arguments: exec -i cve-mcp-server python -m src.mcp_server
  • Environment Variables (expand section):
    • Name: PYTHONPATH
    • Value: /app

Click Connect and test the tools!

Local Development (Without Docker)

1. Setup Python Environment

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

2. Load CVE Data

python -m src.data_ingestion.loader --year 2024 --limit 100

3. Run MCP Server

python -m src.mcp_server

The server will wait for MCP client connections via stdio.

4. Test Locally with MCP Inspector

In a new terminal, start MCP Inspector:

cd ~/workspace/projects/cve-mcp-server
source venv/bin/activate
npx @modelcontextprotocol/inspector

Configure connection:

  • Command: python
  • Arguments: -m src.mcp_server
  • Environment Variables:
    • Name: PYTHONPATH
    • Value: /home/yourusername/workspace/projects/cve-mcp-server

Click Connect and test!

5. Run Unit Tests

# Test database operations
python tests/test_database.py

# Test MCP tools directly
python tests/test_tools.py

Available MCP Tools

get_cve_details

Get detailed information about a specific CVE.

Parameters:

  • cve_id (string, required): CVE identifier (e.g., "CVE-2024-0001")

Example Request:

{
  "cve_id": "CVE-2024-0001"
}

Example Response:

{
  "cve_id": "CVE-2024-0001",
  "description": "A critical vulnerability in Apache HTTP Server...",
  "severity": "CRITICAL",
  "cvss_score": 9.8,
  "published_date": "2024-01-15",
  "modified_date": "2024-01-20",
  "references": ["https://..."]
}

search_cves

Search for CVEs by keyword in descriptions.

Parameters:

  • keyword (string, required): Search term
  • limit (integer, optional): Max results (default: 10, max: 50)

Example Request:

{
  "keyword": "remote code execution",
  "limit": 10
}

Example Response:

{
  "query": "remote code execution",
  "count": 5,
  "results": [
    {
      "cve_id": "CVE-2024-0015",
      "severity": "HIGH",
      "cvss_score": 8.5,
      "description": "Remote code execution...",
      "published_date": "2024-01-10"
    }
  ]
}

get_statistics

Get database statistics and metadata.

Parameters: None

Example Response:

{
  "database_info": {
    "total_cves": 95,
    "date_range": {
      "oldest": "2024-01-05",
      "newest": "2024-02-15"
    },
    "last_update": "2025-01-18T14:32:00.123456"
  }
}

Data Management

Load More CVE Data (Docker)

# Load 500 CVEs from 2024
docker exec cve-mcp-server python -m src.data_ingestion.loader --year 2024 --limit 500

# Load from different year
docker exec cve-mcp-server python -m src.data_ingestion.loader --year 2023 --limit 200

Load More CVE Data (Local)

python -m src.data_ingestion.loader --year 2024 --limit 500

Check Database Status

# Using Docker
docker exec cve-mcp-server python -c "
import sys
sys.path.insert(0, '/app')
from src.database.db import init_db, get_stats
print(get_stats(init_db()))
"

# Using local Python
python -c "
import sys
from pathlib import Path
sys.path.insert(0, str(Path.cwd() / 'src'))
from database.db import init_db, get_stats
print(get_stats(init_db()))
"

Project Structure

cve-mcp-server/
├── src/
│   ├── mcp_server/           # MCP server implementation
│   │   ├── server.py         # Server and tool definitions
│   │   ├── tools.py          # Tool implementation logic
│   │   └── __main__.py       # Entry point
│   ├── database/             # Database layer
│   │   └── db.py             # SQLite schema and queries
│   └── data_ingestion/       # CVE data pipeline
│       └── loader.py         # GitHub CVE fetcher/parser
├── data/                     # SQLite database (Docker volume)
├── tests/                    # Unit tests
│   ├── test_database.py      # Database operation tests
│   └── test_tools.py         # Tool logic tests
├── scripts/                  # Utility scripts
│   └── docker_load_data.sh   # Load CVE data into container
├── Dockerfile                # Container image definition
├── docker-compose.yml        # Container orchestration
├── requirements.txt          # Python dependencies
└── README.md                 # This file

Technologies Used

  • Python 3.11: Core language
  • MCP SDK: Model Context Protocol implementation
  • SQLite: Local database with full-text search capability
  • Docker: Containerization and deployment
  • GitHub CVE Database: Data source (CVEProject/cvelistV5)

Testing

Manual Testing with MCP Inspector

MCP Inspector provides an interactive UI to test all tools:

  1. Start the server (Docker or local)
  2. Run npx @modelcontextprotocol/inspector
  3. Configure connection (see Quick Start sections above)
  4. Test each tool with various inputs

Automated Testing

# Database operations
python tests/test_database.py

# Tool implementations
python tests/test_tools.py

Troubleshooting

Docker Issues

Container won't start:

docker logs cve-mcp-server
docker compose down
docker compose up -d

No CVE data loaded:

./scripts/docker_load_data.sh

Rebuild after code changes:

docker compose down
docker build -t cve-mcp-server .
docker compose up -d

MCP Inspector Connection Issues

Connection fails:

  • Verify container is running: docker ps
  • Check exact command: docker exec -i cve-mcp-server python -m src.mcp_server
  • Ensure container name matches: cve-mcp-server

Tools not appearing:

  • Check server logs for import errors
  • Verify PYTHONPATH is set correctly

Local Development Issues

Import errors:

  • Ensure virtual environment is activated
  • Check PYTHONPATH includes project root
  • Verify all dependencies installed: pip install -r requirements.txt

Database not found:

  • Check data/cve.db exists
  • Run data loader: python -m src.data_ingestion.loader

Limitations (Prototype Status)

  • Local only: Uses stdio transport, not accessible over network
  • Basic search: Simple keyword matching, no advanced filtering
  • Small dataset: Prototype loads ~100-500 CVEs (full dataset is 240K+)
  • No authentication: Local use only, no access controls
  • Manual refresh: CVE data updates require manual script execution

TODO / Future Enhancements

High Priority

  • [ ] Network Access: Implement SSE transport to expose tools over HTTP/network
  • [ ] Full-Text Search: Add SQLite FTS5 for better search performance
  • [ ] Complete Dataset: Load and index all 240K+ CVEs
  • [ ] Advanced Filtering: Support filtering by CVSS score, severity, date ranges, affected products

Medium Priority

  • [ ] Automated Refresh: Scheduled cron job to update CVE data daily/weekly
  • [ ] Example Client: Build Streamlit + LM Studio/Ollama conversational UI
  • [ ] REST API Wrapper: HTTP API for non-MCP clients
  • [ ] CVE Monitoring: Track specific CVEs and alert on updates

Low Priority

  • [ ] Export Functionality: Generate PDF/CSV reports
  • [ ] Statistics Dashboard: Visualize CVE trends over time
  • [ ] Multi-user Support: Authentication and user isolation
  • [ ] Performance Optimization: Caching, query optimization for large datasets

Contributing

This is a prototype project.

Contributions welcome:

  • Bug fixes
  • Documentation improvements
  • Feature implementations from TODO list
  • Additional test coverage

License

MIT License - See LICENSE file for details

Acknowledgments

Note: This is a prototype project. For production use, consider implementing the TODO items, especially network security, authentication, and comprehensive error handling.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选