| name | mcpnuke-extend-dvmcp |
| description | Add new DVMCP challenge test classes to mcpnuke's test suite following the established pattern. Use when adding tests for a new vulnerability type or DVMCP challenge. |
Extend mcpnuke DVMCP Tests
Test File
All DVMCP tests live in tests/test_dvmcp.py.
Existing Structure
def _make(tools, url=..., resources=None, prompts=None) -> TargetResult
def _checks_found(result) -> set[str]
def _severities(result) -> set[str]
class TestDVMCPChallenge1PromptInjection:
class TestDVMCPChallenge2ToolPoisoning:
class TestDVMCPChallenge3Permissions:
class TestDVMCPChallenge4RugPull:
class TestDVMCPChallenge5TokenTheft:
class TestDVMCPChallenge6CodeExecution:
class TestDVMCPChallenge7RemoteAccess:
class TestDVMCPChallenge8RateLimitAndLeakage:
class TestDVMCPChallenge9SupplyChain:
class TestDVMCPChallenge10MultiVector:
class TestDVMCPFullPipeline:
class TestDVMCPLive:
Adding a New Challenge Class
Template
class TestDVMCPChallengeNYourCheck:
"""DVMCP Challenge N: description."""
def test_positive_case(self):
"""Tool with vuln pattern should be flagged."""
r = _make([{
"name": "vuln_tool",
"description": "Description containing vulnerable pattern",
"inputSchema": {"properties": {}},
}])
check_your_check(r)
assert "your_check" in _checks_found(r)
assert "EXPECTED_SEVERITY" in _severities(r)
def test_variant(self):
"""Different variant of the same vuln class."""
r = _make([{
"name": "another_tool",
"description": "Different trigger pattern",
"inputSchema": {"properties": {"param": {"type": "string"}}},
}])
check_your_check(r)
assert "your_check" in _checks_found(r)
def test_clean_tool_not_flagged(self):
"""Clean tool should not trigger this check."""
r = _make([{
"name": "safe_tool",
"description": "Completely benign tool",
"inputSchema": {"properties": {}},
}])
check_your_check(r)
assert "your_check" not in _checks_found(r)
Guidelines
- Import your check at the top of the file with the other imports
- 3-5 tests per class — positive cases, variants, and one clean/negative case
- Use
_make() helper, not raw TargetResult construction
- Assert both check name and severity
- Test data should be realistic — mirror what a real MCP server might expose
Adding Live Tests
Add a parametrized port to TestDVMCPLive if adding a new challenge server:
DVMCP_PORTS = list(range(9001, 9011))
Run
uv run pytest tests/test_dvmcp.py -v