使用说明

项目简介

该项目是一个MCP服务器,旨在为LLM提供检查软件包最新稳定版本的功能。通过集成此服务器,LLM可以确保在生成代码或提供建议时,能够使用最新的软件包版本信息,从而提高代码质量和减少潜在的兼容性问题。

主要功能点

  • 提供多种工具,用于检查 npm (Node.js/JavaScript), PyPI (Python), Maven Central (Java), Go Proxy (Go) 等软件包仓库的最新稳定版本。
  • 支持检查不同格式的依赖文件,如 'package.json', 'requirements.txt', 'pyproject.toml', 'pom.xml', 'build.gradle', 'go.mod'。
  • 允许LLM通过标准化的MCP协议调用工具,获取软件包的最新版本信息。
  • 提供详细的工具描述和输入参数schema,方便LLM理解和使用。

安装步骤

  1. 克隆仓库:
    git clone https://github.com/MCP-Mirror/sammcj_mcp-package-version.git
  2. 进入项目目录:
    cd sammcj_mcp-package-version
  3. 安装依赖:
    npm install
  4. 构建项目:
    npm run build

服务器配置

要将此MCP服务器与MCP客户端(如Cline VSCode Extension, Claude Desktop, GoMCP)集成,您需要在客户端的MCP设置文件中添加以下服务器配置信息。以下是一个JSON格式的配置示例,您需要根据您的MCP客户端的具体设置进行配置:

{
  "mcpServers": {
    "package-version": { // Server name,客户端配置中server_name需与之对应
      "command": "npx", // 启动命令,通常为 npx 或 node
      "args": ["-y", "mcp-package-version"] // 启动参数,指定运行 mcp-package-version
    }
  }
}

配置参数说明:

  • 'server name': 服务器名称,例如 "package-version"。客户端在调用工具时需要使用此名称。
  • 'command': 启动服务器的命令。对于此服务器,通常使用 'npx' 或 'node',前提是您的环境中已安装 Node.js 和 npm。
  • 'args': 传递给启动命令的参数。对于 'npx mcp-package-version',参数为 '["-y", "mcp-package-version"]','-y' 参数用于跳过 'npx' 的安装确认提示。

请注意: 不同的MCP客户端,MCP settings file的位置和格式可能有所不同。请根据您使用的MCP客户端,参考示例和说明文档进行配置。示例中提供了 Cline VSCode Extension, Claude Desktop, GoMCP 的配置路径供参考。

基本使用方法

配置完成后,LLM客户端即可通过 'use_mcp_tool' 等 MCP 协议规定的方法调用此服务器提供的工具。以下是一些基本的使用示例,展示了如何调用不同的工具来检查软件包版本:

  • 检查 npm 包版本 (package.json):

    use_mcp_tool({
      server_name: "package-version",
      tool_name: "check_npm_versions",
      arguments: {
        dependencies: {
          "express": "^4.17.1",
          "react": "^17.0.2"
        }
      }
    });
  • 检查 PyPI 包版本 (requirements.txt):

    use_mcp_tool({
      server_name: "package-version",
      tool_name: "check_python_versions",
      arguments: {
        requirements: [
          "requests==2.26.0",
          "pandas>=1.3.0"
        ]
      }
    });
  • 检查 Maven 包版本 (pom.xml):

    use_mcp_tool({
      server_name: "package-version",
      tool_name: "check_maven_versions",
      arguments: {
        dependencies: [
          {
            groupId: "org.springframework.boot",
            artifactId: "spring-boot-starter-web",
            version: "2.7.0"
          }
        ]
      }
    });
  • 检查 Go 包版本 (go.mod):

    use_mcp_tool({
      server_name: "package-version",
      tool_name: "check_go_versions",
      arguments: {
        dependencies: {
          module: "example.com/mymodule",
          require: [
            {
              path: "github.com/gin-gonic/gin",
              version: "v1.7.0"
            }
          ]
        }
      }
    });

更多工具的使用方法和详细参数,请参考仓库的 README 文档和代码示例。

信息

分类

开发者工具