Skip to content

Commit 0680be3

Browse files
author
mrachidi
committed
unit test fixes and logo
1 parent b066a86 commit 0680be3

13 files changed

+52
-6
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<p align="center">
2+
<img src="logo.png" alt="Vibe tester Logo" width="270"/>
3+
</p>
4+
5+
16
# MCP Vulnerability Checker Server
27

38
A modular Model Context Protocol (MCP) server providing comprehensive security vulnerability intelligence tools including CVE lookup, EPSS scoring, CVSS calculation, exploit detection, and Python package vulnerability checking.

logo.png

1.27 MB
Loading

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,19 @@ ignore = []
4646
line-length = 88
4747
target-version = "py310"
4848

49+
[tool.pytest.ini_options]
50+
asyncio_mode = "auto"
51+
asyncio_default_fixture_loop_scope = "function"
52+
testpaths = ["tests"]
53+
python_files = ["test_*.py"]
54+
python_classes = ["Test*"]
55+
python_functions = ["test_*"]
56+
addopts = ["-v", "--tb=short", "--strict-markers"]
57+
markers = [
58+
"asyncio: marks tests as async (defers to pytest-asyncio)",
59+
"integration: marks tests as integration tests",
60+
"unit: marks tests as unit tests"
61+
]
62+
4963
[tool.uv]
5064
dev-dependencies = ["pyright>=1.1.378", "pytest>=8.3.3", "ruff>=0.6.9", "pytest-asyncio>=0.23.5"]

tests/test_all_tools.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/usr/bin/env python3
2-
"""Comprehensive test script for all vulnerability intelligence tools"""
2+
"""
3+
Comprehensive test suite for all vulnerability intelligence tools
4+
Tests the complete MCP server toolkit with real data
5+
"""
36

47
import asyncio
8+
import pytest
59
import sys
610
from pathlib import Path
711

@@ -15,9 +19,15 @@
1519
from mcp_simple_tool.tools.exploit_availability import get_exploit_availability
1620
from mcp_simple_tool.tools.vulnerability_timeline import get_vulnerability_timeline
1721
from mcp_simple_tool.tools.vex_status import get_vex_status
22+
from mcp_simple_tool.tools.package_vulnerability import check_package_vulnerabilities
1823

24+
25+
@pytest.mark.asyncio
1926
async def test_all_tools():
20-
"""Test all vulnerability intelligence tools with Log4Shell CVE"""
27+
"""
28+
Comprehensive test of all vulnerability intelligence tools.
29+
Tests with CVE-2021-44228 (Log4Shell) - a well-documented critical vulnerability.
30+
"""
2131

2232
cve_id = "CVE-2021-44228" # Log4Shell - well-known vulnerability
2333
print(f"🔍 **Comprehensive Vulnerability Intelligence Report for {cve_id}**\n")

tests/test_cvss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Test script for CVSS calculator tool"""
33

44
import asyncio
5+
import pytest
56
import sys
67
from pathlib import Path
78

@@ -10,8 +11,9 @@
1011

1112
from mcp_simple_tool.tools.cvss_calculator import calculate_cvss_score
1213

14+
@pytest.mark.asyncio
1315
async def test_cvss():
14-
"""Test the CVSS calculator with different vector strings"""
16+
"""Test the CVSS calculator tool with different vector strings"""
1517
# Test cases with different severity levels
1618
test_vectors = [
1719
("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "Critical - Network accessible, no privileges"),

tests/test_epss.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Test script for EPSS lookup tool"""
33

44
import asyncio
5+
import pytest
56
import sys
67
from pathlib import Path
78

@@ -10,6 +11,7 @@
1011

1112
from mcp_simple_tool.tools.epss_lookup import get_epss_score
1213

14+
@pytest.mark.asyncio
1315
async def test_epss():
1416
"""Test the EPSS tool with Log4Shell CVE"""
1517
print("Testing EPSS tool with CVE-2021-44228 (Log4Shell)...")

tests/test_exploit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Test script for exploit availability tool"""
33

44
import asyncio
5+
import pytest
56
import sys
67
from pathlib import Path
78

@@ -10,8 +11,9 @@
1011

1112
from mcp_simple_tool.tools.exploit_availability import get_exploit_availability
1213

14+
@pytest.mark.asyncio
1315
async def test_exploit():
14-
"""Test the exploit availability tool with a well-known CVE"""
16+
"""Test the exploit availability checker tool"""
1517
print("Testing exploit availability checker with CVE-2021-44228 (Log4Shell)...")
1618
result = await get_exploit_availability('CVE-2021-44228')
1719
print("\n" + "="*60)

tests/test_modular_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
import asyncio
7+
import pytest
78
import sys
89
import os
910

@@ -23,6 +24,7 @@
2324
)
2425

2526

27+
@pytest.mark.asyncio
2628
async def test_imports():
2729
"""Test that all imports work correctly."""
2830

tests/test_package_vulnerability.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44
"""
55

66
import asyncio
7+
import pytest
78
import sys
89
import os
10+
from pathlib import Path
911

1012
# Add parent directory to path so we can import mcp_simple_tool
11-
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13+
sys.path.append(str(Path(__file__).parent.parent))
1214

1315
from mcp_simple_tool.tools.package_vulnerability import check_package_vulnerabilities
1416

1517

18+
@pytest.mark.asyncio
1619
async def test_package_vulnerability():
1720
"""Test the package vulnerability checking functionality."""
1821

tests/test_search.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Test script for vulnerability search tool"""
33

44
import asyncio
5+
import pytest
56
import sys
67
from pathlib import Path
78

@@ -10,6 +11,7 @@
1011

1112
from mcp_simple_tool.tools.vulnerability_search import search_vulnerabilities
1213

14+
@pytest.mark.asyncio
1315
async def test_search():
1416
"""Test the vulnerability search tool with different parameters"""
1517

0 commit comments

Comments
 (0)