**⚠️ The Semgrep MCP server has been moved from a standalone repo to the main se
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**This repository has been deprecated, and further updates to the Semgrep MCP server will be made via the official semgrep binary.**
Semgrep MCP Server
A Model Context Protocol (MCP) server for using Semgrep to scan code for security vulnerabilities. Secure your vibe coding! 😅
Model Context Protocol (MCP) is a standardized API for LLMs, Agents, and IDEs like Cursor, VS Code, Windsurf, or anything that supports MCP, to get specialized help, get context, and harness the power of tools. Semgrep is a fast, deterministic static analysis tool that semantically understands many languages and comes with over 5,000 rules. 🛠️
> [!NOTE]
> This beta project is under active development. We would love your feedback, bug reports, feature requests, and code. Join the #mcp community Slack channel!
Contents
- Semgrep MCP Server
- Contents
- Getting started
- Cursor
- ChatGPT
- Hosted Server
- Cursor
- Demo
- API
- Tools
- Scan Code
- Understand Code
- Cloud Platform (login and Semgrep token required)
- Meta
- Prompts
- Resources
- Usage
- Standard Input/Output (stdio)
- Python
- Docker
- Streamable HTTP
- Python
- Docker
- Server-sent events (SSE)
- Python
- Docker
- Semgrep AppSec Platform
- Integrations
- Cursor IDE
- VS Code / Copilot
- Manual Configuration
- Using Docker
- Windsurf
- Claude Desktop
- Claude Code
- OpenAI
- Agents SDK
- Custom clients
- Example Python SSE client
- Contributing, community, and running from source
- Similar tools 🔍
- Community projects 🌟
- MCP server registries
Getting started
Run the Python package as a CLI command using uv:
Or, run as a Docker container:
Cursor
Example mcp.json
Add an instruction to your .cursor/rules to use automatically:
ChatGPT
1. Go to the **Connector Settings** page (direct link)
1. **Name** the connection Semgrep
1. Set **MCP Server URL** to https://mcp.semgrep.ai/sse
1. Set **Authentication** to No authentication
1. Check the **I trust this application** checkbox
1. Click **Create**
See more details at the official docs.
Hosted Server
> [!WARNING]
> mcp.semgrep.ai is an experimental server that may break unexpectedly. It will rapidly gain new functionality.🚀
Cursor
1. **Cmd + Shift + J** to open Cursor Settings
1. Select **MCP Tools**
1. Click **New MCP Server**.
1.
Demo
API
Tools
Enable LLMs to perform actions, make deterministic computations, and interact with external services.
Scan Code
- security_check: Scan code for security vulnerabilities
- semgrep_scan: Scan code files for security vulnerabilities with a given config string
- semgrep_scan_with_custom_rule: Scan code files using a custom Semgrep rule
Understand Code
- get_abstract_syntax_tree: Output the Abstract Syntax Tree (AST) of code
Cloud Platform (login and Semgrep token required)
- semgrep_findings: Fetch Semgrep findings from the Semgrep AppSec Platform API
Meta
- supported_languages: Return the list of languages Semgrep supports
- semgrep_rule_schema: Fetches the latest semgrep rule JSON Schema
Prompts
Reusable prompts to standardize common LLM interactions.
- write_custom_semgrep_rule: Return a prompt to help write a Semgrep rule
Resources
Expose data and content to LLMs
- semgrep://rule/schema: Specification of the Semgrep rule YAML syntax using JSON schema
- semgrep://rule/{rule_id}/yaml: Full Semgrep rule in YAML format from the Semgrep registry
Usage
This Python package is published to PyPI as semgrep-mcp and can be installed and run with pip, pipx, uv, poetry, or any Python package manager.
Standard Input/Output (stdio)
The stdio transport enables communication through standard input and output streams. This is particularly useful for local integrations and command-line tools. See the spec for more details.