MCP-Vul is now the orchestration layer for a thesis system focused on
finding and explaining memory leaks in C/C++ repositories.
It is no longer the active home for general multi-CWE detection. Historical
multi-CWE MVP code has been moved under legacy/multi_cwe_mvp/ for reference,
while the default build, tests, docs, and CLI surface now target memory leak
investigation only.
- Connect to static and dynamic MCP analyzer servers over HTTP or stdio.
- Scan a C/C++ repository for memory leak candidates.
- Expand candidates with static context, LeakGuard findings, and dynamic run evidence when available.
- Cluster related findings into leak bundles.
- Use a judge layer to produce verdicts, explanations, missing evidence, and repair suggestions.
- Emit JSON, Markdown, HTML, and snapshot reports for thesis evaluation.
Run a single repository scan:
mcp-vul-memory-scan /path/to/c-repo \
--limit 500 \
--output results/report.json \
--markdown-output results/report.md \
--html-output results/report.html \
--snapshot-output results/snapshot.jsonRun a corpus manifest:
mcp-vul-memory-batch ../demo/memory_leak_corpus/corpus_manifest.json \
--output-dir ../results/corpusCompare two experiment snapshots:
mcp-vul-memory-compare results/static-only/snapshot.json results/orchestrated/snapshot.jsonRun the web application:
mcp-vul-memory-app --host 127.0.0.1 --port 8090From the thesis workspace root, the same app can run inside Docker with:
docker compose --env-file .env.example -f docker-compose.thesis-demo.yml up --build memory-appThe app exposes:
GET /: workspace selection, progress timeline, and report viewer UIGET /api/workspacesPOST /api/workspaces/validatePOST /api/scansGET /api/scans/{scan_id}GET /api/scans/{scan_id}/eventsGET /api/scans/{scan_id}/report?format=json|markdown|html|snapshotPOST /api/scans/{scan_id}/cancel
Useful app environment variables:
MEMORY_LEAK_APP_WORKSPACE_ROOTS: allowed workspace roots separated by:MEMORY_LEAK_APP_ARTIFACT_DIR: where scan events and reports are storedMCP_STATIC_SERVER_URL: static MCP server URLMCP_DYNAMIC_SERVER_URL: dynamic MCP server URLMEMORY_LEAK_JUDGE_MODE:heuristicorllmMEMORY_LEAK_JUDGE_BATCH_SIZE: number of leak bundles grouped into one LLM judge request whenllm_assistedmode is usedMEMORY_LEAK_JUDGE_SCOPE:selectiveto send only ambiguous bundles to the LLM, orallto force legacy all-bundle judgingMEMORY_LEAK_STATIC_EXPANSION_MODE:minimal,balanced, orfullMEMORY_LEAK_FILE_ANALYSIS_CONCURRENCY: number of files analyzed in parallel during lexical candidate discoveryMEMORY_LEAK_STATIC_TOOL_CONCURRENCY: number of static MCP tools called in parallel for a candidate-bearing file
App scan jobs now run in a dedicated worker process by default. This lets the UI cancel an in-flight orchestration run by terminating the worker process, while still keeping scan events and artifacts on disk. Remote analyzer containers may still need explicit server-side cancellation support if they spawn long-running tool subprocesses after the request has been sent.
Failure responses and failed scan summaries include:
error_codeerror_categoryerrorremediationerror_detail
Preferred deployment uses separate Docker Compose stacks for analyzer servers.
export MCP_STATIC_SERVER_URL="http://localhost:8081/mcp"
export MCP_DYNAMIC_SERVER_URL="http://localhost:8080/mcp"The orchestrator expects memory-leak-oriented tools such as:
repo.index_filesmemory.candidate_scanmemory.ast_scanmemory.function_summarymemory.call_graphmemory.path_constraintsmemory.interprocedural_flowmemory.call_path_summarymemory.leakguard_runmemory.leakguard_get_reportmemory.get_leak_bundles
src/memory_leak/: active memory leak control plane, policy, judge, reporting, snapshots, and batch evaluation runner.src/mcp_protocol/: MCP client/protocol support used by the active control plane.src/llm_client.py: shared LLM client used by the judge.
The historical multi-CWE MVP code is archived under legacy/multi_cwe_mvp/.
It is not part of the default memory-leak build/test surface:
legacy/multi_cwe_mvp/src/legacy/multi_cwe_mvp/tests/legacy/multi_cwe_mvp/experiments/legacy/multi_cwe_mvp/docs/legacy/multi_cwe_mvp/data/legacy/multi_cwe_mvp/results/
This archive can later be moved to a separate repository if thesis comparison material no longer needs to live beside the active implementation.
See docs/MEMORY_LEAK_CONTROL_PLANE.md and docs/MEMORY_LEAK_FEATURE_AUDIT.md.