这是一个 MCP(模型上下文协议)服务器,提供工具用于检查 Maven 依赖版本。借助该服务器,大型语言模型能够验证 Maven 依赖项,并从 Maven 中央仓库检索其最新版本。
npm install
npm run build
将服务器添加到您的 MCP 设置配置文件中:
{
"mcpServers": {
"maven-deps-server": {
"command": "node",
"args": ["/path/to/maven-deps-server/build/index.js"]
}
}
}
检索某个 Maven 依赖项的最新版本。 输入 schema:
{
"type": "object",
"properties": {
"dependency": {
"type": "string",
"description": "Maven 依赖项格式为 \"groupId:artifactId\"(例如 \"org.springframework:spring-core\")"
}
},
"required": ["dependency"]
}
示例用法:
const result = await mcpClient.callTool("maven-deps-server", "get_maven_latest_version", {
dependency: "org.springframework:spring-core"
});
// 返回: "6.2.1"
检查某个特定版本的 Maven 依赖项是否存在。 输入 schema:
{
"type": "object",
"properties": {
"dependency": {
"type": "string",
"description": "Maven 依赖项格式为 \"groupId:artifactId\"(例如 \"org.springframework:spring-core\")"
},
"version": {
"type": "string",
"description": "要检查的版本(例如 \"5.3.20\")"
}
},
"required": ["dependency", "version"]
}
示例用法:
const result = await mcpClient.callTool("maven-deps-server", "check_maven_version_exists", {
dependency: "org.springframework:spring-core",
version: "5.3.20"
});
// 返回: "true" 或 "false"
// 输入: org.springframework:spring-core
"6.2.1"
// 输入: org.apache.kafka:kafka-clients
"3.7.2"
// 输入: nonexistent.group:fake-artifact
"Maven 依赖项中未找到 nonexistent.group:fake-artifact"
// 输入: { dependency: "org.springframework:spring-core", version: "5.3.20" }
"true"
// 输入: { dependency: "org.springframework:spring-core", version: "0.0.1" }
"false"
服务器能够处理各种错误情况,包括:
要维护或扩展此服务器,可以参考以下仓库和文档:
[此处插入许可证详细信息]