CodeGuard - Detect C++ vulnerability using AI
✨ Features
The MCP Server CodeGuard provides the following AI-powered features:
- Detects standard MISRA C++ violations
- Detects standard CERT C++ violations
- Detects custom rules defined by the user
- Analyzes race conditions, memory leaks, and other resource leaks (e.g., socket, file, etc.)
- Provides code refactoring suggestions to avoid C++ vulnerabilities and improve code quality
🎯 Requirements
- Use Copilot in Agent mode
- VSCode 1.101.1 or higher (latest version recommended)
- For Linux: Ubuntu 20.04 or higher
🧩 Installation
Windows
- Install Python (including PIP) from https://www.python.org/downloads/windows/
- Open the Command Palette (Ctrl+Shift+P), type
LGEDV CodeGuard: Install MCP Server , and select the command.
- Note: If you update to a new version of the CodeGuard extension, please reinstall the MCP server using the steps above to ensure compatibility and access to the latest features.
- The extension will install the MCP server in
C:\Program Files\MCP Server CodeGuard (default).
- A sample configuration file
mcp.json is created at C:\Program Files\MCP Server CodeGuard\.vscode\mcp.json .
- In VSCode, open the folder containing your source code. In the Explorer bar, right-click to create a folder named
.vscode .
- Copy
mcp.json from C:\Program Files\MCP Server CodeGuard\.vscode\mcp.json to the .vscode folder you just created.
- Edit
mcp.json to match your project requirements.
"lgedv": {
"command": "D:\\src\\codefun\\deepl\\mcp_server\\venv\\Scripts\\codeguard.exe",
"args": ["--transport", "stdio"],
"env": {
"src_dir": "\\path\\to\\source_code",
"custom_path": "\\path\\to\\custom_file",
"reset_cache": "true",
"prompt_lang": "vi", // en: english, vi: vietnamese
"report_dir": "\\path\\to\\http_report"
}
}
src_dir : Path to the folder containing C++ files to be analyzed (memory leak, resource leak, race condition).
custom_path : Path to the custom rule file defined by the user, used for the check_custom prompt.
prompt_lang : Select the prompt language (English or Vietnamese). Default is English.
reset_cache : Automatically clean previous analysis cache when starting the MCP server. If set to false, the MCP server will skip files that have already been analyzed.
report_dir : Specifies the directory for HTML reports.

Linux
- Install Python using your package manager (e.g.,
sudo apt install python3 python3-venv python3-pip ).
- Open Command Palette (Ctrl+Shift+P), type
LGEDV CodeGuard: Install MCP Server and select the command.
- Note: If you update to a new version of the CodeGuard extension, please reinstall the MCP server using the steps above to ensure compatibility and access to the latest features.
- The extension will install the MCP server in
~/mcp_server (default).
- A sample configuration file mcp.json is created at
~/mcp_server/.vscode/mcp.json .
- In VSCode, open the folder containing your source code. In the Explorer bar, right-click to create a folder named
.vscode.
- Copy
mcp.json from ~/mcp_server/.vscode/mcp.json to .vscode folder just created.
- Edit mcp.json to match your project requirements.
🌐 MCP Server Usage
For rule-based checks, you must download the rule set before running the check prompt. If the rule set has already been downloaded, you can skip this step.
MCP Server Prompts
View HTTP report
Uninstall MCP Server
- Delete the MCP server installation folder (e.g.,
C:\\Program Files\\MCP Server CodeGuard ) to completely remove it.
| |