Semgrep MCP server: 7 tools, now part of the scanner
Where the server went after its standalone repository was archived, what the seven tools do, and which one needs a Semgrep account.
Last verified 1 September 2026 · from The Semgrep repository, PyPI and the server's own tools/list response
This page is one of 90 in a directory of monitoring and developer tools. Each page checks what an AI coding agent can get out of the tool through its MCP server, the connector that lets the agent query the tool directly.
Summary
Semgrep's MCP server is no longer a separate project. The standalone semgrep/mcp repository was archived once the code moved into the scanner, so the server is now started with semgrep mcp from the CLI itself.
It registers 7 tools: local scanning, scanning with a rule you supply, supply-chain scanning, the rule schema, supported languages, an abstract syntax tree, and findings from the Semgrep AppSec Platform.
The definitions cost between 1,624 and 3,220 tokens, roughly 0.8% to 1.6% of a 200,000-token window. Only the platform findings tool needs an account; the rest scan locally.
What is the Semgrep MCP server?
It is Semgrep's server for the Model Context Protocol. Semgrep is a static analyzer, so a connected agent can check code against rules without a build step.
Two tools separate this from a generic linter. semgrep_scan_with_custom_rule takes a rule you write and applies it immediately. semgrep_rule_schema returns the schema for writing one. Together they let an agent author a rule and test it in the same conversation.
get_abstract_syntax_tree is the third unusual one. It returns the parse tree for a file as JSON, which an agent can use to reason about structure rather than about text.
The semgrep mcp command brings local scanning, supplied rules and supply-chain analysis into an agent session. Its reach is code quality and CI-adjacent scanning, not runtime telemetry, model traces or spend.
| Part of the work | What Semgrep has here | Can an agent reach it |
|---|---|---|
| Code, tests & review | Static analysis, custom rules, syntax trees, platform findings | Yes. Core strength. Scanning, rule authoring and findings review are all reachable |
| CI & release | Supply-chain scanning | Partial. Third-party dependency risk can be scanned; there are no pipeline or deployment tools |
| Production observability | None | No metrics, logs or traces. A running service is out of scope |
| Agent observability & evals | None | No traces, evaluations or prompt versioning for your own agents |
| AI cost management | None | No spend data of any kind |
In practice, Semgrep answers whether code matches a pattern you care about. It can scan what was just written, and write a rule for the pattern that keeps recurring. It knows nothing about the running system, so it belongs beside a telemetry connector rather than instead of one.
What can an AI agent do with Semgrep?
| Task | Tools | Works | Watch out for |
|---|---|---|---|
| Scan code the agent just wrote | semgrep_scan | Yes | Files are expected as absolute paths |
| Test a pattern before adopting it | semgrep_scan_with_custom_rule semgrep_rule_schema | Yes | The rule is applied to content you pass, not to the repository |
| Check third-party dependencies | semgrep_scan_supply_chain | Yes | It scans a workspace directory rather than a lockfile you name |
| Review findings the platform already has | semgrep_findings | Yes | This is the one tool that calls the Semgrep AppSec Platform API |
| Reason about code structure | get_abstract_syntax_tree | Yes | The whole parse tree returns in one JSON response, so a large file consumes a large share of the window |
| Check whether a language is covered | get_supported_languages | Yes | Its description asks the model to call it only when unsure |
| Find whether a vulnerability is exploited in production | Grafana, Datadog or Dynatrace | No, separate server | Static analysis says what the code allows, never what happened |
semgrep_rule_schema and semgrep_scan_with_custom_rule are a pair. The first is how an agent learns the rule format; the second is how it checks that the rule it wrote does what was intended.
7 tools registered, all on by default
- Scanning2
semgrep_scansemgrep_scan_supply_chain- Rule authoring2
semgrep_rule_schemasemgrep_scan_with_custom_rule- Structure1
get_abstract_syntax_tree- Capability1
get_supported_languages- Platform1
semgrep_findings
Six tools run locally; only semgrep_findings calls the Semgrep AppSec Platform. Counted on 24 August 2026 from the released CLI.
What connecting costs before the first question
A context window is the amount of text a model can hold at once, and connecting uses some of it before the agent asks anything. Every tool the server registers sends its name, description and input schema to the model when the session starts. The tool list is charged whether or not a single tool is called.
7 tools cost between 1,624 and 3,220 tokens, about 0.8% to 1.6% of a 200,000-token window. Twenty-seven connectors in this guide cost fewer tokens, Elastic and CodeRabbit among them.
The two halves are balanced. Descriptions average 473 characters and schemas average 482, so neither dominates.
| Tool set | Tools | Tokens (GPT-5.6, GPT-5.5) | Tokens (GPT-4, GPT-3.5) | Tokens (Claude Haiku 4.5 to Opus 5) | Share of a 200,000-token window |
|---|---|---|---|---|---|
| Every tool, as registered | 7 | 1,656 to 2,244 | 1,624 to 2,241 | 2,644 to 3,220 | 0.8% to 1.6% |
Encodings: GPT-5.6, GPT-5.5 o200k_base; GPT-4, GPT-3.5 cl100k_base; Claude Haiku 4.5 to Opus 5 count_tokens. Counted 24 August 2026 from tools/list on the released CLI 1.174.0 from PyPI. It was started with semgrep mcp locally.
Registration is static, so no Semgrep account was involved. Figures cover name, description and input schema. The two models in column one share the o200k_base encoding, so they get one count. The spread is formatting, about 38%. Reasoning tokens are output, spent per request. This count is input, charged once at connection.
The Claude figures are measured rather than encoded. Anthropic publishes no local tokenizer. The definitions were sent to the API's count_tokens endpoint, and a no-tools baseline was subtracted. The range covers two tokenizer generations rather than two serializations. Haiku 4.5 and Opus 4.6 sit at the low end. Opus 5 and Sonnet 5 sit at the high end. The gap between them is about a fifth.
Semgrep MCP server limits: where answers come back incomplete
Each limit below comes from one pair of tools that return the same shape from a different scope.
The agent says: “The scan is clean.” It may have run one rule, not the rule set.
semgrep_scan applies Semgrep's rules to files. semgrep_scan_with_custom_rule applies only the single rule passed to it, against content passed to it.
Both return findings in the same JSON shape, so an empty result from the narrow tool reads exactly like an empty result from the broad one.
Guard: Require the agent to name which of the two scan tools produced a clean result.
The agent says: “There are no open findings.” That may be the platform, or the local scan.
semgrep_findings reads the Semgrep AppSec Platform Findings API, which reflects what the platform has ingested. A local scan reflects the working tree, which can be ahead of it.
Guard: Have the agent state whether an answer came from the platform tool or from a local scan.
The standalone server repository is archived, and search results still point at it.
semgrep/mcp was archived when the server moved into the scanner. The living route is semgrep mcp inside the scanner CLI. The capture on this page was taken on CLI 1.174.0; 1.175.0 shipped on 26 August 2026.
Guard: Configure clients against the CLI subcommand, so an archived package cannot pin you to old behavior.
How to configure Semgrep MCP for agents
- 1
Decide whether the platform tool is wanted
semgrep_findingsreaches the AppSec Platform Findings API and is the only tool that needs an account. - 2
Know what leaves the machine
semgrep_scan_with_custom_ruleoperates on code content passed to it, which means the agent has already put that content in the conversation. - 3
Prefer absolute paths
semgrep_scanstates that files are expected as absolute paths, and a relative one is the usual cause of an empty scan. - 4
Do not look for the archived repository
The standalone
semgrep/mcpproject was archived when the server moved into the CLI. Guides that point at it describe a route that receives no further changes.
Paste this into your agent’s instructions
A clean scan and a scan that matched nothing because the path was wrong look identical. The block makes the agent name what it scanned.
When you answer using Semgrep MCP tools, state: - The absolute path or file content you scanned. - Which tool you used. semgrep_scan applies the default rules, semgrep_scan_with_custom_rule applies only the rule given. - Whether a finding came from semgrep_findings, which reads the Semgrep AppSec Platform rather than scanning locally. Never state that data does not exist. State that the scan above returned no findings. Write your answer in ASD-STE100 Simplified Technical English. Use short sentences with one idea in each.
Do you need the MCP server at all?
Not for a scheduled scan. The same program runs without an agent in front of it. semgrep scan in a terminal produces the same findings and spends no context.
The connector earns its place on rule authoring. An agent that can fetch the rule schema, write a rule and test it on a snippet closes a loop that a terminal does not.
At 1,624 tokens the standing cost is among the smallest measured here, so leaving it connected is cheap.
Connect it while writing code or rules. Use the CLI directly in pipelines and scheduled scans.
Semgrep MCP server setup
There is no separate package. Installing the Semgrep CLI installs the server, and semgrep mcp starts it.
Local scanning works with no credentials at all. Only semgrep_findings requires a Semgrep token in the environment.
Claude Code
No credentials are needed for local scanning. Add a Semgrep token only if you want semgrep_findings to work.
claude mcp add-json "semgrep" '{"command":"semgrep",
"args":["mcp"]}'Cursor
In ~/.cursor/mcp.json. Still no credentials unless the platform findings tool is wanted.
{"mcpServers":{"semgrep":{"command":"semgrep",
"args":["mcp"]}}}Codex CLI
Codex reads TOML, so the JSON blocks above will not transfer. No credentials for local scanning.
[mcp_servers.semgrep] command = "semgrep" args = ["mcp"]
Every other client
Each block below is the configuration for one client, with the file path and the key that client expects.
Claude Desktop
macOS ~/Library/Application Support/Claude/claude_desktop_config.json. Windows %APPDATA%\Claude\claude_desktop_config.json. There is no CLI. Edit through Settings, Developer, Edit Config.
Quit and restart fully for changes to load. Paths in args must be absolute. Logs at ~/Library/Logs/Claude/mcp.log.
No credentials appear in the file. Local scanning needs none; add a Semgrep token only for semgrep_findings.
{"mcpServers":{"semgrep":{"command":"semgrep",
"args":["mcp"]}}}Gemini CLI
~/.gemini/settings.json globally, or .gemini/settings.json per project. Key mcpServers. CLI: gemini mcp add.
No credentials appear in the file. Local scanning needs none; add a Semgrep token only for semgrep_findings.
{"mcpServers":{"semgrep":{"command":"semgrep",
"args":["mcp"]}}}VS Code Copilot
.vscode/mcp.json per workspace, or your user profile. CLI: code --add-mcp.
No credentials appear in the file. Local scanning needs none; add a Semgrep token only for semgrep_findings.
{"servers":{"semgrep":{"command":"semgrep","args":["mcp"]}}}The key is `servers`, not `mcpServers`. VS Code is the only client that uses that name, and copying a config from anywhere else fails silently.
Windsurf
~/.codeium/windsurf/mcp_config.json, which is the path Windsurf documents. Key mcpServers, the same JSON shape as Cursor, carrying the same CLI session, with no credential in the file.
Zed
~/.config/zed/settings.json, carrying the same CLI session, with no credential in the file, as in the blocks above.
The key is `context_servers`. Zed does not call them MCP servers in config, so searching its settings for mcp finds nothing.
Google Antigravity
~/.gemini/config/mcp_config.json globally, or .agents/mcp_config.json per project. Key mcpServers. There is no CLI. Use the /mcp overlay in the editor. Supports stdio, streamable HTTP, SSE and websocket.
No credentials appear in the file. Local scanning needs none; add a Semgrep token only for semgrep_findings.
{"mcpServers":{"semgrep":{"command":"semgrep",
"args":["mcp"]}}}Amp (Sourcegraph)
~/.config/amp/settings.json or .amp/settings.json, carrying the same CLI session, with no credential in the file. The amp mcp CLI covers approve, doctor and oauth.
The key is `amp.mcpServers`, namespaced. A bare mcpServers block is ignored.
Cline
~/.cline/mcp.json per the docs. The source also reads ~/.cline/data/settings/cline_mcp_settings.json. Key mcpServers, standard JSON shape, carrying the same CLI session, with no credential in the file. Supports stdio, streamable HTTP and SSE.
Goose (Block)
~/.config/goose/config.yaml, carrying the same CLI session, with no credential in the file.
YAML, and servers are called `extensions`. Goose does not use the MCP vocabulary in config at all. Add one interactively with goose configure, or per session with goose session --with-extension.
Kiro (AWS)
.kiro/settings/mcp.json per workspace, or ~/.kiro/settings/mcp.json globally. Key mcpServers, standard JSON shape, carrying the same CLI session, with no credential in the file.
Warp
~/.warp/.mcp.json or .warp/.mcp.json. Key mcpServers, standard shape, carrying the same CLI session, with no credential in the file. Also addable through the /agent-add-mcp skill.
JetBrains Junie
.junie/mcp/mcp.json per project, or ~/.junie/mcp/mcp.json. Key mcpServers, carrying the same CLI session, with no credential in the file. Use /mcp in the CLI to manage.
Roo Code
.roo/mcp.json per project. The global file is mcp_settings.json, opened from the Roo Code MCP settings view with Edit Global MCP. Key mcpServers, carrying the same CLI session, with no credential in the file.
Continue
.continue/mcpServers/*.yaml, one file per server, carrying the same CLI session, with no credential in the file.
YAML, and `mcpServers` is a list, not an object. Every JSON client keys servers by name. Continue takes an array, so a converted config will not parse.
Trae
.trae/mcp.json per project, or paste into the UI under Raw Config (JSON). Key mcpServers, standard shape, carrying the same CLI session, with no credential in the file.
Devin
Devin has no config file to edit. Servers are added through a web form in the settings UI, and Devin's documentation states you do not need to write or paste JSON. The block below is the shape those fields describe, shown for reference. Either route uses the same CLI session.
With platform findings
A Semgrep token authorizes the one tool that reads the AppSec Platform Findings API.
{"mcpServers":{"semgrep":{"command":"semgrep",
"args":["mcp"],
"env":{"SEMGREP_APP_TOKEN":"<your-token>"}}}}Read-only access, permissions and security
Six of seven tools run locally
Source stays on the machine unless the agent chooses to pass content into a tool argument.
One tool takes content rather than a path
semgrep_scan_with_custom_ruleoperates on provided code content, so what it scans is already in the conversation.One tool leaves the machine
semgrep_findingscalls the Semgrep AppSec Platform Findings API and needs a token to do so.Every tool reads
Nothing in the list writes a file, changes a rule set or alters platform state.
Troubleshooting
- A scan returns nothing on a real project
semgrep_scanexpects absolute paths. A relative path produces an empty result rather than an error.- `semgrep_findings` fails
- It is the only tool that calls the Semgrep AppSec Platform. Without a Semgrep token in the environment it has nothing to authenticate with.
- A custom rule matches nothing
- Call
semgrep_rule_schemafirst and check the rule against it. The custom-rule tool applies exactly the rule given, with none of the default rule set behind it. - Documentation points at a repository that is archived
- The standalone
semgrep/mcprepository was archived when the server moved into the CLI. Usesemgrep mcpfrom the installed scanner instead.
Semgrep MCP server: Reference
| Item | Value |
|---|---|
| Status | Semgrep CLI 1.175.0 · repository pushed 1 September 2026 |
| Adoption | 16,459 stars · 1,042 forks · 100 or more releases · repository created 13 December 2019 |
| License | LGPL-2.1 |
| Package | semgrep on PyPI; the server is semgrep mcp |
| Auth | None for local scanning; a Semgrep token for semgrep_findings |
| Tools | 7, all on by default, all read-only |
| Local tools | 6 of 7 |
| Context cost | 1,624 to 3,220 tokens |
| Former route | The standalone semgrep/mcp repository is archived |
What engineers report
The Semgrep repository carries 16,459 stars, 1,042 forks and 100 or more releases since 13 December 2019. The signal worth reading here is the MCP mode and where it now lives.
| What was checked | What it shows |
|---|---|
| Stars on the Semgrep repository | 16,372 |
| Last push | 24 August 2026 |
| Version | 1.175.0 on PyPI · tools captured on 1.174.0 |
| License | LGPL-2.1 |
Tools returned by tools/list | 7 |
| Average description | 473 characters per tool |
| Average schema size | 482 characters per tool |
“I'm just testing this server, but gemini-cli, claude code and zed fails to load, using this config; ... am i doing something wrong?”
Repository facts from the GitHub API and PyPI, retrieved 24 August 2026. Tool counts and sizes come from the released CLI's own tools/list response. The standalone semgrep/mcp repository was checked and is archived.
Should you connect an agent to Semgrep?
Yes. Best for local scanning with no token at all, adding one only if platform findings are wanted.
- Strongest fit
- Teams whose agents write code and who want static analysis and rule authoring in the same conversation.
- Main advantage
- The cheapest security connector measured here, with rule authoring tools a scanner CLI does not expose as neatly.
- Main weakness
- Two scan tools with different scopes return the same shape, so a clean result needs qualifying.
- Operational risk
- One tool takes code content rather than a path, and one calls the Semgrep platform with a token.
From Oodle
One platform for agent traces and infrastructure
Agent traces usually sit in a different product from the rest of your telemetry, so when a slow database makes an agent slow the symptom is in one tool and the cause is in another. Oodle keeps both in one query surface, from $10 per million spans.
See agent observabilityFrequently asked questions
How many tools does the Semgrep MCP server have?
Semgrep CLI 1.174.0 exposes seven read-only tools by default. Counted from the CLI's own tools/list response on 24 August 2026.
Where did the standalone server go?
The semgrep/mcp repository was archived when the code moved into the scanner. The server is now started with semgrep mcp from the CLI.
Does it need a Semgrep account?
Only for semgrep_findings, which reads the AppSec Platform Findings API. The other six tools scan locally with no credentials.
What do the tool definitions cost?
Between 1,624 and 3,220 tokens, about 0.8% to 1.6% of a 200,000-token window. Descriptions and schemas contribute about equally.
Can an agent write its own rule?
Yes. semgrep_rule_schema returns the rule format and semgrep_scan_with_custom_rule applies a rule to content, so authoring and testing happen in one conversation.