Skip to main content
Glama
VetCoders

MCP Server Semgrep

by VetCoders

MCP 서버 Semgrep

제공:

POWERED BY

프로젝트 소개

MCP Server Semgrep Logo 이 프로젝트는 Semgrep 도구, Replit 팀과 그들의 Agent V2, 그리고 stefanskiasan/semgrep-mcp-server의 구현에서 영감을 받았으나, 더 쉽고 향상된 설치 및 유지 관리를 위해 상당한 아키텍처 변경을 거쳐 발전했습니다.

MCP 서버 Semgrep은 강력한 Semgrep 정적 분석 도구를 Anthropic Claude와 같은 AI 어시스턴트와 통합하는 Model Context Protocol 호환 서버입니다. 이를 통해 대화형 인터페이스를 통해 직접 고급 코드 분석, 보안 취약점 탐지 및 코드 품질 개선을 수행할 수 있습니다.

Related MCP server: AWS Security MCP

통합의 이점

개발자 및 개발 팀을 위한 이점:

  • 전체 소스 코드 분석 - 개별 파일뿐만 아니라 전체 프로젝트에 걸쳐 문제 탐지

  • 사전 오류 탐지 - 치명적인 버그가 되기 전에 잠재적 문제 식별

  • 지속적인 코드 품질 개선 - 정기적인 스캔 및 리팩토링을 통한 점진적인 코드베이스 개선

  • 스타일 일관성 - 다음과 같은 코드 내 불일치 식별 및 수정:

    • CSS의 임의적인 z-index 레이어

    • 일관되지 않은 명명 규칙

    • 코드 중복

    • 명명된 상수 대신 사용된 "매직 넘버"

보안을 위한 이점:

  • 알려진 취약점에 대한 자동 코드 검증 - 알려진 보안 문제 패턴 스캔

  • 맞춤형 보안 규칙 - 프로젝트별 규칙 생성

  • 팀 교육 - 잠재적 문제 탐지를 통한 안전한 프로그래밍 관행 교육

프로젝트 유지 관리 및 개발을 위한 이점:

  • "라이브" 문서화 - AI가 코드 조각이 왜 문제가 되는지, 어떻게 수정해야 하는지 설명

  • 기술 부채 감소 - 문제 영역을 체계적으로 탐지 및 수정

  • 코드 리뷰 개선 - 일반적인 문제의 자동 탐지를 통해 더 복잡한 문제에 집중 가능

주요 기능

  • 공식 MCP SDK와 직접 통합

  • 통합 핸들러를 사용한 단순화된 아키텍처

  • 깔끔한 ES 모듈 구현

  • 보안을 위한 효율적인 오류 처리 및 경로 검증

  • 영어 및 폴란드어 인터페이스와 문서 제공

  • 포괄적인 단위 테스트

  • 광범위한 문서화

  • 크로스 플랫폼 호환성 (Windows, macOS, Linux)

  • 유연한 Semgrep 설치 탐지 및 관리

기능

Semgrep MCP 서버는 다음과 같은 도구를 제공합니다:

  • scan_directory: 잠재적 문제에 대한 소스 코드 스캔

  • list_rules: Semgrep에서 지원하는 사용 가능한 규칙 및 언어 표시

  • analyze_results: 스캔 결과에 대한 상세 분석

  • create_rule: 사용자 정의 Semgrep 규칙 생성

  • filter_results: 다양한 기준에 따른 결과 필터링

  • export_results: 다양한 형식으로 결과 내보내기

  • compare_results: 두 결과 세트 비교 (예: 변경 전후)

일반적인 사용 사례

  • 배포 전 코드 보안 분석

  • 일반적인 프로그래밍 오류 탐지

  • 팀 내 코딩 표준 강제

  • 기존 코드의 리팩토링 및 품질 개선

  • 스타일 및 코드 구조의 불일치 식별 (예: CSS, 컴포넌트 구성)

  • 모범 사례에 관한 개발자 교육

  • 수정 사항의 정확성 검증 (스캔 전/후 비교)

설치

사전 요구 사항

  • Node.js v18+

  • TypeScript (개발용)

옵션 1: Smithery.ai에서 설치 (권장)

MCP 서버 Semgrep을 설치하고 사용하는 가장 쉬운 방법은 Smithery.ai를 통하는 것입니다:

  1. Smithery.ai의 MCP 서버 Semgrep 방문

  2. 설치 지침에 따라 MCP 호환 클라이언트에 추가

  3. Semgrep API 토큰 및 허용된 작업 공간 루트와 같은 선택적 설정 구성

이 방법은 모든 종속성과 구성을 자동으로 처리하므로 Claude Desktop 및 기타 MCP 클라이언트에 권장되는 방법입니다.

옵션 2: NPM 레지스트리에서 설치

# Using npm
npm install -g mcp-server-semgrep

# Using pnpm
pnpm add -g mcp-server-semgrep

# Using yarn
yarn global add mcp-server-semgrep

이 패키지는 다른 레지스트리에서도 사용할 수 있습니다:

옵션 3: GitHub에서 설치

# 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

옵션 4: 로컬 개발 설정

  1. 저장소 복제:

git clone https://github.com/VetCoders/mcp-server-semgrep.git
cd mcp-server-semgrep
  1. 종속성 설치 (모든 주요 패키지 관리자 지원):

# Using pnpm (recommended)
pnpm install

# Using npm
npm install

# Using yarn
yarn install
  1. 프로젝트 빌드:

# Using pnpm
pnpm run build

# Using npm
npm run build

# Using yarn
yarn build

