PlugWiki

Semgrep MCP Server: Setup for Claude, Cursor and Other Apps

OfficialLocal
GetPyPIsemgrepsemgrep/semgrepDocs

Lets your coding assistant scan code and dependencies for security problems with Semgrep and read your Semgrep findings.

This is Semgrep's own server. It lets your assistant scan files for security bugs, check your dependencies for known vulnerabilities and test custom rules. Scans run on your computer through the Semgrep program, and the dependency check needs Semgrep's Pro Engine.

You start it with the semgrep mcp command that comes with Semgrep, so install Semgrep first. A Semgrep login is only needed for the dependency check and for reading your saved findings from Semgrep AppSec Platform. The older semgrep-mcp package is deprecated and no longer a working server.

Good for

  • Developers who want the assistant to check code it writes for security bugs
  • Security engineers who triage Semgrep findings with an assistant
  • Rule authors who draft and test custom Semgrep rules

Works in

12 should work

Tap an app to see how to set it up and any known problems.

Install Semgrep MCP

Claude Code

  1. 1

    Copy this prompt.

    Add the Semgrep MCP server to Claude Code. Run this command:
    
    claude mcp add semgrep -- semgrep mcp
    
    Then check that it loaded and tell me if I need to sign in or restart.
  2. 2

    Paste it into Claude Code. It shows the change and asks before running it.

Requires Semgrep CLI (brew install semgrep or pip install semgrep).

Install Semgrep first, as the README shows. Add SEMGREP_APP_TOKEN only to read your Semgrep findings. The dependency check also needs semgrep login and semgrep install-semgrep-pro. The plugin route uses Semgrep's hosted server and OAuth, needs no local CLI, and exposes a different tool set (remote scan instead of local scan).

Built from the package data we hold. Not yet tested by us.

Tools

  • Scans your code files for security problems

    Runs Semgrep on files you name, which must be absolute paths inside your open project. It returns each finding with its file, line and rule. Files outside the project are refused unless you turn that on.

    Try: “Scan the files I just changed for security bugs.”

    Runs code · semgrep_scan

  • Checks your project's dependencies for known vulnerabilities

    Scans the open project's lockfiles for risky third-party packages. It needs Semgrep's Pro Engine running in the background, so it fails with a clear error if that is not set up.

    Try: “I just added a dependency. Check the project for vulnerable packages.”

    Runs code · semgrep_scan_supply_chain

  • Lists the findings already in your Semgrep account

    Pulls findings from past scans stored in Semgrep AppSec Platform. You can filter by repo, status, severity, confidence and Semgrep's own true or false positive verdict. It does not scan anything new.

    Try: “List the open critical findings for this repo and suggest fixes.”

    Network · semgrep_findings

  • Tests a rule you wrote against code

    Takes code and a Semgrep rule in YAML, copies them to a temporary folder, scans and returns the matches. Use it to try out a rule for a bug pattern the default rules miss.

    Try: “Run this rule against my handler code and show what it matches.”

    Runs code · semgrep_scan_with_custom_rule

  • Shows how Semgrep parses a piece of code

    Parses the code you pass in the language you name and returns its syntax tree as JSON. It helps when you are writing a rule and need to see the shape Semgrep matches on.

    Try: “Show me the syntax tree for this function so I can write a rule.”

    Runs code · get_abstract_syntax_tree

  • Fetches the format Semgrep rules must follow

    Downloads the current rule schema from Semgrep. The assistant uses it so the rules it writes are valid.

    Try: “What fields can a Semgrep rule have?”

    Network · semgrep_rule_schema

  • Lists the languages Semgrep can scan

    Asks the Semgrep program which languages it supports and returns the list. It is only for when the assistant is unsure.

    Try: “Does Semgrep support Kotlin?”

    Runs code · get_supported_languages

Read from the source code

Permissions

low risk · 4 things to watch

Low risk

The tools read your project files and Semgrep account data and write nothing except short-lived temporary files. Keep scans to the open project and treat any Semgrep token as a secret.

What it can do

  • Read your data
  • Create and change things
  • Delete things
  • Read-only mode

