Logotipo de MCP Server Semgrep

MCP Server Semgrep

Organización
vetcoders

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 quality improvements directly through a conversational interface.

Editorvetcoders
Repositoriomcp-server-semgrep
IdiomaJavaScript
Forks
10
Estrellas
28
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    MCP Server Semgrep ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    28 estrellas y 10 forks en el repositorio enlazado.

MCP Server Semgrep

smithery badge mcp-server-semgrep MCP server

POWERED BY:

POWERED BY

About the Project

MCP Server Semgrep Logo This project was initially inspired by robustness of Semgrep tool, The Replit Team and their Agent V2, as well as the implementation by stefanskiasan/semgrep-mcp-server, but has evolved with significant architectural changes for enhanced and easier installation and maintenance.

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
# 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:

Option 3: Install from GitHub

bash
# 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

Option 4: Local Development Setup

  1. Clone the repository:
bash
git clone https://github.com/vetcoders/mcp-server-semgrep.git
cd mcp-server-semgrep
  1. Install dependencies (supports all major package managers):
bash
# Using pnpm (recommended)
pnpm install

# Using npm
npm install

# Using yarn
yarn install
  1. Build the project:
bash
# 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.

Workspace Root Contract

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, set MCP_SERVER_SEMGREP_ALLOWED_ROOTS to one or more absolute directories.
  • Use your platform path delimiter for multiple roots: : on macOS/Linux, ; on Windows.

Authentication Modes

This server does not implement its own Semgrep account handling. It shells out to the installed semgrep CLI and relies on Semgrep's normal authentication behavior.

  • Local terminal and local development runs can often use an existing semgrep login session from the current OS account.
  • Managed launches such as Claude Desktop, Smithery, containers, or CI should prefer an explicit SEMGREP_APP_TOKEN for deterministic behavior.
  • SEMGREP_APP_TOKEN is still the safest option when you need portable configuration across machines or runners.

Semgrep Installation Options

Semgrep can be installed in several ways:

  • Via package managers:

    bash
    # Using pnpm
    pnpm add -g semgrep
    
    # Using npm
    npm install -g semgrep
    
    # Using yarn
    yarn global add semgrep
  • Python pip:

    bash
    pip install semgrep
  • Homebrew (macOS):

    bash
    brew install semgrep
  • Linux:

    bash
    sudo apt-get install semgrep
    # or
    curl -sSL https://install.semgrep.dev | sh
  • Windows:

    bash
    pip install semgrep

Integration with Claude Desktop

There are two ways to integrate MCP Server Semgrep with Claude Desktop:

Method 1: Install via Smithery.ai (Recommended)

  1. Visit MCP Server Semgrep on Smithery.ai
  2. Click "Install in Claude Desktop"
  3. Follow the on-screen instructions

Method 2: Manual Configuration

  1. Install Claude Desktop
  2. Update the Claude Desktop configuration file (claude_desktop_config.json) and add this to your servers section.

For local launches started under a user account that is already authenticated with semgrep login, the Semgrep CLI may be able to reuse that login. For desktop-managed or shared environments, we still recommend setting SEMGREP_APP_TOKEN explicitly:

json
{
  "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"
      }
    }
  }
}
  1. Launch Claude Desktop and start asking questions about code analysis.

If you want to scan more than one workspace, set MCP_SERVER_SEMGREP_ALLOWED_ROOTS to a platform-delimited list of absolute paths.

Usage Examples

Project Scanning

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.

Style Consistency Analysis

Analyze the z-index values in the project's CSS files and identify inconsistencies and potential layer conflicts.

Creating a Custom Rule

Create a Semgrep rule that detects improper use of input sanitization functions.

Filtering Results

Show me only scan results related to SQL injection vulnerabilities.

Identifying Problematic Patterns

Find all "magic numbers" in the code and suggest replacing them with named constants.

Creating Custom Rules

You can create custom rules for your project's specific needs. Here are examples of rules you can create:

Rule to detect inconsistent z-indices:

yaml
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

Rule to detect deprecated imports:

yaml
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

Development

Testing

bash
pnpm test

Project Structure

├── 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

Further Documentation

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"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Developed by

vetcoders

🤖 Developed with the help of Claude Code and MCP Tools

Acknowledgements

Instalación

TypingMind
{
  "mcpServers": {
    "mcp-server-semgrep": {
      "command": "mcp-server-semgrep",
      "args": []
    }
  }
}

Usa el MCP de MCP Server Semgrep con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado MCP Server Semgrep, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade MCP Server Semgrep como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de MCP Server Semgrep.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "mcp-server-semgrep": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-semgrep"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de MCP Server Semgrep y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de MCP Server Semgrep.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar MCP Server Semgrep para ayudarme con esta tarea?
MCP Server Semgrep
Claro. Lo he leído.
Esto he encontrado usando MCP Server Semgrep.

Preguntas frecuentes

¿Para qué sirve el servidor MCP MCP Server Semgrep?

MCP Server Semgrep es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP MCP Server Semgrep con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar MCP Server Semgrep con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de MCP Server Semgrep con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con MCP Server Semgrep conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP MCP Server Semgrep a TypingMind?

MCP Server Semgrep funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP MCP Server Semgrep en TypingMind?

MCP Server Semgrep ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP MCP Server Semgrep?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si MCP Server Semgrep requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