Skip to main content

Semgrep Plugin

Semgrep's plugin integrates natively with AI coding agents like Cursor, Claude Code, and Windsurf 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.

This guide covers setup for Cursor, Windsurf, and Claude Code, but the plugin works with any MCP client.

Prerequisites

  • Python 3.10 or later
  • Homebrew or Pip to install Semgrep
  • A Semgrep account

Installation

  1. Install Semgrep:

    # install through homebrew
    brew install semgrep

    # install through pip
    python3 -m pip install semgrep
  2. Verify that you've installed the latest version of Semgrep by running the following:

    semgrep --version
  3. Start a new Claude Code instance in the terminal:

    claude
  4. Open the plugin browser:

    /plugin
  5. Go to Discover, search for Semgrep, and click Install.

  6. Set up the Semgrep plugin by running the following skill. This also installs the Semgrep CLI:

    /setup-semgrep-plugin

Scan your code

  1. Open up your IDE's AI chat window.
  2. Ensure that you're in the correct context to use Semgrep.
  3. Prompt your IDE to scan with Semgrep.

By default, the MCP Server runs all three Semgrep products: Code, Supply Chain, and Secrets.

Additional resources


Not finding what you need in this doc? Ask questions in our Community Slack group, or see Support for other ways to get help.