Skip to main content
Glama
norbinsh

Trivy Security Scanner MCP Server

by norbinsh

Trivy セキュリティ スキャナー MCP サーバー

標準化されたインターフェースを通じて Trivy セキュリティ スキャン機能を提供するモデル コンテキスト プロトコル (MCP) サーバー。

⚠️注:これは、MCP、Cursor IDE、Trivy の統合機能を実証するための概念実証プロジェクトです。実験と学習のみを目的としており、本番環境での使用には対応していません。自己責任でご利用ください。

特徴

  • 🔍プロジェクトスキャン: Trivy を使用してプロジェクトディレクトリのセキュリティ脆弱性を自動的にスキャンします

  • 🛠️自動修正: 脆弱な依存関係を安全なバージョンに自動的に更新します

  • 📦マルチパッケージサポート:複数のパッケージマネージャー(Python、Node.js、Ruby、Go)に対応

デモ

デモ

Related MCP server: MCP SBOM Server

建築

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│  Cursor IDE │ --> │   MCP Server │ --> │    Trivy    │
│  (Composer) │     │              │     │             │
└─────────────┘     └──────────────┘     └─────────────┘

前提条件

  • Python 3.12以上

  • システムにインストールされた Trivy:

    # macOS
    brew install trivy

インストール

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

使用法

SSE トランスポートを使用してサーバーを起動します。

# Using SSE transport (default)
python server.py --transport sse --port 54321

サーバーは 2 つのツールを公開します。

  1. scan_project : ディレクトリのセキュリティ脆弱性をスキャンします

    • 必須引数: workspace - スキャンするディレクトリパス

  2. fix_vulnerability : 脆弱なパッケージを安全なバージョンに更新する

    • 必要な引数:

      • workspace - 変更するディレクトリ

      • pkg_name - 更新するパッケージの名前

      • target_version - 更新するバージョン

カーソルIDEでの使用

  1. SSE トランスポートを使用してサーバーを起動します。

    python server.py --transport sse --port 54321
  2. カーソルで設定:

    • 設定を開く

    • 機能 > MCPサーバーへ移動

    • 追加: http://127.0.0.1:54321/sse

  3. 次の内容を .cursorrules ファイルに追加します (まだファイルがない場合は作成してください)。

    After making changes in any of the package dependency/manifest files, scan the project for security vulnerabilities.
    Fixes should only be according to the desired version reported by the scanner.
    If the scanner reports a fix unrelated to our change, ignore it.
    After performing the fix, scan the project for security vulnerabilities again.

    この構成では次のようになります。

    • 依存ファイルが変更されると、自動的にセキュリティスキャンを実行します。

    • 新しい依存関係が追加されたらすぐに脆弱性を特定できるように支援します

    • 開発全体を通してプロジェクトの安全性を確保する

    ツールを手動で使用したい場合は、コンポーザー インターフェースから次のプロンプトを使用して、エージェントにツールを使用するように指示することができます。

    Please scan my project for security vulnerabilities

なぜMCPなのか?

MCP (モデル コンテキスト プロトコル) は、大規模言語モデル (LLM) を扱う際の基本的な問題、つまりこれらのモデルを外部のデータ ソースやツールに効率的かつ一貫して接続する方法を解決するために存在します。

詳細については、 modelcontextprotocol.ioをご覧ください。

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

MITライセンス

謝辞

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Automatically scans project dependencies (npm, Composer) for security vulnerabilities using the OSV.dev database, providing real-time alerts and detailed remediation guidance directly in your IDE.
    1
    9 npm
    1
    MIT
  • F
    license
    A
    quality
    Not graded
    maintenance
    Performs vulnerability scans using Trivy to generate Software Bill of Materials (SBOM) in CycloneDX format. It enables automated security auditing and dependency tracking through the Model Context Protocol.
    1
    -
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Provides tools for autonomous CVE detection, enrichment, and remediation across managed repositories using GHSA and NVD data. It enables automated triage and pull request creation for dependency fixes based on configurable severity policies.
    -