Skip to main content
Semgrep Guardian integrates natively with AI coding agents like Claude Code and Cursor to catch security issues before they ship. It bundles the Semgrep MCP server, Hooks, and Skills into a single install, and scans every file an agent generates using Semgrep Code, Supply Chain, and Secrets. When findings are detected, the agent is prompted to regenerate code until Semgrep returns clean results or you choose to dismiss them. The plugin uses each IDE’s native hook or MCP system: This guide covers setup for each of the preceding products listed, but the plugin works with any MCP client.

Prerequisites

  • A Semgrep account

Connect to your IDE

Claude Code uses Semgrep’s hosted remote server by default, so you don’t need to install the Semgrep CLI locally.
1
Start a Claude Code instance:
claude
2
Open the plugin manager:
/plugin
3
Go to Discover, search for Semgrep, and click Install.
4
Tell Claude to load the plugin:
/reload-plugins
5
Start a new session in Claude to begin the Semgrep login flow:
/clear
The plugin registers a post-tool hook so Claude Code scans every file it writes. Learn more about Claude Code plugins and hooks.
The remote server is the recommended default. If you need to run Semgrep locally instead, you can install the local plugin from the semgrep/guardian-local repo.
2
Start a Claude Code instance:
claude
3
Add the Semgrep marketplace:
/plugin marketplace add semgrep/guardian-local
4
Install the plugin from the marketplace:
/plugin install semgrep@semgrep-marketplace
5
Tell Claude to load the plugin:
/reload-plugins
6
Set up the plugin:
/setup-semgrep-plugin

Install the Semgrep CLI

Every IDE except Claude Code runs Semgrep from a locally installed CLI. (Claude Code uses Semgrep’s hosted remote server by default and doesn’t need a local CLI.)
1
Install the Semgrep CLI using Homebrew, pipx, or uv. This requires Python 3.10 or later (the Semgrep CLI needs it at runtime regardless of how it was installed):
# install using Homebrew
brew install semgrep

# or, install using pipx (https://pipx.pypa.io/stable/how-to/install-pipx/)
pipx install semgrep

# or, install using uv (https://docs.astral.sh/uv/)
uv tool install semgrep
2
Verify that you’ve installed the latest version of Semgrep:
semgrep --version
3
Sign in to your Semgrep account and install the Semgrep Pro engine:
semgrep login && semgrep install-semgrep-pro
semgrep login launches a browser window. You can also use the activation link printed in the terminal.

Additional resources