Detect and resolve vulnerabilities, malicious packages, and hardcoded secrets before agent-generated code gets pushed.
Semgrep Guardian integrates natively with Claude Code to catch security issues before they ship. It bundles the Semgrep MCP server and lifecycle hooks into a single install, and scans files the 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.
Note
This project is under active development. We would love your feedback. Join the #mcp community Slack channel!
Get started in under 2 minutes — follow these five steps inside Claude Code.
-
Start a Claude Code instance:
claude -
Open the plugin manager:
/plugin -
Go to Discover, search for Semgrep, and click Install.
-
Tell Claude to load the plugin:
/reload-plugins -
Ask Claude to login to Semgrep to kickoff onboarding:
login to semgrepThis calls into the Guardian MCP server. If Claude has trouble, run
/clearto restart Claude, or exit and reopen it manually.
The Semgrep Guardian is a plugin that installs directly into any AI coding agent. It bundles two components; an MCP server and hooks. We ensure every line of AI-generated code is scanned before it ever reaches a pull request. No more delaying PR's due to vulnerabilities generated by AI.
|
The agent asks Semgrep and Semgrep answers. The MCP server exposes tools to access Semgrep's findings so the agent can call them directly. |
Consistent scanning that your team can rely on. Hooks fire on every file write, ensuring a scan regardless of what the agent does. |
Guardian's hooks run on every file write in every project, since any code the agent writes can carry a vulnerability. To scan it, Guardian talks to Semgrep:
scanner.semgrep.aireceives the files the agent writes or edits (and their previous contents, so only new findings are reported), plus lockfiles and manifests for supply chain scans.semgrep.devhandles login, your account and deployment details, the MCP tools, and downloads of the Guardian binary fromsemgrep.dev/dist/guardian, checked against a signed manifest before it runs.telemetry.semgrep.devreceives OpenTelemetry traces and metrics: hook timings and outcomes, counts and file extensions of what was scanned, plugin and OS versions, and identifiers for this installation and your Semgrep account. It never receives file contents.
To turn telemetry off, add telemetry: false to ~/.semgrep/guardian.yml, or set any of DO_NOT_TRACK, DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, or set SEMGREP_SEND_METRICS=off. Guardian then sends nothing to telemetry.semgrep.dev, and asks the scanner to skip its usage metrics for your scans.
Guardian updates itself in the background at session start. To turn that off, set auto_update: false in ~/.semgrep/guardian.yml or SEMGREP_GUARDIAN_AUTO_UPDATE=0; if Semgrep retires the version you have installed, Guardian stops with an error until you turn auto-update back on.
For specific guidance to roll out Semgrep Guardian via an MDM or via your agent's built-in enterprise security controls, view this detailed documentation to help your security team enforce the standardization of Guardian across all their developers. For more details, this is how you roll it out: Rolling out Semgrep Guardian.


