Skip to main content

SAST vulnerability fixing service for MCP

Project description

SAST 漏洞修复 MCP 服务

本项目提供一个专用于处理静态应用安全测试(SAST)报告的 MCP 服务器,具备SAST报告的Docx文档解析、漏洞修复状态跟踪及修复报告导出等核心功能。本MCP server支持湛卢AI程序员中漏洞修复进行SAST相关漏洞的下修复,参见静态应用安全测试(SAST)修复流程

功能概述

  • Docx转JSON:将SAST报告的Word文档解析转换为结构化JSON格式
  • 漏洞状态管理:自动检测待处理的漏洞JSON文件,支持状态查询与更新
  • 报告导出:基于已修复漏洞数据生成标准CSV格式的修复报告

可用工具

  • convert_sast_docx_to_json - 将SAST报告的docx文档转换为JSON格式

    • file_path (string, 必填): SAST报告docx文件路径
  • get_pending_vulnerability_json_files - 获取.scanissuefix目录中所有待处理的漏洞JSON文件(_new.json)

  • generate_csv_report - 从所有已完成的漏洞JSON文件(_finished.json)生成CSV报告

安装指南

Python环境要求

方式一:pip安装(推荐)

获取并安装MCP服务安装包

pip install sast_fixer_mcp-0.1.0-py3-none-any.whl

方式二:源码构建安装

git clone http://gitlab.cmss.com/paas-aipt/ai/zhanlu-agent.git
cd mcp-servers/servers/sast_fixer_mcp
uv build
uv pip install .

安装完成后,启动服务验证MCP服务可运行:

python -m sast_fixer_mcp

方式三:使用uvx直接运行(推荐)

如果您已安装uv,可以直接使用uvx运行服务而无需安装:

uvx --from . sast-fixer-mcp

或者使用模块方式运行:

uvx python -m sast_fixer_mcp

湛卢AI程序员集成配置

配置为湛卢AI程序员MCP服务器使用

在湛卢AI程序员MCP服务管理中添加如下全局配置:

{
  "mcpServers": {
    "SAST_FIXER_MCP": {
      "command": "python",
      "args": ["-m", "sast_fixer_mcp"],
      "enabled": true,
      "alwaysAllow": [
        "add_paragraph",
        "open_document",
        "get_document_info",
        "search_text",
        "convert_sast_docx_to_json",
        "get_pending_vulnerability_json_files",
        "generate_csv_report"
      ],
      "timeout": 1800
    }
  }
}

备注

  • 如使用特定Python环境,建议使用which python命令获取完整路径,如果使用venv获得conda环境,请指定python运行文件的绝对路径。
  • 处理较大SAST报告时,请适当调高timeout以避免超时。

全局设置

进入右上角设置,调整以下选项以获得最佳体验:

  • 模型选择:deepseek-v3(当前仅支持该模型进行漏洞修复)

  • 自动批准权限:启用读取、写入、重试、MCP及命令执行权限

  • 执行命令白名单:建议添加以下命令,避免频繁询问权限

    rm -rf .scanissuefix
    mv .scanissuefix
    

## 安全和隐私

本工具在本地处理文件,不会上传任何数据到外部服务器,确保了代码的安全性。

## 测试

项目包含单元测试,使用pytest框架。运行测试:

```bash
cd sast_fixer_mcp
python -m pytest tests/ -v

测试分为两类:

  1. 功能测试 - 测试核心函数逻辑
  2. 工具测试 - 测试MCP工具调用接口

运行特定测试文件:

python -m pytest tests/test_server_methods.py -v
python -m pytest tests/test_mcp_tools.py -v

许可证

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sast_fixer_mcp-1.0.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sast_fixer_mcp-1.0.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file sast_fixer_mcp-1.0.1.tar.gz.

File metadata

  • Download URL: sast_fixer_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sast_fixer_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 54e3182ba13969a29a6289a45d863e66e64a82e541bafd585d3f407bd4a6abfd
MD5 e8c999884dcdd79fe31c2680ec34f6cf
BLAKE2b-256 32903a9bf07c87577bf03aca15fd2c1e705d0bae63a5e1111298bb3f6ba09390

See more details on using hashes here.

File details

Details for the file sast_fixer_mcp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sast_fixer_mcp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sast_fixer_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75964ef72f42c19487d7e3290b666a4f5731dd720ef42107114ed117621ff97b
MD5 34b664de2f5ff19116d08aa08c16a83d
BLAKE2b-256 c93f92ab040d9cccc5712823511958d1d5d940a1735901600a5d62bfa270112e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page