mvn-version-server

Incept5/mvn-version-server

3.1

If you are the rightful owner of mvn-version-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Maven Dependency Version Finder MCP Server is a tool designed to query the Maven Central Repository for the latest versions of dependencies, supporting both Gradle and Maven formats.

Maven Dependency Version Finder MCP Server

This MCP server allows you to query the Maven Central Repository to find the latest versions of dependencies. It can be used by other AI tools to build their dependency files.

Features

  • Query Maven Central Repository to find the latest version of a dependency
  • Support for both Gradle and Maven dependency formats
  • Can be run locally as a standalone web server or in a Docker container
  • Built using Python

Installation

Prerequisites

  • Python 3.8+
  • Docker (optional, for containerized deployment)

Local Setup

  1. Clone this repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Run the server:
    python src/main.py
    

Docker Setup

  1. Build the Docker image:
    docker build -t maven-dependency-finder .
    
  2. Run the container:
    docker run -p 8000:8000 maven-dependency-finder
    

API Usage

Find Latest Version

Endpoint: /api/find-latest-version

Method: POST

Request Body:

{
  "dependency": "org.springframework:spring-core:5.3.0"
}

or

{
  "dependency": "implementation 'org.springframework:spring-core:5.3.0'"
}

Response:

{
  "groupId": "org.springframework",
  "artifactId": "spring-core",
  "latestVersion": "6.1.3",
  "currentVersion": "5.3.0",
  "repository": "central"
}

Search Artifacts

Endpoint: /api/search-artifacts

Method: POST

Request Body:

{
  "query": "spring-boot",
  "rows": 20,
  "start": 0,
  "groupId": "org.springframework.boot",
  "artifactId": "spring-boot",
  "version": "3.0.0",
  "packaging": "jar",
  "classifier": "javadoc"
}

Note: At least one search parameter (query, groupId, artifactId, version, packaging, or classifier) must be provided.

Advanced Search Examples:

  1. Basic text search:
{
  "query": "spring-boot"
}
  1. Search by Maven coordinates:
{
  "groupId": "org.springframework.boot",
  "artifactId": "spring-boot"
}
  1. Full coordinate search (similar to the Sonatype REST API):
{
  "groupId": "com.google.inject",
  "artifactId": "guice",
  "version": "3.0",
  "packaging": "jar",
  "classifier": "javadoc"
}

Response:

{
  "response": {
    "numFound": 123,
    "start": 0,
    "docs": [
      {
        "g": "org.springframework.boot",
        "a": "spring-boot",
        "v": "3.2.0",
        "latestVersion": "3.2.0",
        "repositoryId": "central",
        "p": "jar",
        "timestamp": 1701234567890
      },
      // More results...
    ]
  }
}

WebSocket Support

This server implements WebSocket communication to enable real-time querying of Maven Central Repository. There are two available methods:

find_latest_version

// Example WebSocket request
{
  "id": "request-id",
  "method": "find_latest_version",
  "params": {
    "dependency": "org.springframework:spring-core:5.3.0"
  }
}

search_artifacts

// Example WebSocket request
{
  "id": "request-id", 
  "method": "search_artifacts",
  "params": {
    "query": "spring-boot",
    "rows": 20,
    "start": 0
  }
}

Advanced search example using Maven coordinates:

// Example WebSocket request with coordinates
{
  "id": "request-id", 
  "method": "search_artifacts",
  "params": {
    "groupId": "com.google.inject",
    "artifactId": "guice",
    "version": "3.0",
    "packaging": "jar",
    "classifier": "javadoc",
    "rows": 20,
    "start": 0
  }
}

Example Clients

The repository includes example clients to demonstrate usage:

  • examples/mcp_client.py - Python client for finding latest versions
  • examples/mcp_client.js - JavaScript client for finding latest versions
  • examples/search_client.py - Python client for searching artifacts

Documentation

  • - Detailed API endpoints and usage
  • - How to integrate with other AI tools
  • - How to configure AI clients to use this MCP service

License

MIT