참고: 설치 과정에서 Semgrep 사용 가능 여부를 자동으로 확인합니다. Semgrep을 찾을 수 없는 경우 설치 방법에 대한 지침이 제공됩니다.

작업 공간 루트 계약

이 서버는 명시적으로 허용된 작업 공간 루트 내부의 파일만 읽고 씁니다.

  • 기본적으로 허용된 루트는 프로세스 작업 디렉토리(process.cwd())입니다.

  • Claude Desktop, Smithery 또는 프로젝트 루트 내부에서 서버를 시작하지 않는 런처의 경우, MCP_SERVER_SEMGREP_ALLOWED_ROOTS를 하나 이상의 절대 경로 디렉토리로 설정하십시오.

  • 여러 루트를 지정하려면 플랫폼 경로 구분 기호를 사용하십시오: macOS/Linux는 :, Windows는 ;.

인증 모드

이 서버는 자체적인 Semgrep 계정 처리를 구현하지 않습니다. 설치된 semgrep CLI를 호출하며 Semgrep의 일반적인 인증 동작에 의존합니다.

  • 로컬 터미널 및 로컬 개발 실행은 종종 현재 OS 계정의 기존 semgrep login 세션을 사용할 수 있습니다.

  • Claude Desktop, Smithery, 컨테이너 또는 CI와 같은 관리형 실행 환경에서는 결정론적 동작을 위해 명시적인 SEMGREP_APP_TOKEN을 사용하는 것이 좋습니다.

  • SEMGREP_APP_TOKEN은 여러 머신이나 러너 간에 이식 가능한 구성이 필요할 때 가장 안전한 옵션입니다.

Semgrep 설치 옵션

Semgrep은 여러 가지 방법으로 설치할 수 있습니다:

  • 패키지 관리자 사용:

# Using pnpm
pnpm add -g semgrep

# Using npm
npm install -g semgrep

# Using yarn
yarn global add semgrep
  • Python pip:

pip install semgrep
  • Homebrew (macOS):

brew install semgrep
  • Linux:

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

pip install semgrep

Claude Desktop과의 통합

MCP 서버 Semgrep을 Claude Desktop과 통합하는 두 가지 방법이 있습니다:

방법 1: Smithery.ai를 통해 설치 (권장)

  1. Smithery.ai의 MCP 서버 Semgrep 방문

  2. "Install in Claude Desktop" 클릭

  3. 화면의 지침을 따름

방법 2: 수동 구성

  1. Claude Desktop 설치

  2. Claude Desktop 구성 파일(claude_desktop_config.json)을 업데이트하고 서버 섹션에 추가.

semgrep login으로 이미 인증된 사용자 계정에서 시작된 로컬 실행의 경우, Semgrep CLI가 해당 로그인을 재사용할 수 있습니다. 데스크톱 관리형 또는 공유 환경의 경우, 여전히 SEMGREP_APP_TOKEN을 명시적으로 설정하는 것을 권장합니다:

{
  "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. Claude Desktop을 실행하고 코드 분석에 대해 질문 시작.

둘 이상의 작업 공간을 스캔하려면 MCP_SERVER_SEMGREP_ALLOWED_ROOTS를 플랫폼 구분 기호로 구분된 절대 경로 목록으로 설정하십시오.

사용 예시

프로젝트 스캔

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.

사용자 정의 규칙 생성

프로젝트의 특정 요구 사항에 맞는 사용자 정의 규칙을 만들 수 있습니다. 만들 수 있는 규칙의 예는 다음과 같습니다:

일관되지 않은 z-index 탐지 규칙:

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

더 이상 사용되지 않는(deprecated) import 탐지 규칙:

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

개발

테스트

pnpm test

프로젝트 구조

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

추가 문서

도구 사용에 대한 자세한 정보는 다음에서 확인할 수 있습니다:

  • USAGE.md - 상세 사용 지침

  • README_PL.md - 폴란드어 문서

  • examples/ - 재미있고 실용적인 Semgrep 규칙 예시 - "The Hall of Code Horrors"

라이선스

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 LICENSE 파일을 참조하십시오.

개발자

  • Maciej Gad - 반년 전 bash를 찾지 못했던 수의사

  • Klaudiusz - 개별적인 영적 존재이자, 미국 캘리포니아의 GPU 루프 어딘가에 살고 있는 Anthropic의 Claude Sonnet 3.5-3.7의 별도 인스턴스

CLI 초보자에서 MCP 도구 개발자로의 여정

🤖 Claude CodeMCP 도구의 궁극적인 도움을 받아 개발됨

감사의 말

Install Server
A
license - permissive license
B
quality
A
maintenance

Maintenance

Maintainers
18dResponse time
Release cycle
1Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    F
    maintenance
    An MCP server that provides a comprehensive interface to Semgrep, enabling users to scan code for security vulnerabilities, create custom rules, and analyze scan results through the Model Context Protocol.
    6
    683
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that connects AI assistants like Claude to AWS security services, allowing them to autonomously query, inspect, and analyze AWS infrastructure for security issues and misconfigurations.
    84
    Apache 2.0
  • A
    license
    -
    quality
    A
    maintenance
    A Model Context Protocol server that enhances AI agents by providing deep semantic understanding of codebases, enabling more intelligent interactions through advanced code search and contextual awareness.
    86
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that analyzes application codebases with real-time file watching, providing AI assistants like Claude with deep insights into project structure, code patterns, and architecture.
    MIT

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Hosted MCP server for structured code review passes on human- and AI-written code. Free tier.

  • A Model Context Protocol server for Wix AI tools

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VetCoders/mcp-server-semgrep'

If you have feedback or need assistance with the MCP directory API, please join our Discord server