Back to MCP directory
publicPublicdnsLocal runtime

Garak-MCP

一个轻量级的MCP服务器,用于支持Garak LLM漏洞扫描工具,提供模型类型列表、模型列表、攻击探测列表等功能,并可运行攻击测试生成报告。

article

README

🚀 MCP 服务器用于 Garak LLM 漏洞扫描器

这是一个轻量级的 MCP(模型上下文协议)服务器,专为 Garak 打造,可助力进行 LLM 漏洞扫描。

示例链接: https://github.com/user-attachments/assets/f6095d26-2b79-4ef7-a889-fd6be27bbbda

🚀 快速开始

本 MCP 服务器可用于 Garak 进行 LLM 漏洞扫描,通过提供的一系列工具,能方便地列出模型类型、模型、攻击探测器,获取报告以及运行攻击等操作。

✨ 主要特性

  • 提供多种工具,可列出可用的模型类型、模型、Garak 攻击/探测器,获取报告并运行攻击。
  • 支持多种模型类型,如 ollama、openai、huggingface、ggml。
  • 可在多个平台上进行测试,如 Cursor 和 Claude Desktop。

📦 安装指南

先决条件

  1. Python 3.11 或更高版本:此项目要求 Python 3.11 或更晚版本。
    # 检查你的 Python 版本
    python --version
    
  2. 安装 uv:一个快速的 Python 包安装程序和解析器。
    pip install uv
    
    或使用 Homebrew:
    brew install uv
    
  3. 可选:Ollama:如果你希望运行 Ollama 模型的攻击,请确保 Ollama 服务器正在运行。
    ollama serve
    

安装步骤

  1. 克隆此仓库:
    git clone https://github.com/BIGdeadLock/Garak-MCP.git
    
  2. 配置你的 MCP 主机(如 Claude Desktop、Cursor 等):
    {
      "mcpServers": {
        "garak-mcp": {
          "command": "uv",
          "args": ["--directory", "path-to/Garak-MCP", "run", "garak-server"],
          "env": {}
        }
      }
    }
    

📚 详细文档

提供的工具

概述

| 名称 | 描述 | |------|-------------| | list_model_types | 列出所有可用的模型类型(ollama、openai、huggingface、ggml) | | list_models | 根据给定的模型类型列出所有可用模型 | | list_garak_probes | 列出所有可用的 Garak 攻击/探测器 | | get_report | 获取上次运行的报告 | | run_attack | 使用指定模型和探测器运行攻击 |

详细描述

  • list_model_types

    • 列出所有可用于攻击的所有模型类型
    • 返回支持的模型类型的列表(ollama、openai、huggingface、ggml)
  • list_models

    • 根据给定的模型类型列出所有可用模型
    • 输入参数:
      • model_type(字符串,必需):要列出的模型类型(ollama、openai、huggingface、ggml)
    • 返回指定类型的可用模型列表
  • list_garak_probes

    • 列出所有可用的 Garak 攻击/探测器
    • 返回所有可用的攻击/探测器列表
  • get_report

    • 获取上次运行的报告
    • 返回报告文件的路径
  • run_attack

    • 使用指定模型和探测器运行攻击
    • 输入参数:
      • model_type(字符串,必需):要使用的模型类型
      • model_name(字符串,必需):要使用的模型名称
      • probe_name(字符串,必需):要使用的攻击/探测器名称
    • 返回发现的漏洞列表

🔧 技术细节

已测试的平台

  • [X] Cursor
  • [X] Claude Desktop

未来步骤

  • [ ] 添加对 Smithery AI 的支持:Docker 和配置
  • [ ] 改进报告功能
  • [ ] 测试和验证 OpenAI 模型(GPT-3.5、GPT-4)
  • [ ] 测试和验证 HuggingFace 模型
  • [ ] 测试和验证本地 GGML 模型
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client