Semgrep MCP Server
Scan code for security bugs and risky dependencies with Semgrep's rules.
Officialby SemgrepRuns on your computerChecked November 18, 2026
The Semgrep MCP server ships inside the free Semgrep CLI as the semgrep mcp command, so Claude can scan the files in your project with Semgrep's rules, and write and run custom rules, with no Semgrep account for local scans. In our test on November 8, 2026 it caught all five bugs we had planted in two small files. Dependency (supply chain) scans are different: they need Semgrep's Pro Engine and a semgrep login. Semgrep's Guardian plugin for Claude Code wraps the same server in hooks that scan every file Claude writes, free for 30 days and then paid.
Who is Semgrep MCP for?
- Developers who want security checks on AI-written code
- Application security engineers
- Teams already using Semgrep in CI
What can you ask Semgrep MCP to do?
Once it is connected, ask in plain words. Your AI tool decides when to use the server and asks before it changes anything important.
Scan app.py and server.js with Semgrep, fix every finding rated ERROR, then scan again to confirm they are gone.Write a Semgrep rule that flags SQL queries built by adding strings, then run it on this file.I ran semgrep login and installed the Pro Engine. Run a Semgrep supply chain scan on requirements.txt and tell me if any version is known to be vulnerable.How to connect Semgrep to Claude
MCP is an open standard. The setup steps below cover this server in Claude Code, Claude app, Codex, Cursor, VS Code, Gemini CLI, Antigravity, OpenCode, Windsurf. Pick your tool:
New to MCP? Read what an MCP server is and how to add one.
Connect the Semgrep MCP server to Claude Code for me: run this command: claude mcp add --transport stdio semgrep -- semgrep mcp
If a value starts with YOUR_, ask me for it first. When it is connected, help me sign in if needed and show me one thing I can ask it to do.Or do it yourself:
claude mcp add --transport stdio semgrep -- semgrep mcpUnlock the setup steps
Free. Leave your email once to open the setup steps for all 152 servers, and get the best new connectors each month.
Good to know
Claude Code passes your project folder to the server, and semgrep_scan only reads files inside it. Without a Semgrep login, each result shows the rule, file and line but hides the matched code. The server sends usage traces to Semgrep unless you set SEMGREP_MCP_DISABLE_TRACING=true. For automatic scans of every file Claude writes, Semgrep's Guardian plugin installs with claude plugin install semgrep@claude-plugins-official.
How did we check Semgrep MCP?
What we re-read on November 8, 2026: the MCP folder in the semgrep/semgrep repo (LGPL-2.1, last MCP change October 28, 2026, CLI release 1.184.0 on November 5), Semgrep's Guardian docs and its pricing page. We installed Semgrep 1.184.0 and ran semgrep mcp: it listed 7 tools, semgrep_scan found 13 issues in 2 files we had seeded with SQL injection, shell injection, Flask debug mode, reflected XSS and eval, and a custom rule we wrote matched the SQL line. We keep the raw logs and the seeded files. On November 18, 2026 we read the 1.186.0 release (the repo had 17,808 stars): semgrep mcp now also turns its telemetry off with SEMGREP_SEND_METRICS=off. On November 22, 2026 we read the server's source: semgrep_scan_supply_chain stops with Supply Chain scan requires an active Semgrep daemon to be running unless the Pro Engine is installed, which needs semgrep login. We have not run that tool.
Source: github.com/semgrep/semgrep/tree/develop/cli/src/semgrep/mcp
What to do next
Run prompt 1 on one file you already worry about and keep the findings list as your baseline. Before you publish anything Claude built, pair this scan with the free pre-launch security audit prompts, which cover what a pattern scanner cannot see, such as missing access checks; the Claude Code course (early access) teaches the review habit that sits around both.
What do people ask about Semgrep MCP?
Can I scan with Semgrep through Claude at no cost?
Yes. It is part of the Semgrep CLI, which is open source under LGPL-2.1, and local scans need no account (supply chain scans are the exception: they need the Pro Engine, which needs semgrep login). Semgrep's platform has a free edition for up to 10 contributors and 10 repositories. The Guardian plugin is free for 30 days, and Guardian stops scanning when the trial ends unless you buy a license (semgrep.dev/pricing and the Guardian FAQ, checked November 8, 2026).
Does the Semgrep MCP server send data to Semgrep?
Scans run on your computer, but the server sends usage traces to Semgrep by default, and its source code attaches your git user name, repository and branch to them. Set SEMGREP_MCP_DISABLE_TRACING=true in the server's environment to turn that off; since Semgrep 1.186.0 (November 18, 2026), SEMGREP_SEND_METRICS=off does the same, and its metrics no longer carry scan output. Guardian's remote plugin is different: it scans with Semgrep's hosted scanner.
What did it find in your test?
We gave it a 25-line Flask file and a 13-line Express file with five planted bugs. It returned 13 findings in 0.8 seconds: SQL built from user input, a shell command built from user input with shell=True, Flask debug mode, HTML written straight from a query parameter and eval on user input, plus a note about missing CSRF middleware. Without a login it showed each rule and line but hid the matched code.
Should I use the MCP server or the Guardian plugin?
Use the MCP server when you want to ask for scans yourself, at no cost. Guardian adds hooks so Claude Code scans each file it writes and is asked to regenerate code that has findings; it scans with Semgrep's hosted guardian-default ruleset and needs a Semgrep account and, after 30 days, a license.
We wrote these answers from the official pages of each product named, read on November 18, 2026.
