Skip to main content
Glama

Semgrep MCP Server

Official
by semgrep

Semgrep MCP 서버

Semgrep을 사용하여 코드의 보안 취약점을 검사하는 모델 컨텍스트 프로토콜(MCP) 서버입니다. 바이브 코딩을 안전하게 보호하세요! 😅

모델 컨텍스트 프로토콜(MCP) 은 LLM, 에이전트, 그리고 Cursor, VS Code, Windsurf 등 MCP를 지원하는 모든 IDE를 위한 표준화된 API로, 전문적인 지원, 컨텍스트 파악, 그리고 도구의 강력한 기능을 활용할 수 있도록 합니다. Semgrep은 여러 언어를 의미적으로 이해하고 5,000개 이상의 규칙을 제공하는 빠르고 결정론적인 정적 분석 도구입니다. 🛠️

[!NOTE] 이 베타 프로젝트는 현재 개발 중입니다. 여러분의 피드백, 버그 리포트, 기능 요청, 그리고 코드를 공유해 주세요. #mcp 커뮤니티 Slack 채널에 참여하세요!

내용물

시작하기

uv 사용하여 Python 패키지를 CLI 명령으로 실행합니다.

지엑스피1

또는 Docker 컨테이너 로 실행합니다.

docker run -i --rm ghcr.io/semgrep/mcp -t stdio

커서

예제 mcp.json

{ "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"], "env": { "SEMGREP_APP_TOKEN": "<token>" } } } }

.cursor/rules 에 자동으로 사용할 지침을 추가하세요.

Always scan code generated using Semgrep for security vulnerabilities

호스팅 서버

[!경고] 이 서버는 실험용이므로 작동이 중단될 수 있습니다. MCP 사양이 조만간 HTTP 스트리밍 및 OAuth를 지원하게 되면 새로운 기능이 추가될 예정입니다. 🚀

mcp.json

{ "mcpServers": { "semgrep": { "url": "https://mcp.semgrep.ai/sse" } } }

데모

API

도구

LLM이 작업을 수행하고, 결정론적 계산을 수행하고, 외부 서비스와 상호 작용할 수 있도록 합니다.

스캔 코드
  • security_check : 보안 취약점을 검사하는 코드
  • semgrep_scan : 지정된 구성 문자열을 사용하여 보안 취약점에 대한 코드 파일을 스캔합니다.
  • semgrep_scan_with_custom_rule : 사용자 정의 Semgrep 규칙을 사용하여 코드 파일 스캔
코드 이해
  • get_abstract_syntax_tree : 코드의 추상 구문 트리(AST)를 출력합니다.
메타
  • supported_languages : Semgrep이 지원하는 언어 목록을 반환합니다.
  • semgrep_rule_schema : 최신 semgrep 규칙 JSON 스키마를 가져옵니다.

프롬프트

일반적인 LLM 상호작용을 표준화하기 위한 재사용 가능한 프롬프트입니다.

  • write_custom_semgrep_rule : Semgrep 규칙을 작성하는 데 도움이 되는 프롬프트를 반환합니다.

자원

LLM에 데이터와 콘텐츠 공개

  • semgrep://rule/schema : JSON 스키마를 사용한 Semgrep 규칙 YAML 구문의 사양
  • semgrep://rule/{rule_id}/yaml : Semgrep 레지스트리의 YAML 형식의 전체 Semgrep 규칙

용법

이 Python 패키지는 PyPI에 semgrep-mcp 라는 이름으로 게시되었으며 pip , pipx , uv , poetry 또는 모든 Python 패키지 관리자를 사용하여 설치하고 실행할 수 있습니다.

$ pipx install semgrep-mcp $ semgrep-mcp --help Usage: semgrep-mcp [OPTIONS] Entry point for the MCP server Supports both stdio and sse transports. For stdio, it will read from stdin and write to stdout. For sse, it will start an HTTP server on port 8000. Options: -v, --version Show version and exit. -t, --transport [stdio|sse] Transport protocol to use (stdio or sse) -h, --help Show this message and exit.

