Semgrep MCP is a submodule under the Semgrep project, located in the semgrep/cli/src/semgrep/mcp directory. It implements the Model Context Protocol (MCP), providing a standardized API interface for LLMs, AI agents, and IDEs, enabling these tools to obtain Semgrep's static analysis capabilities. Semgrep itself is a fast, deterministic static analysis tool that can semantically understand multiple programming languages and comes with over 10,000 rules.
Main capabilities:
- Provides an MCP server supporting both stdio and Streamable HTTP transports.
- Can be integrated by MCP-capable clients such as Claude Code, Cursor, VS Code/Copilot, Windsurf, and Kiro.
- Scans AI-generated code via Semgrep Code, Supply Chain, and Secrets, prompting the agent to regenerate code when security issues are found, until the scan results are clean or the user chooses to ignore them.
- Supports connecting to the Semgrep AppSec Platform, requiring the SEMGREP_APP_TOKEN environment variable to be set.
- Provides Semgrep Guardian, which packages the MCP server, Hooks, and Skills into a single installation for convenient automatic scanning in AI coding agents.
Usage:
- First, install the Semgrep CLI, either via Homebrew (brew install semgrep) or pip (python3 -m pip install semgrep).
- Start the MCP server via the semgrep mcp subcommand, which uses stdio mode by default; to use Streamable HTTP, add the -t streamable-http parameter, which by default listens on 127.0.0.1:8000/mcp.
- It can also be run using a Docker image.
- In Claude Code, search for Semgrep in the plugin marketplace to install it, and run the /setup-semgrep-plugin skill to complete setup.
- In Cursor, search for Semgr in the plugin marketplaceep and add it; it takes effect after restarting.
- In VS Code, add the configuration in the user settings JSON or the workspace .vscode/mcp.json.
- In Windsurf, create ~/.codeium/windsurf/hooks.json and configure the post_write_code hook.
- In Kiro, add the configuration file to .kiro/settings/mcp.json according to the MCP documentation.
Use cases:
- AI coding assistants perform real-time security scanning while generating code, preventing vulnerabilities from entering the codebase.
- Developers integrate static analysis in the IDE for instant feedback.
- Teams use the Semgrep AppSec Platform to centrally manage rules and scan results.
Limitations:
- The project is under active development, and features may change.
- The Semgrep CLI must be installed before use.
- Connecting to the Semgrep AppSec Platform requires generating and configuring a token.
- Some client integrations require manual configuration of JSON files.
- Details such as specific fees, pricing, and platform support scope are not yet provided.