CODE SECURITY / Semgrep
Semgrep CLI MCP
Run Semgrep scans and inspect rule or platform findings through the maintained MCP server inside the Semgrep CLI.
“Entry point for the MCP server”
01 / THE REASONING
Why this made the selection.
- Uses Semgrep’s current CLI implementation rather than the retired standalone MCP package.
- Local scan, custom-rule and rule-schema tools connect code generation with deterministic scanner output.
02 / THE REVIEW RECORD
What we actually inspected.
Source review has boundaries.
A clear record is more useful than a “safe” badge.
Material inspected
- Pinned in-tree MCP README (cli/src/semgrep/mcp/README.md), cli/pyproject.toml and root LGPL licence at 38a67a7eaf724fc266bf96e5705742bff8589775.
- Python MCP server registration, scan handlers and CLI wrapper (cli/src/semgrep/mcp/server.py, semgrep.py) at 38a67a7eaf724fc266bf96e5705742bff8589775.
Our findings
- The supported local entrypoint is semgrep mcp, defaulting to stdio; streamable HTTP is also documented (-t streamable-http).
- The implementation includes platform API calls and tracing as well as local scanning. Old semgrep-mcp package or hosted SSE examples are not used here.
- server.py registers nine tools: semgrep_rule_schema, get_supported_languages, semgrep_findings, semgrep_scan_with_custom_rule, semgrep_scan, semgrep_scan_remote, get_abstract_syntax_tree, semgrep_scan_supply_chain and semgrep_whoami. A local server drops semgrep_scan_remote, stdio drops semgrep_whoami, and an environment variable per tool (for example SEMGREP_SCAN_DISABLED=true) removes it.
- cli/pyproject.toml at the pin declares package semgrep, license LGPL-2.1-or-later, requires-python >=3.10; the README now presents this server as part of Semgrep Guardian (MCP server, hooks and skills).
- configExample is the README's Kiro block at 38a67a7e; SEMGREP_APP_TOKEN refers to a ${SEMGREP_TOKEN} variable rather than a literal token.
- Re-pinned from 0516c0f23a3dceac5c8f5ff3fecd402af4450182 to 38a67a7eaf724fc266bf96e5705742bff8589775; the MCP README, server.py, semgrep.py and LICENSE are byte-identical between them, and cli/pyproject.toml changed only its version (1.176.0 to 1.180.0) and the pyjwt range.
Not established by this review
- Server launch, authenticated tool calls, and release-to-source parity were not tested.
The review applies to the material and revision named here. A newer upstream release can change its behavior.
03 / PUT IT TO WORK
Connect a server deliberately.
DOCUMENTED COMMAND
semgrep mcp Copying does not execute this command. It may retrieve a newer version than the reviewed source.
- Install the Semgrep CLI; the README's line is brew install semgrep.
- Configure command semgrep with args [mcp] as a stdio server in your client; the displayed command starts that server.
- Set up optional platform credentials (SEMGREP_APP_TOKEN) separately and review which scan modes and data flows you enable.
Before you start
- A current Semgrep CLI installation and supported project files.
- Optional Semgrep account/token and product entitlement for platform or commercial capabilities.
Documented configuration example
Use the client and authentication context described in the setup guidance. Configuration formats vary between hosts.
{
"mcpServers": {
"semgrep": {
"command": "semgrep",
"args": [
"mcp"
],
"env": {
"SEMGREP_APP_TOKEN": "${SEMGREP_TOKEN}"
}
}
}
} 04 / FOLLOW THE EVIDENCE
The source trail.
Our notes are separate from the original resource.
Check upstream before adopting a new version.
https://raw.githubusercontent.com/semgrep/semgrep/38a67a7eaf724fc266bf96e5705742bff8589775/cli/src/semgrep/mcp/README.md
Supports: summary, upstreamDescription, whySelected, bestFor, limitations, install, access, compatibility, transports, review, configExample
https://raw.githubusercontent.com/semgrep/semgrep/38a67a7eaf724fc266bf96e5705742bff8589775/cli/pyproject.toml
Supports: language, install
https://raw.githubusercontent.com/semgrep/semgrep/38a67a7eaf724fc266bf96e5705742bff8589775/cli/src/semgrep/mcp/server.py
Supports: summary, access, review, transports
- Semgrep scan wrapper ↗Checked
https://raw.githubusercontent.com/semgrep/semgrep/38a67a7eaf724fc266bf96e5705742bff8589775/cli/src/semgrep/mcp/semgrep.py
Supports: review, access
- Semgrep CLI LGPL terms ↗Checked
https://raw.githubusercontent.com/semgrep/semgrep/38a67a7eaf724fc266bf96e5705742bff8589775/LICENSE
Supports: license