표준 입출력(stdio)

stdio 전송은 표준 입출력 스트림을 통한 통신을 가능하게 합니다. 이는 특히 로컬 통합 및 명령줄 도구에 유용합니다. 자세한 내용은 사양을 참조하세요.

파이썬
semgrep-mcp

기본적으로 Python 패키지는 stdio 모드에서 실행됩니다. 표준 입출력 스트림을 사용하기 때문에 도구가 출력 없이 멈춰 있는 것처럼 보일 수 있지만, 이는 예상된 결과입니다.

도커

이 서버는 Github의 컨테이너 레지스트리( ghcr.io/semgrep/mcp )에 게시되었습니다.

docker run -i --rm ghcr.io/semgrep/mcp -t stdio

기본적으로 Docker 컨테이너는 SSE 모드이므로 이미지 이름 뒤에 -t stdio 포함하고 -i 옵션을 사용하여 대화 형 모드로 실행해야 합니다.

서버에서 보낸 이벤트(SSE)

SSE 전송은 클라이언트-서버 통신을 위한 HTTP POST 요청을 통해 서버-클라이언트 스트리밍을 지원합니다. 자세한 내용은 사양을 참조하세요.

기본적으로 서버는 0.0.0.0:8000/sse 에서 클라이언트 연결을 수신합니다. 이 설정을 변경하려면 FASTMCP_* 환경 변수를 설정하세요. 클라이언트가 서버에 연결하려면 서버가 실행 중이어야 합니다.

파이썬
semgrep-mcp -t sse

기본적으로 Python 패키지는 stdio 모드에서 실행되므로 -t sse 포함해야 합니다.

도커
docker run -p 8000:0000 ghcr.io/semgrep/mcp

Semgrep AppSec 플랫폼

선택적으로 Semgrep AppSec 플랫폼에 연결하려면 다음을 수행합니다.

  1. 로그인 또는 가입
  2. 설정 에서 토큰 생성
  3. 환경 변수에 토큰을 추가합니다.
    • CLI( export SEMGREP_APP_TOKEN=<token> )
    • 도커( docker run -e SEMGREP_APP_TOKEN=<token> )
    • MCP 구성 JSON
"env": { "SEMGREP_APP_TOKEN": "<token>" }

[!TIP] 필요하시면 support@semgrep.com 으로 문의해 주세요.☎️

통합

커서 IDE

~/.cursor/mcp.json 글로벌 구성 파일이나 .cursor/mcp.json 프로젝트별 구성 파일에 다음 JSON 블록을 추가합니다.

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

커서 MCP 설정

자세한 내용은 커서 문서를 참조하세요.

VS 코드 / 코파일럿

가장 빠른 설치를 위해 이 README 상단의 설치 버튼을 클릭하세요.

수동 구성

VS Code의 사용자 설정(JSON) 파일에 다음 JSON 블록을 추가합니다. Ctrl + Shift + P 를 누르고 Preferences: Open User Settings (JSON) 입력하면 됩니다.

{ "mcp": { "servers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } }

선택적으로 작업 공간의 .vscode/mcp.json 이라는 파일에 추가할 수 있습니다.

{ "servers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } }
Docker 사용하기
{ "mcp": { "servers": { "semgrep": { "command": "docker", "args": [ "run", "-i", "--rm", "ghcr.io/semgrep/mcp", "-t", "stdio" ] } } } }

자세한 내용은 VS Code 문서를 참조하세요.

윈드서핑

~/.codeium/windsurf/mcp_config.json 파일에 다음 JSON 블록을 추가합니다.

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

자세한 내용은 윈드서핑 문서를 참조하세요.

클로드 데스크탑

다음은 Claude Desktop이 이 서버를 사용하여 사용자 지정 규칙을 작성하는 방법을 보여주는 짧은 비디오 입니다.

다음 JSON 블록을 claude_desktop_config.json 파일에 추가하세요.

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

자세한 내용은 Anthropic 문서를 참조하세요.

오픈AI

async with MCPServerStdio( params={ "command": "uvx", "args": ["semgrep-mcp"], } ) as server: tools = await server.list_tools()

자세한 내용은 OpenAI Agents SDK 문서를 참조하세요.

맞춤형 클라이언트

Python SSE 클라이언트 예제

전체 예제는 examples/sse_client.py 에서 확인하세요.

from mcp.client.session import ClientSession from mcp.client.sse import sse_client async def main(): async with sse_client("http://localhost:8000/sse") as (read_stream, write_stream): async with ClientSession(read_stream, write_stream) as session: await session.initialize() results = await session.call_tool( "semgrep_scan", { "code_files": [ { "filename": "hello_world.py", "content": "def hello(): print('Hello, World!')", } ] }, ) print(results)

[!TIP] 일부 클라이언트 라이브러리는 URL : http://localhost:8000/sse 를 원하고, 다른 라이브러리는 HOST : localhost:8000 만 원합니다. 웹 브라우저에서 URL 입력하여 서버가 실행 중인지, 네트워크 문제가 없는지 확인하세요.

자세한 내용은 공식 SDK 문서를 참조하세요.

기여, 커뮤니티 및 소스에서 실행

[!NOTE] 여러분의 피드백, 버그 신고, 기능 요청, 그리고 코드를 환영합니다. #mcp 커뮤니티 Slack 채널에 참여하세요!

MCP 서버에서 소스 코드를 사용하여 실행하는 방법에 대한 자세한 내용과 세부 사항은 CONTRIBUTING.md를 ��조하세요.

비슷한 도구 🔍

커뮤니티 프로젝트 🌟

MCP 서버 레지스트리


Semgrep 팀 이 ❤️로 만들었습니다

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Semgrep에 대한 포괄적인 인터페이스를 제공하는 MCP 서버로, 사용자가 보안 취약점에 대한 코드를 스캔하고, 사용자 정의 규칙을 만들고, Model Context Protocol을 통해 스캔 결과를 분석할 수 있도록 합니다.

  1. 내용물
    1. 시작하기
      1. 커서
      2. 호스팅 서버
    2. 데모
      1. API
        1. 도구
        2. 프롬프트
        3. 자원
      2. 용법
        1. 표준 입출력(stdio)
        2. 서버에서 보낸 이벤트(SSE)
      3. Semgrep AppSec 플랫폼
        1. 통합
          1. 커서 IDE
          2. VS 코드 / 코파일럿
          3. 윈드서핑
          4. 클로드 데스크탑
          5. 오픈AI
          6. 맞춤형 클라이언트
        2. 기여, 커뮤니티 및 소스에서 실행
          1. 비슷한 도구 🔍
          2. 커뮤니티 프로젝트 🌟
          3. MCP 서버 레지스트리

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
          Last updated -
          4
          3
          TypeScript
          MIT License
        • -
          security
          A
          license
          -
          quality
          Enables integration of Semgrep in development environments via the MCP protocol, supporting static code analysis, rule management, and scan result operations.
          Last updated -
          1
          JavaScript
          MIT License
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol (MCP) server for querying the CVE-Search API. This server provides comprehensive access to CVE-Search, browse vendor and product、get CVE per CVE-ID、get the last updated CVEs.
          Last updated -
          6
          15
          Python
          MIT License
        • -
          security
          A
          license
          -
          quality
          A server implementation that exposes grep functionality through the Model Context Protocol, allowing MCP-compatible clients to search for patterns in files using regular expressions.
          Last updated -
          1
          Python
          GPL 3.0

        View all related MCP servers

        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/semgrep/mcp'

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