MCP Server Semgrep
About
MCP Server Semgrep is a [Model Context Protocol](https://modelcontextprotocol.io) compliant server that integrates the powerful Semgrep static analysis tool with AI assistants like Anthropic Claude. It enables advanced code analysis, security vulnerability detection, and code qua
Details
- Author
- Szowesgad
- GitHub stars
- 28
- Downloads
- 388
- Categories
- Developer Tools, Security
Jump to
- Direct integration with the official MCP SDK
- Simplified architecture with consolidated handlers
- Clean ES Modules implementation
- Efficient error handling and path validation
- Cross-platform compatibility (Windows, macOS, Linux)
- Flexible Semgrep installation detection and management
Option 1 Install From Smithery Ai Recommended
The easiest way to install and use MCP Server Semgrep is through Smithery.ai:
- Visit](https://modelcontextprotocol.io)MCP Server Semgrep on Smithery.ai
- Follow the installation instructions to add it to your MCP-compatible clients
- Configure any optional settings like the Semgrep API token and allowed workspace roots
This is the recommended method for Claude Desktop and other MCP clients as it handles all dependencies and configuration automatically.
# Using npm npm install -g mcp-server-semgrep # Using pnpm pnpm add -g mcp-server-semgrep # Using yarn yarn global add mcp-server-semgrep
The package is also available on other registries:
# Using npm npm install -g git+https://github.com/vetcoders/mcp-server-semgrep.git # Using pnpm pnpm add -g git+https://github.com/vetcoders/mcp-server-semgrep.git # Using yarn yarn global add git+https://github.com/vetcoders/mcp-server-semgrep.git
git clone https://github.com/vetcoders/mcp-server-semgrep.git cd mcp-server-semgrep
- Install dependencies (supports all major package managers):
# Using pnpm (recommended) pnpm install # Using npm npm install # Using yarn yarn install
# Using pnpm pnpm run build # Using npm npm run build # Using yarn yarn build
Note: The installation process will automatically check for Semgrep availability. If Semgrep is not found, you'll receive instructions on how to install it.
This server only reads and writes files inside explicitly allowed workspace roots.
- By default, the allowed root is the process working directory (process.cwd()).
- For Claude Desktop, Smithery, or any launcher that does not start the server inside your project root, setMCP_SERVER_SEMGREP_ALLOWED_ROOTSto one or more absolute directories.
- Use your platform path delimiter for multiple roots::on macOS/Linux,;on Windows.
This server does not implement its own Semgrep account handling. It shells out to the installedsemgrepCLI and relies on Semgrep's normal authentication behavior.
- Local terminal and local development runs can often use an existingsemgrep loginsession from the current OS account.
- Managed launches such as Claude Desktop, Smithery, containers, or CI should prefer an explicitSEMGREP_APP_TOKENfor deterministic behavior.
- SEMGREP_APP_TOKENis still the safest option when you need portable configuration across machines or runners.
Semgrep can be installed in several ways:
# Using pnpm pnpm add -g semgrep # Using npm npm install -g semgrep # Using yarn yarn global add semgrep
sudo apt-get install semgrep # or curl -sSL https://install.semgrep.dev | sh
There are two ways to integrate MCP Server Semgrep with Claude Desktop:
Method 1 Install Via Smithery Ai Recommended
For local launches started under a user account that is already authenticated withsemgrep login, the Semgrep CLI may be able to reuse that login. For desktop-managed or shared environments, we still recommend settingSEMGREP_APP_TOKENexplicitly:
{ "mcpServers": { "semgrep": { "command": "node", "args": [ "/your_path/mcp-server-semgrep/build/index.js" ], "env": { "SEMGREP_APP_TOKEN": "your_semgrep_app_token", "MCP_SERVER_SEMGREP_ALLOWED_ROOTS": "/Users/you/projects" } } } }
- Launch Claude Desktop and start asking questions about code analysis.
If you want to scan more than one workspace, setMCP_SERVER_SEMGREP_ALLOWED_ROOTSto a platform-delimited list of absolute paths.
Could you scan my source code in the /projects/my-application directory for potential security issues? That directory is already included in MCP_SERVER_SEMGREP_ALLOWED_ROOTS.
Analyze the z-index values in the project's CSS files and identify inconsistencies and potential layer conflicts.
Create a Semgrep rule that detects improper use of input sanitization functions.
Show me only scan results related to SQL injection vulnerabilities.
Find all "magic numbers" in the code and suggest replacing them with named constants.
You can create custom rules for your project's specific needs. Here are examples of rules you can create:
rules: - id: inconsistent-z-index pattern: z-index: $Z message: "Z-index $Z may not comply with the project's layering system" languages: [css, scss] severity: WARNING
rules: - id: deprecated-import pattern: import $X from 'old-library' message: "You're using a deprecated library. Consider using 'new-library'" languages: [javascript, typescript] severity: WARNING
├── src/ │ └── index.ts # Main entry point and all handler implementations ├── scripts/ │ └── check-semgrep.js # Semgrep detection and installation helper ├── build/ # Compiled JavaScript (after build) └── tests/ # Unit tests
Detailed information on using the tool can be found in:
- USAGE.md- Detailed usage instructions
- README_PL.md- Documentation in Polish
- examples/- Example fun and practical Semgrep rules - "The Hall of Code Horrors"
This project is licensed under the MIT License - see theLICENSEfile for details.
🤖 Developed with the help ofClaude CodeandMCP Tools
- stefanskiasanfor the original inspiration
- Anthropicfor Claude and the MCP protocol
- Semgrepfor their excellent static analysis tool
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning with Cycode.
Enable AI agents to secure code with Semgrep.
AI-powered code quality analysis to detect best practice violations, security issues, and architectural problems in real-time.
AI-powered security scanning. Scans code, files, and git diffs for vulnerabilities in real-time using the Armis scanning API.
Access the Codacy API to analyze code quality, coverage, and security for your repositories.
MCP Server for local code security scanning - detects secrets, vulnerable dependencies, and insecure code patterns
Provides AI agents with access to development best practices, security guidelines, and coding standards.
Scans projects for secret exposure risks in .env files and logs
Strict AI code reviewer powered by Groq. Finds bugs, SQL injections, hardcoded secrets and vulnerabilities. Scores code 0–100 with concrete fixes.
Official MCP server for the pyobfus Python obfuscator — pre-flight risk scan, framework-aware config init, reverse stack-trace mapping
MCP Server Semgrep
POWERED BY:
About the Project
MCP Server Semgrep is a Model Context Protocol compliant server that integrates the powerful Semgrep static analysis tool with AI assistants like Anthropic Claude. It enables advanced code analysis, security vulnerability detection, and code quality improvements directly through a conversational interface.
Benefits of Integration
For Developers and Development Teams:
- Holistic Source Code Analysis - detecting issues throughout the entire project, not just in individual files
- Proactive Error Detection - identifying potential problems before they become critical bugs
- Continuous Code Quality Improvement - regular scanning and refactoring lead to gradual codebase improvements
- Stylistic Consistency - identification and fixing of inconsistencies in code, such as:
- Arbitrary z-index layers in CSS
- Inconsistent naming conventions
- Code duplication
- "Magic numbers" instead of named constants
For Security:
- Automated Code Verification for Known Vulnerabilities - scanning for known security issue patterns
- Customized Security Rules - creating project-specific rules
- Team Education - teaching secure programming practices through detection of potential issues
For Project Maintenance and Development:
- "Live" Documentation - AI can explain why a code fragment is problematic and how to fix it
- Technical Debt Reduction - systematically detecting and fixing problematic areas
- Improved Code Reviews - automatic detection of common issues allows focus on more complex matters
Key Features
- Direct integration with the official MCP SDK
- Simplified architecture with consolidated handlers
- Clean ES Modules implementation
- Efficient error handling and path validation for security
- Interface and documentation in both English and Polish
- Comprehensive unit tests
- Extensive documentation
- Cross-platform compatibility (Windows, macOS, Linux)
- Flexible Semgrep installation detection and management
Functions
Semgrep MCP Server provides the following tools:
- scan_directory: Scanning source code for potential issues
- list_rules: Displaying available rules and languages supported by Semgrep
- analyze_results: Detailed analysis of scan results
- create_rule: Creating custom Semgrep rules
- filter_results: Filtering results by various criteria
- export_results: Exporting results in various formats
- compare_results: Comparing two sets of results (e.g., before and after changes)
Common Use Cases
- Code security analysis before deployment
- Detection of common programming errors
- Enforcing coding standards within a team
- Refactoring and improving quality of existing code
- Identifying inconsistencies in styles and code structure (e.g., CSS, component organization)
- Developer education regarding best practices
- Verification of fix correctness (comparing before/after scans)
Installation
Prerequisites
- Node.js v18+
- TypeScript (for development)
Option 1: Install from Smithery.ai (Recommended)
The easiest way to install and use MCP Server Semgrep is through Smithery.ai:
1. Visit MCP Server Semgrep on Smithery.ai
2. Follow the installation instructions to add it to your MCP-compatible clients
3. Configure any optional settings like the Semgrep API token and allowed workspace roots
This is the recommended method for Claude Desktop and other MCP clients as it handles all dependencies and configuration automatically.
Option 2: Install from NPM Registry
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





