vulnerability-lookup/VulnMCP
GitHub: vulnerability-lookup/VulnMCP
VulnMCP 是一个基于 FastMCP 的模块化 MCP 服务器,通过集成 NLP 模型和漏洞情报 API,为 AI 代理提供漏洞严重性分类、CWE 预测及已知被利用漏洞(KEV)查询等自动化分析工具。
Stars: 20 | Forks: 1
# VulnMCP
**VulnMCP** 是一个基于 [FastMCP](https://gofastmcp.com/) 构建的 [MCP](https://modelcontextprotocol.io/) 服务器,为 AI 客户端、聊天代理和其他自动化系统提供漏洞管理工具。它提供可轻松扩展或集成的模块化“技能”,从而实现对软件漏洞的智能分析和自动化洞察。
## 功能
* **漏洞严重性分类** -- 使用 CIRCL 的微调 NLP 模型自动评估漏洞的关键程度:
[CIRCL/vulnerability-severity-classification-roberta-base](https://huggingface.co/CIRCL/vulnerability-severity-classification-roberta-base)(英语)、[CIRCL/vulnerability-severity-classification-chinese-macbert-base](https://huggingface.co/CIRCL/vulnerability-severity-classification-chinese-macbert-base)(中文)和 [CIRCL/vulnerability-severity-classification-russian-ruRoberta-large](https://huggingface.co/CIRCL/vulnerability-severity-classification-russian-ruRoberta-large)(俄语)。
* **CWE 分类** -- 使用 [CIRCL/cwe-parent-vulnerability-classification-roberta-base](https://huggingface.co/CIRCL/cwe-parent-vulnerability-classification-roberta-base) 从漏洞描述中预测 CWE 类别。
* **漏洞查询** -- 查询 [Vulnerability Lookup](https://vulnerability.circl.lu) API 以获取特定 CVE 的详细信息,按来源、CWE、产品或日期搜索漏洞,查找社区评论,并发现精选的漏洞集合。
* **KEV 目录** -- 浏览和过滤已知被利用漏洞(KEV)条目,检查 CVE 是否出现在 KEV 目录中,查找最近添加的条目,并按目录来源(CISA KEV、CIRCL、EUVD KEV)进行过滤。
* **GCVE 注册表** -- 查询 [GCVE](https://gcve.eu) 全球编号机构(GNA)注册表和引用,以发现漏洞分配器和 KEV 目录标识符。
* **模块化架构** -- 轻松添加新技能或工具以扩展 MCP 服务器的功能。
## 安装
需要 Python 3.10+ 和 [Poetry](https://python-poetry.org/) v2+。
```
git clone https://github.com/vulnerability-lookup/VulnMCP.git
cd VulnMCP
poetry install
```
## 运行 MCP 服务器
### stdio(默认)
默认传输方式,被大多数 MCP 客户端(Claude Code、Claude Desktop 等)使用:
```
poetry run vulnmcp
```
### HTTP 传输
用于网络访问或多个并发客户端:
```
poetry run fastmcp run vulnmcp/server.py --transport http --host 127.0.0.1 --port 9000
```
## 可用工具
| 工具 | 描述 |
|------|-------------|
| `classify_severity` | 根据文本描述对漏洞严重性(低/中/高/严重)进行分类。支持英语、中文和俄语,并具有自动检测功能。 |
| `classify_cwe` | 根据漏洞描述预测 CWE 类别。返回前 5 个预测结果及父级 CWE 映射。 |
| `get_recent_vulnerabilities_by_cwe` | 获取给定 CWE ID 的 3 个最新 CVE。 |
| `get_vulnerability` | 按 ID(例如 CVE-2025-14847)查找特定漏洞,可选包含评论、目击记录、集合、关联漏洞和 KEV 丰富信息。 |
| `search_vulnerabilities` | 使用过滤器搜索漏洞:来源、CWE、产品、日期范围、分页,以及可选的 KEV 感知优先级排序。 |
| `search_sightings` | 使用过滤器搜索漏洞目击记录(已发现/被利用/已修补/等),以识别正在被积极讨论或滥用的情况。 |
| `create_sighting` | 为漏洞创建新的目击记录(在大多数实例上需要 API 权限)。 |
| `get_most_sighted_vulnerabilities` | 按目击活动检索漏洞排名,以帮助确定重要问题的优先级。 |
| `search_comments` | 搜索与漏洞相关的社区评论,可按漏洞 ID 或作者过滤。 |
| `search_bundles` | 搜索精选的漏洞集合(针对活动、产品或事件分组的 CVE),可按漏洞 ID 或作者过滤。 |
| `list_kev_entries` | 按漏洞 ID、状态原因、被利用标志、日期范围、作者或来源目录 UUID 列出并过滤 KEV 目录条目。 |
| `guess_cpes` | 使用产品关键字查询 cpe-guesser 以推断可能的 CPE 标识符。 |
| `list_gna_entries` | 列出来自 GCVE 注册表的所有全球编号机构(GNA)。 |
| `get_gna_entry` | 通过数字 ID 或确切的短名称获取特定的 GNA 条目。 |
| `search_gna` | 按名称搜索 GNA 条目(不区分大小写的子字符串匹配)。 |
| `list_gcve_references` | 列出 GCVE 引用,包括用于 `list_kev_entries` 的 KEV 目录 UUID。 |
列出所有工具:
```
poetry run fastmcp list vulnmcp/server.py
```
## 从命令行测试工具
使用 `fastmcp call` 直接调用任何工具:
```
# 查找特定 CVE
poetry run fastmcp call vulnmcp/server.py get_vulnerability vulnerability_id=CVE-2025-14847
# 搜索最近的 SQL 注入漏洞
poetry run fastmcp call vulnmcp/server.py search_vulnerabilities cwe=CWE-89 per_page=5
# 检索最常见的漏洞
poetry run fastmcp call vulnmcp/server.py get_most_sighted_vulnerabilities limit=5
# 搜索特定 CVE 的评论
poetry run fastmcp call vulnmcp/server.py search_comments vuln_id=CVE-2024-3094
# 搜索与 CVE 相关的 bundles
poetry run fastmcp call vulnmcp/server.py search_bundles vuln_id=CVE-2024-3094
# 检查 CVE 是否在 KEV 目录中
poetry run fastmcp call vulnmcp/server.py list_kev_entries vuln_id=CVE-2021-44228
# 列出上周的最近 KEV 条目
poetry run fastmcp call vulnmcp/server.py list_kev_entries date_from=2026-03-18 per_page=5
# 仅列出 CISA KEV 目录中的 KEV 条目
poetry run fastmcp call vulnmcp/server.py list_kev_entries vulnerability_lookup_origin=405284c2-e461-4670-8979-7fd2c9755a60 per_page=5
# 根据产品关键词推测可能的 CPE 值
poetry run fastmcp call vulnmcp/server.py guess_cpes query='["outlook","connector"]'
# 列出 GCVE 注册表中的所有 GNA 条目
poetry run fastmcp call vulnmcp/server.py list_gna_entries
# 通过简称查找特定 GNA
poetry run fastmcp call vulnmcp/server.py get_gna_entry short_name=CIRCL
# 搜索 GNA 条目
poetry run fastmcp call vulnmcp/server.py search_gna query=cert
# 列出 GCVE 参考(包括 KEV 目录 UUID)
poetry run fastmcp call vulnmcp/server.py list_gcve_references
# 根据描述分类严重性
poetry run fastmcp call vulnmcp/server.py classify_severity \
description="A remote code execution vulnerability allows an attacker to execute arbitrary code via a crafted JNDI lookup."
# 根据描述分类 CWE
poetry run fastmcp call vulnmcp/server.py classify_cwe \
description="Fix buffer overflow in authentication handler"
```
## 连接到 Claude Code
在 Claude Code 中将 VulnMCP 注册为 MCP 服务器:
```
claude mcp add vulnmcp -- poetry --directory /path/to/VulnMCP run vulnmcp
```
或使用 `fastmcp install`:
```
poetry run fastmcp install claude-code vulnmcp/server.py --name VulnMCP
```
注册后,Claude Code 即可使用这些工具。您可以通过以下命令进行验证:
```
claude mcp list
```
## 配置
| 环境变量 | 描述 | 默认值 |
|---------------------|-------------|---------|
| `VULNMCP_LOOKUP_URL` | Vulnerability Lookup API 的基础 URL | `https://vulnerability.circl.lu` |
| `VULNMCP_CPE_GUESSER_URL` | cpe-guesser API 的基础 URL | `https://cpe-guesser.cve-search.org` |
| `VULNMCP_API_KEY` | 用于身份验证操作(例如创建目击记录)的 API 密钥 | _(未设置)_ |
## 贡献
在提交 pull request 之前,请阅读 [CONTRIBUTING.md](./CONTRIBUTING.md)。
## 许可证
[AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.html)
标签:API集成, CISA KEV, CVE查询, CWE分类, EUVD KEV, GCVE注册表, GPT, KEV目录, MacBERT, MCP服务器, RoBERTa, Vulnerability Lookup, 人工智能, 可观测性, 多语言支持, 威胁情报, 安全测试框架, 已知利用漏洞, 开发者工具, 模型上下文协议, 漏洞分级, 漏洞管理, 用户模式Hook绕过, 结构化查询, 网络安全, 自动化安全, 逆向工具, 隐私保护