Skip to main content
Glama

Maven 依赖 MCP 服务器

一个 MCP(模型上下文协议)服务器,提供用于检查 Maven 依赖项版本的工具。此服务器使 LLM 能够验证 Maven 依赖项并从 Maven 中央存储库检索其最新版本。

安装

您可以使用 npm 全局安装此 MCP 服务器:

npm install -g mcp-maven-deps

或者直接使用 npx 运行:

npx mcp-maven-deps

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Maven Dependencies Server:

npx -y @smithery/cli install maven-deps-server --client claude

Related MCP server: cve-search_mcp

特征

  • 查询任何 Maven 依赖项的最新版本

  • 验证 Maven 依赖项是否存在

  • 检查依赖项的特定版本是否存在

  • 支持完整的 Maven 坐标,包括包装和分类器

  • 实时访问 Maven 中央存储库数据

  • 兼容多种构建工具格式(Maven、Gradle、SBT、Mill)

对于开发:

  1. 克隆此存储库

  2. 安装依赖项: npm install

  3. 构建服务器: npm run build

配置

将服务器添加到您的 MCP 设置配置文件:

{ "mcpServers": { "maven-deps-server": { "command": "npx", "args": ["mcp-maven-deps"] } } }

如果全局安装,您还可以使用:

{ "mcpServers": { "maven-deps-server": { "command": "mcp-maven-deps" } } }

交通选择

服务器支持两种传输模式:

  1. stdio (默认)- 标准输入/输出通信

  2. SSE (服务器发送事件)- 基于 HTTP 的通信,具有可选的远程访问

要使用 SSE 传输,您可以指定主机和端口:

# Local access only (default host: localhost) npx mcp-maven-deps --port=3000 # Remote access npx mcp-maven-deps --host=0.0.0.0 --port=3000

在 MCP 设置中使用 SSE 传输时:

{ "mcpServers": { "maven-deps-server": { "command": "npx", "args": ["mcp-maven-deps", "--port=3000"] } } }

对于远程访问,请在客户端配置中使用服务器的 IP 或主机名:

{ "mcpServers": { "maven-deps-server": { "command": "npx", "args": ["mcp-maven-deps", "--host=your-server-ip", "--port=3000"] } } }

可用工具

获取 Maven 最新版本

检索 Maven 依赖项的最新版本。

输入模式:

{ "type": "object", "properties": { "dependency": { "type": "string", "description": "Maven coordinate in format \"groupId:artifactId[:version][:packaging][:classifier]\" (e.g. \"org.springframework:spring-core\" or \"org.springframework:spring-core:5.3.20:jar\")" } }, "required": ["dependency"] }

示例用法:

const result = await mcpClient.callTool("maven-deps-server", "get_maven_latest_version", { dependency: "org.springframework:spring-core" }); // Returns: "6.2.2"

检查 Maven 版本是否存在

检查 Maven 依赖项的特定版本是否存在。版本信息可以在依赖项字符串中提供,也可以作为单独的参数提供。

输入模式:

{ "type": "object", "properties": { "dependency": { "type": "string", "description": "Maven coordinate in format \"groupId:artifactId[:version][:packaging][:classifier]\" (e.g. \"org.springframework:spring-core\" or \"org.springframework:spring-core:5.3.20:jar\")" }, "version": { "type": "string", "description": "Version to check if not included in dependency string" } }, "required": ["dependency"] }

示例用法:

// Using version in dependency string const result1 = await mcpClient.callTool("maven-deps-server", "check_maven_version_exists", { dependency: "org.springframework:spring-core:5.3.20" }); // Using separate version parameter const result2 = await mcpClient.callTool("maven-deps-server", "check_maven_version_exists", { dependency: "org.springframework:spring-core", version: "5.3.20" });

实现细节

  • 使用 Maven Central 的 REST API 获取依赖项信息

  • 支持完整的 Maven 坐标(groupId:artifactId:version:packaging:classifier)

  • 按时间戳对结果进行排序,以确保返回最新版本

  • 包括无效依赖项和 API 问题的错误处理

  • 返回有效依赖项的干净、可解析的版本字符串

  • 为版本存在性检查提供布尔响应

错误处理

服务器处理各种错误情况:

  • 依赖项格式无效

  • 版本格式无效

  • 不存在的依赖关系

  • API 连接问题

  • 格式错误的响应

  • 缺少版本信息

发展

要修改或扩展服务器:

  1. 修改src/index.ts

  2. 使用npm run build重建

  3. 重新启动 MCP 服务器以应用更改

执照

麻省理工学院

One-click Deploy
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

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/Bigsy/maven-mcp-server'

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