MCP server · Code and developer tools
Semgrep MCP server
The Semgrep MCP server is Semgrep’s official MCP server for code security. It lets an assistant scan code with Semgrep, write custom rules and pull findings from Semgrep AppSec Platform. It runs locally through the Semgrep CLI (semgrep mcp); a SEMGREP_APP_TOKEN is optional and only needed for platform findings.
- Maintainer
- Semgrep (official)
- Licence
- LGPL-2.1-or-later
- Runs
- Locally (semgrep)
- Sign-in
- Optional token
- Last activity
- 2026-10-07
Overview
What can the Semgrep MCP server do?
The Semgrep MCP server now ships inside the Semgrep CLI as the semgrep mcp subcommand. The old standalone semgrep/mcp repository and its semgrep-mcp package are deprecated and archived. Once the CLI is installed, the server runs over stdio by default, or over Streamable HTTP on 127.0.0.1:8000 with -t streamable-http. The semgrep/semgrep Docker image can run it too.
Use it when you want an assistant to check the code it has just written for security problems before you commit. It can scan files with Semgrep’s rules or a custom rule, check dependencies, show a file’s abstract syntax tree and explain the rule schema. With a SEMGREP_APP_TOKEN it can also fetch findings from Semgrep AppSec Platform. For Claude Code and Cursor, Semgrep recommends its Semgrep Guardian plugin, which bundles the MCP server with hooks and skills and installs the CLI for you.
Tools
Tools it gives the assistant
- Scan code files for security issues (semgrep_scan)
- Scan with a custom Semgrep rule
- Scan dependencies for supply chain issues
- Fetch findings from Semgrep AppSec Platform (semgrep_findings)
- Show the abstract syntax tree of a file
- List supported languages and the rule schema
- Prompt for writing a custom rule
Install
How do I install Semgrep MCP in Claude Code, Cursor or VS Code?
You need:
- The Semgrep CLI (for example brew install semgrep); the PyPI package needs Python 3.10 or newer
- Optional: a Semgrep AppSec Platform account and SEMGREP_APP_TOKEN for findings
Run in your project. --scope local keeps the servers private to you in this project; use user for every project.
claude mcp add --scope local semgrep -- semgrep mcp
claude mcp add --scope local semgrep -- semgrep mcp
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json · Windows: %APPDATA%\Claude\claude_desktop_config.json (Settings → Developer → Edit Config). Restart Claude after saving.
{
"mcpServers": {
"semgrep": {
"command": "semgrep",
"args": [
"mcp"
]
}
}
}
In your project, or ~/.cursor/mcp.json for every project.
{
"mcpServers": {
"semgrep": {
"type": "stdio",
"command": "semgrep",
"args": [
"mcp"
]
}
}
}
In your workspace. VS Code asks for each secret the first time a server starts and stores it securely.
{
"servers": {
"semgrep": {
"type": "stdio",
"command": "semgrep",
"args": [
"mcp"
]
}
}
}
Need another app? Open Semgrep MCP server in the MCP config generator for a shared project .mcp.json, Devin, or several servers at once; it writes one file per app. The snippets follow the setup in the server’s README, checked on 2026-10-14.
Is the Semgrep MCP server safe? Check before you install
- Local scan tools read files from the paths the assistant passes, so they can reach any file your user account can read.
- SEMGREP_APP_TOKEN gives access to your organisation’s findings on Semgrep AppSec Platform. Keep it in an environment variable, not in a shared config file.
- Streamable HTTP mode opens a local port (8000 by default). Keep it bound to 127.0.0.1.
- A local MCP server runs with your user account’s permissions. Install it only from the source linked above. See how to choose a safe server.
FAQ
Semgrep MCP questions
Is the Semgrep MCP server official?
Yes. Semgrep publishes and maintains it, under the LGPL-2.1-or-later licence. Install it only from the source linked on this page, not from a copy in another directory.
Is Semgrep MCP server remote or local?
Local. Your MCP app starts it on your machine with semgrep, and it runs with your user account’s permissions.
Does Semgrep MCP server need an API key or account?
Not to start. It works without a key, and an API key or token from the service adds higher limits or more tools. You also need: The Semgrep CLI (for example brew install semgrep); the PyPI package needs Python 3.10 or newer; Optional: a Semgrep AppSec Platform account and SEMGREP_APP_TOKEN for findings.
Why it’s listed
Why we list it
A deterministic, well-known static analysis engine that assistants can call to check their own code, maintained inside Semgrep’s main CLI.
Related
Alternatives and related servers: code and developer tools
- SonarQube MCP Server
- Postman MCP Server
- Next.js DevTools MCP
- GitHub MCP Server
- GitLab MCP server
- Sentry MCP
All MCP serversMCP config generatorGuide: MCP servers in Claude CodeGuide: what is MCP?