关于 Sonatype Dependency Management Mcp Server
Sonatype MCP Server 是一个远程 MCP 服务,让 AI 助手在开发过程中访问 Sonatype 的依赖情报,包括开源漏洞、许可证合规和依赖健康度。面向需要在选择或升级依赖时参考安全与合规信息的开发者和团队。
主要功能
- 01组件版本选择与推荐
- 02开源依赖的安全漏洞检查
- 03许可证合规检查
- 04依赖健康度与维护状态分析
- 05基于漏洞信息给出修复建议
适用场景
- 01在添加或升级依赖前查询推荐版本
- 02检查项目依赖中已知的 CVE 与许可证风险
- 03让 AI 助手在依赖变更时自动参考供应链安全信息
MCP 相关
该项目是远程 MCP 服务,通过 HTTP 连接暴露 getComponentVersion、getLatestComponentVersion 和 getRecommendedComponentVersions 三个工具。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://mcp.guide.sonatype.com/mcpclaude mcp add --transport http dependency-management https://mcp.guide.sonatype.com/mcp{"mcpServers":{"dependency-management":{"type":"http","url":"https://mcp.guide.sonatype.com/mcp"}}}在 Cursor 中打开{"servers":{"dependency-management":{"type":"http","url":"https://mcp.guide.sonatype.com/mcp"}}}在 VS Code 中打开{"mcpServers":{"dependency-management":{"type":"http","url":"https://mcp.guide.sonatype.com/mcp"}}}{"mcpServers":{"dependency-management":{"serverUrl":"https://mcp.guide.sonatype.com/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
3| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| packageUrls | array | 是 | 用于标识组件的 Package URL(PURL)或 PURL 列表。Maven 需要命名空间(groupId)。必须提供版本。提供多个 Package URL 时,最多限制为 20 个。 |
详细介绍
Sonatype MCP 服务
一个模型上下文协议(MCP)服务,可将 AI 助手连接到 Sonatype 的依赖管理和安全情报平台。通过实时了解开源安全漏洞、许可证合规性和依赖项健康状况,为你的 AI 编码助手赋能。
概述
Sonatype MCP 服务可让 AI 助手在你的开发工作流中直接访问 Sonatype 全面的依赖项情报。通过集成模型上下文协议,你的 AI 助手可以帮助你做出明智的依赖项决策、识别安全风险并保持合规性——所有这些都无需离开 IDE。
主要功能
- 组件版本选择 - 一次就选对最佳版本,无需额外折腾
- 安全漏洞扫描 - 识别项目依赖项中的已知漏洞
- 许可证合规性检查 - 确保依赖项符合组织的许可证政策
- 依赖项健康状况分析 - 深入了解依赖项质量、维护状态和风险因素
- 实时安全公告 - 随时了解影响依赖项的最新安全威胁
- 修复指导 - 获取可执行的建议,以修复漏洞和合规性问题
前提条件
- 对于仅支持 stdio MCP 服务的 IDE 或工具(如 IntelliJ),请安装
mcp-remote:npm install -g mcp-remote
设置
Sonatype MCP 服务作为远程 MCP 服务运行。请选择适用于你的 IDE 或 AI 助手的设置说明:
Gemini Code Assist
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"mcpServers": {
"discoveredServer": {
"httpUrl": "https://mcp.guide.sonatype.com/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}
Claude Code
使用 Claude CLI 添加服务:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
claude mcp add --transport http --scope user sonatype-mcp https://mcp.guide.sonatype.com/mcp --header "Authorization: Bearer <your-token>"
VS Code Copilot
将以下配置添加到全局 VS Code mcp.json,或在你的工作区中创建 .vscode/mcp.json 文件:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"servers": {
"sonatype-mcp": {
"url": "https://mcp.guide.sonatype.com/mcp",
"type": "http",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}
Windsurf
创建或编辑 ~/.codeium/windsurf/mcp_config.json:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"mcpServers": {
"sonatype-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.guide.sonatype.com/mcp",
"--header",
"Authorization: Bearer <your-token>"
]
}
}
}
IntelliJ with Junie
全局范围: 前往 IDE 设置 → Tools → Junie → MCP Settings。点击“+”并添加:
项目范围: 在项目根目录中创建 .junie/mcp/.mcp.json:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"mcpServers": {
"sonatype-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.guide.sonatype.com/mcp",
"--header",
"Authorization: Bearer <your-token>"
]
}
}
}
Kiro
创建或编辑 ~/.kiro/settings/mcp.json:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"mcpServers": {
"sonatype-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.guide.sonatype.com/mcp",
"--header",
"Authorization: Bearer <your-token>"
]
}
}
}
Cursor
Cursor 直接支持远程服务。将以下内容添加到你的 ~/.cursor/mcp.json:
将 <your-token> 替换为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌
{
"mcpServers": {
"sonatype-mcp": {
"type": "http",
"url": "https://mcp.guide.sonatype.com/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}
Codex(IDE 插件和 CLI)
对于以下两种方法,请为你在 https://guide.sonatype.com/settings/tokens 生成的个人 API 令牌定义环境变量 SONATYPE_GUIDE_MCP_TOKEN。
方法 1:
使用 CLI 命令:codex mcp add sonatype-mcp --url https://mcp.guide.sonatype.com/mcp --bearer-token-env-var SONATYPE_GUIDE_MCP_TOKEN
方法 2:
创建或编辑 ~/.codex/config.toml:
[mcp_servers.sonatype-mcp]
url = "https://mcp.guide.sonatype.com/mcp"
bearer_token_env_var = "SONATYPE_GUIDE_MCP_TOKEN"
身份验证
Sonatype MCP 服务使用 API 令牌进行身份验证:
- 创建 Sonatype Guide 账户,并在 https://guide.sonatype.com/settings/tokens 生成个人 API 令牌
- 使用
Authorization: Bearer <your-token>标头格式,将令牌添加到 MCP 配置中 - 在上面的配置示例中,将
<your-token>替换为你的实际令牌
API 令牌会自动验证所有请求。请妥善保管令牌,切勿将其提交到版本控制系统中。
配置 AI 助手规则
为最大限度地发挥 Sonatype MCP Server 的效用,请配置 AI 助手,在处理依赖项、软件包或软件供应链安全问题时优先使用 Sonatype MCP 工具。以下是各受支持 IDE 或工具的配置说明。
Claude Code
使用 CLAUDE.md 文件创建自定义指令:
全局(所有项目): 创建 ~/.claude/CLAUDE.md
项目(特定仓库): 在项目根目录下创建 .claude/CLAUDE.md
添加以下指令:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
Cursor
在项目根目录下创建 .cursorrules 文件:
项目(特定仓库): 在项目根目录下创建 .cursorrules
添加以下指令:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
VS Code Copilot
使用 .github/copilot-instructions.md 文件创建自定义指令:
项目(特定仓库): 在项目根目录下创建 .github/copilot-instructions.md
添加以下指令:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
Windsurf
使用 Windsurf 的 Customizations 功能创建规则:
全局(所有项目):
- 点击 Cascade Code 右上角的“Rules, Memories & Workflows”图标,或在 Windsurf Settings 中搜索 Rules
- 前往“Rules”
- 点击“+ Global”创建新的全局规则
- 添加以下内容:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
项目(特定仓库):
按照全局规则的说明操作,但点击“+ Workspace”,或在项目根目录下创建 .windsurf/rules/sonatype.md:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
IntelliJ with Junie
使用 .junie/guidelines.md 文件创建自定义指南:
项目(特定仓库): 在项目根目录下创建 .junie/guidelines.md
添加以下指令:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
Kiro
在 .kiro/steering/ 目录下创建 steering 文件:
项目(特定仓库): 在项目根目录下创建 .kiro/steering/sonatype.md
添加 YAML front matter,使文件始终包含在上下文中:
---
inclusion: always
---
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
Gemini Code Assist
使用 GEMINI.md 文件创建自定义指令:
全局(所有项目): 创建 ~/.gemini/GEMINI.md
项目(特定仓库): 在项目根目录下创建 GEMINI.md
添加以下指令:
## Sonatype MCP
When handling code related to dependencies, package management, or software supply chain security, always prioritize Sonatype MCP tools. Use the available MCP tools to research versions, check for vulnerabilities, and get recommendations before adding or updating any dependencies.
示例用例
在日常开发过程中,大模型会决定使用或升级依赖项。我们的 MCP 工具将透明地发挥作用,提供更优质且信息更新的建议,省去验证组件和版本选择的额外工作。
以下是在开发工作流中明确利用 Sonatype MCP Server 的一些方法:
分析特定版本
向 AI 助手询问:
“获取 react 18.2.0 的详细安全信息”
助手将返回全面的详细信息,包括带有 CVSS 评分的 CVE、许可证信息、类别、生命周期结束状态和目录日期。
查找最新稳定版本
向 AI 助手询问:
“spring-boot 的最新稳定版本是什么?”
助手将返回最新版本及其完整的安全分析、策略违规情况、许可证、风险评分和升级建议。
安全评估工作流
助手可以同时使用这两个工具,将当前版本与最新版本进行比较,并提供可执行的安全指导。
可用工具
Sonatype MCP Server 为 AI 助手提供了三个强大的工具:
getComponentVersion- 获取组件特定版本的信息getLatestComponentVersion- 获取组件最新版本的信息getRecommendedComponentVersions- 根据组件的当前版本获取一组建议升级到的版本。如果未提供版本,则获取一组建议作为该组件起始版本的版本
支持与反馈
- 问题与错误报告: GitHub Issues
关于 Sonatype
Sonatype 是软件供应链安全领域的领导者,提供帮助组织在整个开发生命周期中管理开源风险的解决方案。了解更多信息,请访问 sonatype.com。
献给关注软件供应链安全的开发者,❤️打造。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。