Semgrep MCP Server
Pricing
Pay per usage
Semgrep MCP Server
Cloud-deployed Semgrep static analysis for AI agents. Scan code for security vulnerabilities (SQL injection, XSS, command injection), detect OWASP Top 10 & CWE issues, run custom rules. Supports 30+ languages via MCP.
Pricing
Pay per usage
Rating
0.0
(0)
Developer
CQ
Maintained by CommunityActor stats
0
Bookmarked
3
Total users
1
Monthly active users
6 days ago
Last modified
Categories
Share
Semgrep Code Quality MCP Server
A cloud-deployed Model Context Protocol (MCP) server that exposes static code analysis, security vulnerability scanning, and custom-rule checks powered by Semgrep.
The Actor runs an MCP server over Streamable HTTP at the /mcp endpoint. Any MCP client that supports remote Streamable HTTP servers can connect and call its tools — for example the Apify MCP integration, or a custom agent/LLM app built with an MCP client SDK. Stdio-only desktop clients (such as Claude Desktop) can reach it through a bridge like mcp-remote. The tool responses are the primary output.
What this Actor does
This Actor gives MCP-capable AI agents on-demand access to Semgrep by wrapping the semgrep CLI behind five MCP tools. It can:
- Scan code snippets for security vulnerabilities (SQL injection, XSS, command injection, path traversal, hardcoded secrets, and more, depending on the ruleset).
- Run a full configurable Semgrep scan over multiple files with a chosen ruleset and severity filter.
- Apply a custom Semgrep YAML rule for project-specific patterns/anti-patterns.
- Report Semgrep metadata on findings, including CWE and OWASP mappings when the matched rule provides them.
Code you pass to a tool is written to a temporary directory in the container, scanned by Semgrep, and then deleted. Nothing is cloned from git and no project outside the files you send is analyzed.
MCP Tools
The output of this Actor is the set of MCP tools below. Each tool returns a human-readable text summary plus structuredContent.
security_check
Quick security scan of a single code snippet using the p/security-audit ruleset. Returns severity-ranked findings with CWE/OWASP mappings (when present in rule metadata).
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Code to analyze |
language | string (enum) | Yes | One of the supported languages listed below |
filename | string | No | Optional filename to improve detection |
Charges the security-check pay-per-event.
semgrep_scan
Comprehensive, configurable scan over one or more files. Language is detected from each file path, so this tool is not restricted to the language enum.
| Parameter | Type | Required | Description |
|---|---|---|---|
codeFiles | array of { path, content } | Yes | Files to scan |
config | string | No | Semgrep config/ruleset. Default: auto |
severity | array | No | Filter to any of ERROR, WARNING, INFO |
exclude | array | No | Glob patterns to exclude (e.g. *_test.py) |
timeout | number | No | Scan timeout in seconds, 10–300. Default: 60 |
Charges the scan-code pay-per-event.
semgrep_scan_custom_rule
Scan a single code snippet with your own Semgrep rule supplied as YAML. Runs with a fixed 30-second timeout.
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Code to analyze |
rule | string | Yes | Custom Semgrep rule in YAML |
language | string (enum) | Yes | One of the supported languages listed below |
Charges the custom-rule-scan pay-per-event.
supported_languages
Returns the list of languages accepted by the language parameter, and the count. No parameters. Not charged.
list_rulesets
Returns the built-in list of popular Semgrep rulesets with short descriptions. No parameters. Not charged.
There is also an MCP resource, semgrep-info (https://semgrep.dev/), returning a short text description of the server and its tools.
Supported languages
The language parameter of security_check and semgrep_scan_custom_rule accepts these 28 languages (exactly the values returned by supported_languages):
python, javascript, typescript, java, go, ruby, php, c, cpp, csharp,kotlin, scala, rust, swift, bash, dockerfile, json, yaml, terraform,solidity, elixir, lua, ocaml, r, julia, clojure, apex, hack
semgrep_scan does not use this enum — it infers the language from each file's path/extension, so it can scan any file type Semgrep itself recognizes.
How to use
This is a Standby MCP server, not a request-per-run scraper. Tools are invoked over the MCP protocol, not by POSTing a tool/arguments body to the run API.
-
In the Actor input, set
enableStandbytotrue. -
Enable Standby mode for the Actor in the Apify Console (Actor → Settings).
-
Point your MCP client at the Actor's Standby URL with the
/mcppath:https://<your-actor-standby-url>/mcpUse the Streamable HTTP transport. The client can then list tools and call them (
security_check,semgrep_scan,semgrep_scan_custom_rule,supported_languages,list_rulesets).
If Standby mode is not enabled (the default), a normal run initializes the server, writes a startup record to the dataset, and exits gracefully — it does not stay online to serve MCP requests.
Input configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
semgrepAppToken | string (secret) | – | Optional Semgrep AppSec Platform token. Enables managed/registry-authenticated rules and platform findings. |
defaultConfig | string | auto | Default Semgrep config used by semgrep_scan when config is omitted. |
enableMetrics | boolean | false | Send anonymous usage metrics to Semgrep. When false, Semgrep runs with --metrics=off. |
enableStandby | boolean | false | Keep the MCP server running persistently. Required (together with platform Standby mode) for the server to serve MCP requests. |
standbyIdleTimeout | integer | 120 | Seconds of inactivity before the standby server exits. Range 30–3600. Only applies when standby is active. |
Popular rulesets
Returned by list_rulesets and usable as the config value of semgrep_scan:
auto, p/security-audit, p/owasp-top-ten, p/cwe-top-25, p/ci, p/secrets, p/javascript, p/typescript, p/python, p/golang, p/java, p/react, p/nodejs, p/django, p/flask, p/express, p/ruby, p/php, p/terraform, p/docker, p/kubernetes
Registry configs (auto and any p/... pack) are fetched from the Semgrep registry and therefore need network access. Custom YAML rules passed to semgrep_scan_custom_rule run locally without registry access.
Dataset records
The MCP tool response is the primary output. In addition, each scanning tool writes one summary record to the Actor's default dataset (see .actor/dataset_schema.json). A record looks like:
{"scanId": "550e8400-e29b-41d4-a716-446655440000","timestamp": "2025-01-01T10:00:00.000Z","tool": "security_check","language": "python","totalFindings": 1,"severity": "ERROR","findings": [{"ruleId": "python.lang.security.audit.dangerous-system-call","severity": "ERROR","message": "Detected dangerous system call with user input","line": 1,"file": "code.py","category": "security","cwe": ["CWE-78"],"owasp": ["A03:2021"]}]}
Exact per-finding fields vary by tool: semgrep_scan records also include column, fix, and codeSnippet; semgrep_scan_custom_rule records include only ruleId, message, line, column, and codeSnippet. A startup heartbeat record (testRun: true) is written when the Actor runs without standby.
Pricing
This Actor uses Apify's pay-per-event pricing. Each scanning tool call incurs a single flat per-call charge under one of these events:
security-check— charged persecurity_checkcallscan-code— charged persemgrep_scancallcustom-rule-scan— charged persemgrep_scan_custom_rulecall
The informational tools (supported_languages, list_rulesets) are not charged. See the Actor's pricing on the Apify Store for the current per-event amounts. Note that running in Standby mode also consumes platform compute for as long as the server stays online.
Limitations
- MCP client required. Tools are only reachable over the MCP protocol at
/mcp(Streamable HTTP).GET/DELETEon/mcpreturn405, and the root path returns404except for the platform readiness probe. There is no plain RESTtool/argumentsendpoint. - Standby must be enabled to serve. With
enableStandby: false(the default), a run initializes and exits instead of staying online. The server only serves requests whenenableStandby: trueand platform Standby mode is on. - Depends on the bundled Semgrep. Scanning relies on the
semgrepCLI installed in the container image; available rules and behavior follow that installed Semgrep version. If Semgrep cannot run or a config fails to load, the affected tool call returns an error. - Language enum for two tools.
security_checkandsemgrep_scan_custom_ruleaccept only the 28 languages listed above; other values are rejected.semgrep_scanis not limited this way. - Registry rulesets need network access.
autoandp/...packs are downloaded from the Semgrep registry. Some Pro/managed rules require asemgrepAppToken. Custom YAML rules run offline. - Snippet/file scope only. Code is scanned from the in-memory content you send, written to a temporary directory. There is no git clone, no commit history, and no analysis of files beyond those provided in a single call.
- Time limits.
semgrep_scanaccepts a 10–300s timeout (default 60s);semgrep_scan_custom_ruleuses a fixed 30s timeout. Large inputs may time out. - No result persistence beyond the dataset summary. Full findings are returned in the MCP tool response; only summary records are stored in the dataset.
Resources
- Semgrep Documentation
- Semgrep Rules Registry
- Model Context Protocol Specification
- Apify MCP Integration Guide
License
MIT


