Semgrep MCP Server
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Provides instructions for running the MCP server in a containerized environment using Docker.
Includes integration references for accessing repositories and issue tracking functionality.
Provides a Python client interface for interacting with the MCP server and executing Semgrep scans programmatically.
[beta] Semgrep MCP Server
MCP Server for using Semgrep to scan code
MCP is like LSP or unix pipes but for LLMs and AI Agents and coding tools such as Cursor.
Features
This MCP Server provides a comprehensive interface to Semgrep through the Model Context Protocol, offering the following tools:
Scanning Code
semgrep_scan
: Scan code snippets for security vulnerabilitiesscan_directory
: Perform Semgrep scan on a directory
Customization
list_rules
: List available Semgrep rules with optional language filteringcreate_rule
: Create custom Semgrep rules
Results
analyze_results
: Analyze scan results including severity counts and top affected filesfilter_results
: Filter scan results by severity, rule ID, file path, etc.export_results
: Export scan results in various formats (JSON, SARIF, text)compare_results
: Compare two scan results to identify new and fixed issues
Installation
- Install
uv
using their installation instructions - Ensure you have Python 3.13+ installed
- Clone this repository
- Install Semgrep (additional methods):Copy
Docker
Usage
Docker
CLI
Additional info on the python mcp sdk
Creating your own client
Cursor Plugin
- Go to Cursor > Settings > Cursor Settings
- Choose the
MCP
tab - Click "Add new MCP server"
- Name:
Semgrep
, Type:sse
, Server URL:http://127.0.0.1:8000/sse
- Ensure the MCP server is enabled
You can also set it up by adding this to ~/.cursor/mcp.json
Advanced Usage
The server supports advanced Semgrep functionality:
Developlment
Running the Development Server
Start the MCP server in development mode:
By default, the server runs on http://localhost:3000
with the inspector server on http://localhost:5173
.
Note: When opening the inspector sever, add query parameters to the url to increase the default timeout of the server from 10s
Community & Related Projects
This project builds upon and is inspired by several awesome community projects:
Core Technologies 🛠️
- Semgrep - The underlying static analysis engine that powers this project
- Model Context Protocol (MCP) - The protocol that enables AI agent communication
Similar Tools 🔍
- semgrep-vscode - Official VSCode extension for Semgrep
- semgrep-intellij - IntelliJ plugin for Semgrep
Community Projects 🌟
- semgrep-rules - The official collection of Semgrep rules
- mcp-server-semgrep - Original inspiration written by Szowesgad and stefanskiasan
You must be authenticated.
An MCP server that provides a comprehensive interface to Semgrep, enabling users to scan code for security vulnerabilities, create custom rules, and analyze scan results through the Model Context Protocol.