Skip to main content
Glama

Trivy

Official
by aquasecurity

Trivy MCP 服务器插件

该插件启动一个模型上下文协议 (MCP) 服务器,将 Trivy 的安全扫描功能与 VS Code 和其他支持 MCP 的工具集成在一起。

[!IMPORTANT] 这是 MCP 服务器的早期开发阶段,因此您应该假设目前情况不会很好

特征

  • 自然语言扫描:用自然语言询问有关安全问题
  • 多种扫描类型
    • 本地项目的文件系统扫描
    • 容器镜像漏洞扫描
    • 远程存储库安全性分析
  • 与 Aqua 平台集成:可选与 Aqua Security 平台集成,以增强扫描功能
  • 灵活传输:支持 stdio 和 SSE(服务器发送事件)传输协议
  • VS Code 集成:与 VS Code 的聊天界面无缝集成

安装插件

要安装插件,您可以使用 Trivy 的插件管理系统

trivy plugin install mcp

将安装最新版本的插件

启动插件

现在您可以启动插件了,这将启动一个可与 Cursor 或 VSCode 交互的 MCP 服务器。目前,本指南将主要介绍 VSCode。

trivy mcp

可用选项

选项价值观默认描述
--transport / -tsse stdiostdioMCP 服务器的传输协议
--port / -p23456SSE 传输模式的端口
--trivy-binary自定义 Trivy 二进制路径(可选)
--use-aqua-platform / atrue/falsefalse启用 Aqua 平台集成
--debugtrue/falsefalse启用调试日志记录

验证

MCP 服务器通过auth命令支持与 Aqua 平台集成:

# Save Aqua Platform credentials trivy mcp auth login --key "YOUR_AQUA_KEY" --secret "YOUR_AQUA_SECRET" --region "YOUR_REGION" # Clear saved credentials trivy mcp auth logout # Verify saved credentials trivy mcp auth status

可用的身份验证选项

选项描述
--keyAqua 平台 API 密钥
--secretAqua 平台 API 机密
--regionAqua 平台区域(例如“us-east-1”)

配置凭据后,您可以通过使用--use-aqua-platform标志启动服务器来使用 Aqua Platform 功能:

trivy mcp --use-aqua-platform

凭证安全地存储在特定于平台的密钥链中。

在 VSCode 中配置 MCP 服务器

现在,我们需要在 VSCode 中配置服务器以开始用作代理

先决条件

  • = VS Code 版本 1.99.0

配置插件

您可以配置 Trivy mcp 自行启动或使用 sse http 端点

配置 stdio
  1. 在 VS Code 中,按F1
  2. 搜索"Preferences: Open User Settings (JSON)"
  3. 查找或创建"mcp"块并添加服务器,如下所示
    "mcp": { "servers": { "Trivy MCP": { "command": "trivy", "args": [ "mcp", "-t", "stdio" ] } } }
  4. 保存后,将出现一条注释以Start服务器
配置 SSE HTTP
  1. 启动 MCP 服务器
    trivy mcp -t sse -p 23456
  2. 在 VS Code 中,按F1
  3. 搜索"Preferences: Open User Settings (JSON)"
  4. 查找或创建"mcp"块并添加服务器,如下所示
    "mcp": { "servers": { "Trivy SSE": { "type": "sse", "url": "http://localhost:23456/sse" } } }
  5. 保存后,将出现一条注释以Start服务器

示例查询

重要提示:请确保在Agent模式下使用聊天窗口,而不是在Ask模式下

本地项目分析

Are there any vulnerabilities or misconfigurations in this project?
Find all HIGH severity vulnerabilities in this codebase
Generate a CycloneDX SBOM for this project

容器镜像扫描

Does the python:3.12 image have any vulnerabilities?
Show me all critical security issues in the nginx:latest image
What are the licenses used by dependencies in the node:18 image?

存储库分析

What are the vulnerabilities in github.com/aquasecurity/trivy-ci-test?
Check for misconfigurations in kubernetes/kubernetes repository

高级用法

Scan this project for secrets and license issues only
Generate an SPDX SBOM and show me any dependency vulnerabilities
What security issues were fixed in the latest version of this image?
-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

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

琐事

  1. 特征
    1. 安装插件
      1. 启动插件
        1. 可用选项
      2. 验证
        1. 可用的身份验证选项
      3. 在 VSCode 中配置 MCP 服务器
        1. 先决条件
        2. 配置插件
      4. 示例查询
        1. 本地项目分析
        2. 容器镜像扫描
        3. 存储库分析
        4. 高级用法

      Related MCP Servers

      • -
        security
        A
        license
        -
        quality
        Tavily AI search API
        Last updated -
        1
        26
        Python
        MIT License
        • Apple
        • Linux
      • -
        security
        A
        license
        -
        quality
        Algolia
        Last updated -
        18
        Go
        MIT License
        • Apple
      • A
        security
        A
        license
        A
        quality
        Liveblocks
        Last updated -
        39
        1
        TypeScript
        Apache 2.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/aquasecurity/trivy-mcp'

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