Watch out for

  • Scans read files in your open project

    Scan tools accept only absolute paths inside the workspace and refuse files outside it. Setting SEMGREP_MCP_ALLOW_SCAN_OUTSIDE_WORKSPACE=true lifts that, so leave it off. github.com

  • The default scan needs metrics turned on

    Without a rule config, the scan uses Semgrep auto rules and refuses to run when SEMGREP_SEND_METRICS is off. Pick a specific rule config if you want metrics off. github.com

  • A Semgrep token lets it read your findings

    Findings from your Semgrep account are readable with SEMGREP_APP_TOKEN. Create the token in Semgrep settings and share it with this server only. github.com

  • HTTP mode opens a local port

    In streamable-http mode the server listens on 127.0.0.1:8000 by default. Do not change the host to expose it to your network. github.com

Technical details
Turning on read-onlyNo read-only switch is needed because no tool changes your files, but each tool can be turned off with an environment variable such as SEMGREP_SCAN_DISABLED=true.
Talks toSemgrep API (semgrep.dev) for rule schema and findings. Semgrep rule registry when a scan uses the default auto rules
Sign-in and keysThe optional token is read from the SEMGREP_APP_TOKEN environment variable in the client config.
Scopes
  • Files inside your open project

  • Semgrep API token (optional) for reading findings

Questions

Is the Semgrep MCP server official?

Yes. It is made by Semgrep and lives in the main Semgrep repository as the semgrep mcp command.

What happened to the semgrep-mcp package?

It is deprecated. Its PyPI page says the server moved into the main semgrep program, and the last release only points you there. Install Semgrep and run semgrep mcp instead.

Do I need a Semgrep account?

Not for the bare semgrep mcp command: the README calls the AppSec Platform token optional. Semgrep's setup guides for IDEs do list a Semgrep account and semgrep login as prerequisites, though, and its Guardian plugins have a 30-day free trial before a license is needed. The dependency check needs the Pro Engine (semgrep install-semgrep-pro), which needs a login. Listing saved findings needs an AppSec Platform token.

How do I get a Semgrep token?

Log in at semgrep.dev, open Settings and create an API token. Put it in the SEMGREP_APP_TOKEN setting of your client config.

Does it send my code to Semgrep?

Scans run locally with the Semgrep program. The default scan also fetches Semgrep's auto rules and needs metrics on. Check Semgrep's privacy terms before scanning private code.

Can it change or delete my files?

No tool edits or deletes your files. Scans read them, and the rule and syntax tools write short-lived temporary files that are removed afterwards.

Is there a hosted version, and does it have the same tools?

Yes, for Claude Code and Codex only. Semgrep's Guardian plugins for those two use Semgrep's hosted server with browser sign-in (OAuth) and need no local CLI. Semgrep's docs do not give a hosted URL for other clients. The hosted tool set differs: semgrep_scan_remote replaces semgrep_scan and semgrep_scan_supply_chain, and semgrep_whoami is added. This page covers the local stdio install with the seven tools above, and each can be turned off with an environment variable.

How do I add it to Claude Code or Cursor?

Install Semgrep (pipx install semgrep, uv tool install semgrep or brew install semgrep), then use your client's tab in the install box above. Semgrep documents the config for VS Code and GitHub Copilot in JetBrains, a plugin for Cursor, and plugins for Claude Code and Codex. Other clients use the same semgrep mcp command.

Information

updated Nov 2, 2026

Publisher
Official
Package
semgrep
Registry
PyPI
Transport
stdio
Auth
token in env
Version
0.9.0
License
LGPL-2.1-or-later
Last commit
Oct 28, 2025
Open issues
12

SemgrepSemgrep Guardian docsSemgrep repoPyPIReleasesIssues

Sources

Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.

Show all 7
  1. github.com · github.com
  2. github.com · github.com
  3. pypi.org · pypi.org
  4. docs.semgrep.dev · docs.semgrep.dev
  5. docs.semgrep.dev · docs.semgrep.dev
  6. docs.semgrep.dev · docs.semgrep.dev
  7. docs.semgrep.dev · docs.semgrep.dev

Facts from the official MCP registry, GitHub, npm, PyPI and the Docker catalog. Updated Nov 2, 2026.