easygoingcoder/blackduck-polaris-mcp-server

GitHub: easygoingcoder/blackduck-polaris-mcp-server

为 Black Duck Polaris 提供 66 个工具的 MCP 服务器,让 AI 助手能够对话式地管理安全扫描、漏洞分类、合规报告和策略配置。

Stars: 1 | Forks: 0

# blackduck-polaris-mcp-server [![npm version](https://img.shields.io/npm/v/blackduck-polaris-mcp-server.svg)](https://www.npmjs.com/package/blackduck-polaris-mcp-server) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/) 最全面的 **Black Duck Polaris** MCP (Model Context Protocol) 服务器。触发 SAST/SCA/DAST 扫描、查询发现、分类问题、生成和下载报告(SBOM, SPDX, CycloneDX)、管理策略等 — 全部通过您的 AI 编码助手完成。 ## 适用于 Claude Code | Claude Desktop | GitHub Copilot | Copilot CLI | OpenCode | Cursor | Windsurf | VS Code (MCP extensions) | 任何兼容 MCP 的 AI 工具 ## 快速开始 ### 前置条件 您需要一个 Polaris API token。在您的 Polaris 实例中,通过 **Profile > Account > Access Tokens** 生成一个。 ### Claude Code ``` claude mcp add blackduck-polaris -e POLARIS_URL=https://your-instance.polaris.blackduck.com -e POLARIS_API_TOKEN=your-token -- npx blackduck-polaris-mcp-server ``` ### Claude Desktop (`claude_desktop_config.json`) ``` { "mcpServers": { "blackduck-polaris": { "command": "npx", "args": ["blackduck-polaris-mcp-server"], "env": { "POLARIS_URL": "https://your-instance.polaris.blackduck.com", "POLARIS_API_TOKEN": "your-token" } } } } ``` ### VS Code (`.vscode/mcp.json`) ``` { "servers": { "blackduck-polaris": { "type": "stdio", "command": "npx", "args": ["-y", "blackduck-polaris-mcp-server"], "env": { "POLARIS_URL": "https://your-instance.polaris.blackduck.com", "POLARIS_API_TOKEN": "your-token" } } } } ``` ### Cursor (`.cursor/mcp.json` 或 `~/.cursor/mcp.json`) ``` { "mcpServers": { "blackduck-polaris": { "command": "npx", "args": ["-y", "blackduck-polaris-mcp-server"], "env": { "POLARIS_URL": "https://your-instance.polaris.blackduck.com", "POLARIS_API_TOKEN": "your-token" } } } } ``` ### GitHub Copilot CLI **选项 1 — 配置文件 (`~/.copilot/mcp-config.json`):** ``` { "mcpServers": { "blackduck-polaris": { "type": "local", "command": "npx", "args": ["blackduck-polaris-mcp-server"], "env": { "POLARIS_URL": "https://your-instance.polaris.blackduck.com", "POLARIS_API_TOKEN": "your-token" } } } } ``` **选项 2 — 单次会话内联运行:** ``` copilot --additional-mcp-config '{"blackduck-polaris":{"type":"local","command":"npx","args":["blackduck-polaris-mcp-server"],"env":{"POLARIS_URL":"https://your-instance.polaris.blackduck.com","POLARIS_API_TOKEN":"your-token"}}}' ``` ### OpenCode **选项 1 — 交互式:** 运行 `opencode mcp add` 并按照提示操作。 **选项 2 — 配置文件 (`~/.config/opencode/opencode.json` 或项目根目录的 `opencode.json`):** ``` { "$schema": "https://opencode.ai/config.json", "mcp": { "blackduck-polaris": { "type": "local", "enabled": true, "command": ["npx", "-y", "blackduck-polaris-mcp-server"], "environment": { "POLARIS_URL": "https://your-instance.polaris.blackduck.com", "POLARIS_API_TOKEN": "your-token" } } } } ``` ## 功能特性 — 跨 10 个领域的 66 个工具 ### 项目组合导航 (8 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_portfolios` | 列出所有项目组合 | | `polaris_list_applications` | 列出项目组合中的应用 | | `polaris_create_application` | 创建新应用 | | `polaris_update_application` | 更新应用 | | `polaris_delete_application` | 删除应用 | | `polaris_list_projects` | 列出应用中的项目 | | `polaris_create_project` | 创建新项目 | | `polaris_list_branches` | 列出项目中的分支 | ### 发现与分类 (10 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_issues` | 使用 RSQL 过滤器查询问题 (严重程度、工具、CWE、状态) | | `polaris_get_issue` | 获取完整的问题详情 | | `polaris_get_triage_history` | 查看分类审计记录 | | `polaris_get_detection_history` | 查看检测变更历史 | | `polaris_triage_issue` | 忽略、更改严重程度、分配、更新状态 | | `polaris_list_occurrences` | 列出经过滤的问题出现位置 | | `polaris_get_occurrence_snippet` | 获取易受攻击的源代码片段 | | `polaris_get_remediation` | AI 辅助修复指导 (Black Duck Assist) | | `polaris_submit_remediation_feedback` | 对 AI 修复质量提供反馈 | | `polaris_get_issue_counts` | 按严重程度/类型汇总的问题计数 | ### 扫描 / 测试管理 (8 个工具) | 工具 | 描述 | |------|-------------| | `polaris_trigger_scan` | **在分支上触发 SAST/SCA/DAST 扫描** | | `polaris_list_tests` | 列出经过滤的扫描 | | `polaris_get_test` | 获取扫描状态 (QUEUED, RUNNING, COMPLETED, FAILED) | | `polaris_cancel_test` | 取消正在运行的扫描 | | `polaris_get_test_metrics` | 扫描的问题计数和指标 | | `polaris_get_test_comments` | 获取扫描评论 | | `polaris_list_test_artifacts` | 列出扫描构件 | | `polaris_create_test_artifact` | 上传构件以供外部分析 | ### 报告 (6 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_report_types` | 列出所有报告类型 | | `polaris_generate_report` | **生成报告 (SBOM, SPDX, CycloneDX, 高管摘要等)** | | `polaris_list_reports` | 列出生成的报告 | | `polaris_get_report_status` | 检查报告生成状态 | | `polaris_download_report` | **下载已完成的报告** | | `polaris_delete_report` | 删除报告 | **支持的报告类型:** Developer Detail SCA, Developer Detail Static, Developer Detail Dynamic, Executive Summary, Issue Overview, Issue Summary, Security Audit, SBOM, SPDX v2.3, CycloneDX v1.4, CycloneDX v1.6, Standard Compliance, Standard Compliance Detail, Test Summary ### 策略 (7 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_issue_policies` | 列出问题策略 | | `polaris_create_issue_policy` | 创建策略 (构建中断、电子邮件、Jira ticket) | | `polaris_update_issue_policy` | 更新策略 | | `polaris_delete_issue_policy` | 删除策略 | | `polaris_list_scheduling_policies` | 列出测试调度策略 | | `polaris_create_scheduling_policy` | 创建自动扫描计划 | | `polaris_assign_policy` | 将策略分配给项目/应用/分支 | ### SCM / 代码库集成 (7 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_repos` | 列出已连接的代码库 | | `polaris_get_repo` | 获取代码库详情 | | `polaris_update_repo` | 更新代码库设置 | | `polaris_list_repo_branches` | 列出代码库分支 | | `polaris_test_repo_connection` | 测试 SCM 连通性 | | `polaris_bulk_import_repos` | 从 SCM 批量导入代码库 | | `polaris_list_scm_providers` | 列出受支持的 SCM 提供商 | ### 缺陷跟踪集成 (5 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_bugtracker_configs` | 列出 Jira/Azure DevOps 配置 | | `polaris_create_bugtracker_config` | 创建缺陷跟踪器集成 | | `polaris_update_bugtracker_config` | 更新集成配置 | | `polaris_export_issues_to_tracker` | **将问题导出至 Jira/Azure DevOps** | | `polaris_test_jira_connection` | 测试 Jira 连通性 | ### 审计 (3 个工具) | 工具 | 描述 | |------|-------------| | `polaris_get_audit_logs` | 查询审计日志 (类别、用户、日期范围) | | `polaris_export_audit_logs` | 将审计日志导出为 CSV | | `polaris_list_audit_categories` | 列出审计事件类别 | ### 身份与访问管理 (9 个工具) | 工具 | 描述 | |------|-------------| | `polaris_list_users` | 列出组织用户 | | `polaris_create_user` | 创建用户 | | `polaris_get_user` | 获取用户详情 | | `polaris_update_user` | 更新用户角色/详情 | | `polaris_list_groups` | 列出群组 | | `polaris_create_group` | 创建群组 | | `polaris_get_current_user` | 获取已认证用户信息 | | `polaris_create_api_token` | 创建 API token | | `polaris_create_service_account_token` | 创建服务账号 token | ### 通知 (3 个工具) | 工具 | 描述 | |------|-------------| | `polaris_get_notification_preferences` | 获取组织通知偏好 | | `polaris_update_notification_preferences` | 更新通知偏好 | | `polaris_get_notification_subscriptions` | 获取用户事件订阅 | ## 示例工作流 ### 扫描分支并审查发现 ``` You: Trigger a SAST and SCA scan on the main branch of project X AI: [calls polaris_trigger_scan] Scan triggered, test ID: abc-123 You: Check the scan status AI: [calls polaris_get_test] Status: COMPLETED. 12 new issues found. You: Show me the critical issues AI: [calls polaris_list_issues with severity filter] Found 3 critical issues... You: Show me the code for the first one AI: [calls polaris_get_occurrence_snippet] Here's the vulnerable code at line 42... You: Get remediation advice AI: [calls polaris_get_remediation] Black Duck Assist suggests... ``` ### 生成合规报告 ``` You: Generate an SPDX report for application Y AI: [calls polaris_generate_report] Report queued, ID: rpt-456 You: Is it ready? AI: [calls polaris_get_report_status] Status: COMPLETED You: Download it AI: [calls polaris_download_report] Here's your SPDX v2.3 report... ``` ### 将问题导出至 Jira ``` You: Show me all high-severity SAST issues AI: [calls polaris_list_issues] Found 8 high-severity SAST issues You: Export the first 3 to Jira AI: [calls polaris_export_issues_to_tracker] 3 issues exported to Jira ``` ## 环境变量 | 变量 | 必需 | 描述 | |----------|----------|-------------| | `POLARIS_URL` | 是 | 您的 Polaris 实例 URL (例如 `https://polaris.blackduck.com`) | | `POLARIS_API_TOKEN` | 是 | 来自 Profile > Account > Access Tokens 的 API token | ## 开发 ``` git clone https://github.com/your-username/blackduck-polaris-mcp-server.git cd blackduck-polaris-mcp-server npm install npm run build npm start ``` ### 使用 MCP Inspector 进行测试 ``` POLARIS_URL=https://... POLARIS_API_TOKEN=... npx @modelcontextprotocol/inspector node build/index.js ``` ## 许可证 MIT
标签:AI安全工具, AI编程助手, API集成, Black Duck Polaris, CISA项目, Claude Desktop, CycloneDX, DAST, GitHub Copilot, GNU通用公共许可证, GPT, MCP服务器, MITM代理, Model Context Protocol, Node.js, npm, SAST, SBOM, SPDX, VS Code, 代码安全, 可观测性, 大语言模型工具, 安全合规, 安全扫描, 安全策略, 开源合规, 恶意软件分析, 提示词设计, 时序注入, 漏洞枚举, 漏洞管理, 盲注攻击, 硬件无关, 缺陷分类, 网络代理, 自动化攻击, 静态应用安全测试