cybersecurity-mcp-server 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cybersecurity_mcp_server-0.1.0/.gitignore +7 -0
- cybersecurity_mcp_server-0.1.0/PKG-INFO +54 -0
- cybersecurity_mcp_server-0.1.0/README.md +39 -0
- cybersecurity_mcp_server-0.1.0/pyproject.toml +21 -0
- cybersecurity_mcp_server-0.1.0/src/__init__.py +0 -0
- cybersecurity_mcp_server-0.1.0/src/clients/__init__.py +0 -0
- cybersecurity_mcp_server-0.1.0/src/clients/nist.py +49 -0
- cybersecurity_mcp_server-0.1.0/src/server.py +16 -0
- cybersecurity_mcp_server-0.1.0/src/tools/__init__.py +0 -0
- cybersecurity_mcp_server-0.1.0/src/tools/security.py +150 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cybersecurity-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cybersecurity data for AI agents β CVE database, vulnerability search, threat intelligence, exploit info
|
|
5
|
+
Project-URL: Homepage, https://github.com/AiAgentKarl/cybersecurity-mcp-server
|
|
6
|
+
Project-URL: Repository, https://github.com/AiAgentKarl/cybersecurity-mcp-server
|
|
7
|
+
Author: AiAgentKarl
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: cve,cybersecurity,mcp,security,threat-intelligence,vulnerabilities
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: httpx>=0.27.0
|
|
12
|
+
Requires-Dist: mcp>=1.0.0
|
|
13
|
+
Requires-Dist: pydantic>=2.0.0
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Cybersecurity MCP Server π
|
|
17
|
+
|
|
18
|
+
CVE database and vulnerability intelligence for AI agents. Search the NIST National Vulnerability Database, check software security, and stay informed about threats.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- **CVE Search** β Search vulnerabilities by keyword or severity
|
|
23
|
+
- **CVE Details** β Full details including CVSS score, affected products, references
|
|
24
|
+
- **Software Check** β Check any software for known vulnerabilities
|
|
25
|
+
- **CPE Database** β Search products in the Common Platform Enumeration
|
|
26
|
+
- **No API Key** β Uses the free NIST NVD API
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install cybersecurity-mcp-server
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Tools
|
|
35
|
+
|
|
36
|
+
| Tool | Description |
|
|
37
|
+
|------|-------------|
|
|
38
|
+
| `search_vulnerabilities` | Search CVE database by keyword |
|
|
39
|
+
| `get_cve_details` | Get full CVE details by ID |
|
|
40
|
+
| `check_software_vulnerabilities` | Check a software for known CVEs |
|
|
41
|
+
| `search_products` | Search CPE product database |
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
"Are there critical vulnerabilities in Apache Log4j?"
|
|
47
|
+
"Show me CVE-2021-44228 details"
|
|
48
|
+
"Check nginx for known security issues"
|
|
49
|
+
"What are the latest critical CVEs?"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Cybersecurity MCP Server π
|
|
2
|
+
|
|
3
|
+
CVE database and vulnerability intelligence for AI agents. Search the NIST National Vulnerability Database, check software security, and stay informed about threats.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **CVE Search** β Search vulnerabilities by keyword or severity
|
|
8
|
+
- **CVE Details** β Full details including CVSS score, affected products, references
|
|
9
|
+
- **Software Check** β Check any software for known vulnerabilities
|
|
10
|
+
- **CPE Database** β Search products in the Common Platform Enumeration
|
|
11
|
+
- **No API Key** β Uses the free NIST NVD API
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install cybersecurity-mcp-server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Tools
|
|
20
|
+
|
|
21
|
+
| Tool | Description |
|
|
22
|
+
|------|-------------|
|
|
23
|
+
| `search_vulnerabilities` | Search CVE database by keyword |
|
|
24
|
+
| `get_cve_details` | Get full CVE details by ID |
|
|
25
|
+
| `check_software_vulnerabilities` | Check a software for known CVEs |
|
|
26
|
+
| `search_products` | Search CPE product database |
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
"Are there critical vulnerabilities in Apache Log4j?"
|
|
32
|
+
"Show me CVE-2021-44228 details"
|
|
33
|
+
"Check nginx for known security issues"
|
|
34
|
+
"What are the latest critical CVEs?"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cybersecurity-mcp-server"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Cybersecurity data for AI agents β CVE database, vulnerability search, threat intelligence, exploit info"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{name = "AiAgentKarl"}]
|
|
13
|
+
keywords = ["mcp", "cybersecurity", "cve", "vulnerabilities", "security", "threat-intelligence"]
|
|
14
|
+
dependencies = ["mcp>=1.0.0", "httpx>=0.27.0", "pydantic>=2.0.0"]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Homepage = "https://github.com/AiAgentKarl/cybersecurity-mcp-server"
|
|
18
|
+
Repository = "https://github.com/AiAgentKarl/cybersecurity-mcp-server"
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src"]
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""NIST NVD API Client β CVE-Datenbank und Vulnerability-Suche."""
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NistClient:
|
|
7
|
+
"""Async-Client fΓΌr die NIST National Vulnerability Database."""
|
|
8
|
+
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self._client = httpx.AsyncClient(timeout=30.0)
|
|
11
|
+
self._base = "https://services.nvd.nist.gov/rest/json"
|
|
12
|
+
|
|
13
|
+
async def search_cves(
|
|
14
|
+
self, keyword: str = None, cve_id: str = None,
|
|
15
|
+
severity: str = None, limit: int = 10,
|
|
16
|
+
) -> dict:
|
|
17
|
+
"""CVEs suchen ΓΌber die NVD API 2.0."""
|
|
18
|
+
url = f"{self._base}/cves/2.0"
|
|
19
|
+
params = {"resultsPerPage": min(limit, 50)}
|
|
20
|
+
|
|
21
|
+
if cve_id:
|
|
22
|
+
params["cveId"] = cve_id
|
|
23
|
+
if keyword:
|
|
24
|
+
params["keywordSearch"] = keyword
|
|
25
|
+
if severity:
|
|
26
|
+
params["cvssV3Severity"] = severity.upper()
|
|
27
|
+
|
|
28
|
+
resp = await self._client.get(url, params=params)
|
|
29
|
+
resp.raise_for_status()
|
|
30
|
+
return resp.json()
|
|
31
|
+
|
|
32
|
+
async def get_cve(self, cve_id: str) -> dict:
|
|
33
|
+
"""Einzelne CVE-Details abrufen."""
|
|
34
|
+
url = f"{self._base}/cves/2.0"
|
|
35
|
+
params = {"cveId": cve_id}
|
|
36
|
+
resp = await self._client.get(url, params=params)
|
|
37
|
+
resp.raise_for_status()
|
|
38
|
+
return resp.json()
|
|
39
|
+
|
|
40
|
+
async def search_cpes(self, keyword: str, limit: int = 10) -> dict:
|
|
41
|
+
"""CPE (Common Platform Enumeration) suchen β Software/Hardware identifizieren."""
|
|
42
|
+
url = f"{self._base}/cpes/2.0"
|
|
43
|
+
params = {"keywordSearch": keyword, "resultsPerPage": min(limit, 50)}
|
|
44
|
+
resp = await self._client.get(url, params=params)
|
|
45
|
+
resp.raise_for_status()
|
|
46
|
+
return resp.json()
|
|
47
|
+
|
|
48
|
+
async def close(self):
|
|
49
|
+
await self._client.aclose()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Cybersecurity MCP Server β CVE-Datenbank und Vulnerability-Intelligence."""
|
|
2
|
+
|
|
3
|
+
from mcp.server.fastmcp import FastMCP
|
|
4
|
+
from src.tools.security import register_security_tools
|
|
5
|
+
|
|
6
|
+
mcp = FastMCP(
|
|
7
|
+
"Cybersecurity MCP Server",
|
|
8
|
+
instructions="Search CVE vulnerabilities, check software security, browse the NIST National Vulnerability Database. Essential for any agent working with code or infrastructure.",
|
|
9
|
+
)
|
|
10
|
+
register_security_tools(mcp)
|
|
11
|
+
|
|
12
|
+
def main():
|
|
13
|
+
mcp.run(transport="stdio")
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
main()
|
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""Security-Tools β CVE-Suche, Vulnerability-Analyse, Threat Intelligence."""
|
|
2
|
+
|
|
3
|
+
from mcp.server.fastmcp import FastMCP
|
|
4
|
+
from src.clients.nist import NistClient
|
|
5
|
+
|
|
6
|
+
_nist = NistClient()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _parse_cve(item: dict) -> dict:
|
|
10
|
+
"""CVE-Eintrag in lesbares Format umwandeln."""
|
|
11
|
+
cve = item.get("cve", {})
|
|
12
|
+
metrics = cve.get("metrics", {})
|
|
13
|
+
|
|
14
|
+
# CVSS Score extrahieren
|
|
15
|
+
cvss_score = None
|
|
16
|
+
cvss_severity = None
|
|
17
|
+
cvss_vector = None
|
|
18
|
+
|
|
19
|
+
for version in ["cvssMetricV31", "cvssMetricV30", "cvssMetricV2"]:
|
|
20
|
+
if version in metrics and metrics[version]:
|
|
21
|
+
cvss_data = metrics[version][0].get("cvssData", {})
|
|
22
|
+
cvss_score = cvss_data.get("baseScore")
|
|
23
|
+
cvss_severity = cvss_data.get("baseSeverity")
|
|
24
|
+
cvss_vector = cvss_data.get("vectorString")
|
|
25
|
+
break
|
|
26
|
+
|
|
27
|
+
# Beschreibung (englisch bevorzugt)
|
|
28
|
+
descriptions = cve.get("descriptions", [])
|
|
29
|
+
desc = ""
|
|
30
|
+
for d in descriptions:
|
|
31
|
+
if d.get("lang") == "en":
|
|
32
|
+
desc = d.get("value", "")
|
|
33
|
+
break
|
|
34
|
+
|
|
35
|
+
# Betroffene Produkte
|
|
36
|
+
configs = cve.get("configurations", [])
|
|
37
|
+
affected = []
|
|
38
|
+
for config in configs[:3]:
|
|
39
|
+
for node in config.get("nodes", []):
|
|
40
|
+
for match in node.get("cpeMatch", [])[:5]:
|
|
41
|
+
affected.append(match.get("criteria", ""))
|
|
42
|
+
|
|
43
|
+
# Referenzen
|
|
44
|
+
refs = [r.get("url") for r in cve.get("references", [])[:5]]
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
"cve_id": cve.get("id", ""),
|
|
48
|
+
"description": desc[:500],
|
|
49
|
+
"cvss_score": cvss_score,
|
|
50
|
+
"cvss_severity": cvss_severity,
|
|
51
|
+
"cvss_vector": cvss_vector,
|
|
52
|
+
"published": cve.get("published", ""),
|
|
53
|
+
"last_modified": cve.get("lastModified", ""),
|
|
54
|
+
"affected_products": affected[:5],
|
|
55
|
+
"references": refs,
|
|
56
|
+
"status": cve.get("vulnStatus", ""),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def register_security_tools(mcp: FastMCP):
|
|
61
|
+
|
|
62
|
+
@mcp.tool()
|
|
63
|
+
async def search_vulnerabilities(
|
|
64
|
+
keyword: str, severity: str = None, limit: int = 10,
|
|
65
|
+
) -> dict:
|
|
66
|
+
"""CVE-Datenbank nach Schwachstellen durchsuchen.
|
|
67
|
+
|
|
68
|
+
Durchsucht die NIST National Vulnerability Database (NVD).
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
keyword: Suchbegriff (z.B. "Apache Log4j", "OpenSSL", "Windows RDP")
|
|
72
|
+
severity: Optional β "LOW", "MEDIUM", "HIGH", "CRITICAL"
|
|
73
|
+
limit: Maximale Ergebnisse (Standard: 10)
|
|
74
|
+
"""
|
|
75
|
+
data = await _nist.search_cves(keyword=keyword, severity=severity, limit=limit)
|
|
76
|
+
vulnerabilities = data.get("vulnerabilities", [])
|
|
77
|
+
return {
|
|
78
|
+
"query": keyword,
|
|
79
|
+
"total_results": data.get("totalResults", 0),
|
|
80
|
+
"results_count": len(vulnerabilities),
|
|
81
|
+
"vulnerabilities": [_parse_cve(v) for v in vulnerabilities],
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@mcp.tool()
|
|
85
|
+
async def get_cve_details(cve_id: str) -> dict:
|
|
86
|
+
"""Details einer bestimmten CVE abrufen.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
cve_id: CVE-ID (z.B. "CVE-2021-44228" fΓΌr Log4Shell)
|
|
90
|
+
"""
|
|
91
|
+
data = await _nist.get_cve(cve_id)
|
|
92
|
+
vulnerabilities = data.get("vulnerabilities", [])
|
|
93
|
+
if vulnerabilities:
|
|
94
|
+
return _parse_cve(vulnerabilities[0])
|
|
95
|
+
return {"found": False, "cve_id": cve_id}
|
|
96
|
+
|
|
97
|
+
@mcp.tool()
|
|
98
|
+
async def check_software_vulnerabilities(software: str, limit: int = 10) -> dict:
|
|
99
|
+
"""Bekannte Schwachstellen fΓΌr eine Software prΓΌfen.
|
|
100
|
+
|
|
101
|
+
Sucht nach CVEs die eine bestimmte Software betreffen.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
software: Software-Name (z.B. "nginx", "postgresql", "react")
|
|
105
|
+
limit: Maximale Ergebnisse
|
|
106
|
+
"""
|
|
107
|
+
data = await _nist.search_cves(keyword=software, limit=limit)
|
|
108
|
+
vulnerabilities = data.get("vulnerabilities", [])
|
|
109
|
+
parsed = [_parse_cve(v) for v in vulnerabilities]
|
|
110
|
+
|
|
111
|
+
# Nach Schweregrad sortieren
|
|
112
|
+
parsed.sort(key=lambda x: x.get("cvss_score") or 0, reverse=True)
|
|
113
|
+
|
|
114
|
+
critical = sum(1 for v in parsed if (v.get("cvss_score") or 0) >= 9.0)
|
|
115
|
+
high = sum(1 for v in parsed if 7.0 <= (v.get("cvss_score") or 0) < 9.0)
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
"software": software,
|
|
119
|
+
"total_found": data.get("totalResults", 0),
|
|
120
|
+
"critical_count": critical,
|
|
121
|
+
"high_count": high,
|
|
122
|
+
"vulnerabilities": parsed,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@mcp.tool()
|
|
126
|
+
async def search_products(keyword: str, limit: int = 10) -> dict:
|
|
127
|
+
"""Software/Hardware-Produkte in der CPE-Datenbank suchen.
|
|
128
|
+
|
|
129
|
+
CPE (Common Platform Enumeration) identifiziert Produkte eindeutig.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
keyword: Produkt-Name (z.B. "microsoft windows", "apache httpd")
|
|
133
|
+
limit: Maximale Ergebnisse
|
|
134
|
+
"""
|
|
135
|
+
data = await _nist.search_cpes(keyword, limit)
|
|
136
|
+
products = data.get("products", [])
|
|
137
|
+
parsed = []
|
|
138
|
+
for p in products:
|
|
139
|
+
cpe = p.get("cpe", {})
|
|
140
|
+
parsed.append({
|
|
141
|
+
"cpe_name": cpe.get("cpeName", ""),
|
|
142
|
+
"title": cpe.get("titles", [{}])[0].get("title", "") if cpe.get("titles") else "",
|
|
143
|
+
"created": cpe.get("created", ""),
|
|
144
|
+
"deprecated": cpe.get("deprecated", False),
|
|
145
|
+
})
|
|
146
|
+
return {
|
|
147
|
+
"query": keyword,
|
|
148
|
+
"total_results": data.get("totalResults", 0),
|
|
149
|
+
"products": parsed,
|
|
150
|
+
}
|