Scan code for security vulnerabilities using Semgrep
Get detailed explanation of a Semgrep finding
List available Semgrep rules for a specific language
Semgrep Code Scanner provides real-time security scanning for your code using Semgrep's powerful static analysis engine. It semantically understands code across multiple languages and can identify security vulnerabilities, bugs, and code quality issues directly in your development environment. With access to over 5,000 pre-built rules covering common security vulnerabilities, this MCP helps developers catch issues early in the development process. The scanner integrates seamlessly with your coding workflow through the Model Context Protocol, allowing AI assistants to provide security insights without disrupting your development process.
Semgrep Code Scanner is a Model Context Protocol (MCP) server that brings Semgrep's powerful static analysis capabilities directly into your development environment. It allows you to scan your code for security vulnerabilities, bugs, and code quality issues in real-time.
You have several ways to install and use the Semgrep MCP:
The simplest way to install is using UV:
uvx semgrep-mcp
You can run the Semgrep MCP server using Docker:
docker run -i --rm ghcr.io/semgrep/mcp -t stdio
Semgrep provides a hosted version of the MCP server at https://mcp.semgrep.ai/sse
.
To configure your MCP client (like VS Code with GitHub Copilot, Cursor, etc.), add the appropriate configuration:
For UV installation:
{
"command": "uvx",
"args": ["semgrep-mcp"]
}
For Docker installation:
{
"command": "docker",
"args": ["run", "-i", "--rm", "ghcr.io/semgrep/mcp", "-t", "stdio"]
}
For the hosted service:
{
"type": "sse",
"url": "https://mcp.semgrep.ai/sse"
}
Once installed, you can interact with Semgrep through your MCP-compatible client. Here are some example prompts:
The Semgrep MCP will analyze your code and provide detailed feedback about any issues it finds, including:
Semgrep supports scanning across multiple languages including Python, JavaScript, TypeScript, Java, Go, C, C++, and many others. The MCP automatically detects the language of your code and applies the appropriate rules.
You can also specify particular rule sets or categories of vulnerabilities you're interested in checking for in your prompts.
If you encounter any issues or have questions about using the Semgrep MCP: