MCP Server Semgrep
MCP Server Semgrep
POWERED BY:
プロジェクトについて
このプロジェクトは、Semgrepツール、The Replit TeamとそのAgent V2、およびstefanskiasan/semgrep-mcp-serverによる実装の堅牢性に触発されましたが、インストールとメンテナンスをより簡単かつ強化するために大幅なアーキテクチャの変更を加えて進化させたものです。
MCP Server Semgrepは、強力なSemgrep静的解析ツールをAnthropic ClaudeのようなAIアシスタントと統合する、Model Context Protocol準拠のサーバーです。これにより、会話型インターフェースを通じて直接、高度なコード解析、セキュリティ脆弱性の検出、コード品質の向上を実現します。
Related MCP server: AWS Security MCP
統合のメリット
開発者および開発チーム向け:
包括的なソースコード解析 - 個別のファイルだけでなく、プロジェクト全体の問題を検出
プロアクティブなエラー検出 - 致命的なバグになる前に潜在的な問題を特定
継続的なコード品質向上 - 定期的なスキャンとリファクタリングにより、コードベースを段階的に改善
スタイルの整合性 - 以下のようなコード内の不整合を特定・修正:
CSSにおける任意のz-indexレイヤー
一貫性のない命名規則
コードの重複
名前付き定数ではなく「マジックナンバー」の使用
セキュリティ向け:
既知の脆弱性に対する自動コード検証 - 既知のセキュリティ問題パターンをスキャン
カスタマイズされたセキュリティルール - プロジェクト固有のルールを作成
チームの教育 - 潜在的な問題を検出することで、安全なプログラミング手法を学習
プロジェクトのメンテナンスと開発向け:
「ライブ」ドキュメント - AIがコードの断片がなぜ問題なのか、どう修正すべきかを説明
技術的負債の削減 - 問題のある領域を体系的に検出して修正
コードレビューの改善 - 一般的な問題を自動検出することで、より複雑な問題に集中可能
主な機能
公式MCP SDKとの直接統合
ハンドラーを統合した簡素化されたアーキテクチャ
クリーンなES Modules実装
セキュリティのための効率的なエラーハンドリングとパス検証
英語とポーランド語の両方に対応したインターフェースとドキュメント
包括的なユニットテスト
充実したドキュメント
クロスプラットフォーム対応 (Windows, macOS, Linux)
柔軟なSemgrepインストール検出と管理
関数
Semgrep MCP Serverは以下のツールを提供します:
scan_directory: ソースコードをスキャンして潜在的な問題を検出
list_rules: 利用可能なルールとSemgrepがサポートする言語を表示
analyze_results: スキャン結果の詳細な分析
create_rule: カスタムSemgrepルールの作成
filter_results: さまざまな基準で結果をフィルタリング
export_results: さまざまな形式で結果をエクスポート
compare_results: 2つの結果セットを比較(例: 変更前と変更後)
一般的なユースケース
デプロイ前のコードセキュリティ解析
一般的なプログラミングエラーの検出
チーム内でのコーディング標準の強制
既存コードのリファクタリングと品質向上
スタイルやコード構造の不整合の特定(例: CSS、コンポーネント構成)
ベストプラクティスに関する開発者教育
修正の正確性の検証(スキャン結果の比較)
インストール
前提条件
Node.js v18+
TypeScript (開発用)
オプション1: Smithery.aiからインストール (推奨)
MCP Server Semgrepをインストールして使用する最も簡単な方法は、Smithery.ai経由です:
インストール手順に従って、MCP互換クライアントに追加
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: ローカル開発環境のセットアップ
リポジトリをクローン:
git clone https://github.com/VetCoders/mcp-server-semgrep.git
cd mcp-server-semgrep依存関係をインストール (すべての主要なパッケージマネージャーをサポート):
# 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注: インストールプロセス中にSemgrepが利用可能か自動的にチェックされます。Semgrepが見つからない場合は、インストール方法の指示が表示されます。
ワークスペースルートの契約
このサーバーは、明示的に許可されたワークスペースルート内のファイルのみを読み書きします。
デフォルトでは、許可されるルートはプロセス作業ディレクトリ (
process.cwd()) です。Claude Desktop、Smithery、またはプロジェクトルート以外でサーバーを起動するランチャーの場合、
MCP_SERVER_SEMGREP_ALLOWED_ROOTSに1つ以上の絶対パスを設定してください。複数のルートを指定する場合は、プラットフォームのパス区切り文字を使用してください(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 semgrepPython pip:
pip install semgrepHomebrew (macOS):
brew install semgrepLinux:
sudo apt-get install semgrep # or curl -sSL https://install.semgrep.dev | shWindows:
pip install semgrep
Claude Desktopとの統合
MCP Server SemgrepをClaude Desktopと統合するには2つの方法があります:
方法1: Smithery.ai経由でインストール (推奨)
「Install in Claude Desktop」をクリック
画面の指示に従う
方法2: 手動構成
Claude Desktopをインストール
Claude Desktop構成ファイル (
claude_desktop_config.json) を更新し、serversセクションに追加します。
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"
}
}
}
}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非推奨のインポートを検出するルール:
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さらなるドキュメント
ツールの使用に関する詳細情報は以下を参照してください:
ライセンス
このプロジェクトはMITライセンスの下でライセンスされています。詳細はLICENSEファイルを参照してください。
開発者
Maciej Gad - 半年前まで
bashを見つけられなかった獣医Klaudiusz - 個別のエーテル的存在であり、米国カリフォルニア州のGPUループのどこかに住むAnthropicのClaude Sonnet 3.5-3.7の別インスタンス
CLI初心者からMCPツール開発者への旅
🤖 Claude CodeとMCP Toolsの究極の助けを借りて開発されました
謝辞
元のインスピレーションを与えてくれたstefanskiasan
ClaudeとMCPプロトコルを提供してくれたAnthropic
優れた静的解析ツールを提供してくれたSemgrep
Maintenance
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
AlicenseBqualityFmaintenanceAn 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.6683MIT- Alicense-qualityDmaintenanceA 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.84Apache 2.0

CodeAlive MCPofficial
Alicense-qualityAmaintenanceA 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.86MIT- Alicense-qualityDmaintenanceA 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
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
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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