MC

MCP Server: Dependency Intelligence for JVM Build Tools

Streamline dependency management with MCP server for Maven, Gradle, SBT, and Mill using Maven Central intelligence and Context7 docs integration.

Quick Install
npx -y @arvindand/maven-tools-mcp

Overview

MCP (Model Context Protocol) Server is a lightweight HTTP service that provides dependency intelligence to JVM build tools (Maven, Gradle, SBT, Mill). It enriches conventional package metadata with contextual information derived from the Maven Central index and Context7 documentation, making it easier to discover trusted versions, documentation links, change notes, and metadata useful for automated dependency decisions.

By exposing a consistent API for dependency lookup and enrichment, MCP Server lets CI systems, pre-commit checks, and build plugins query authoritative metadata without directly scraping registries. This centralization reduces repeated network calls, normalizes metadata across tools, and enables build-time features such as automated version recommendations, documentation linking, and simple license / compatibility checks.

Features

  • Centralized API for dependency metadata (groupId, artifactId, version, POM data)
  • Integration with Maven Central index for up-to-date artifact information
  • Context7 docs integration: links to contextual documentation pages for artifacts and APIs
  • Version recommendations and basic semantic-change hints (major/minor/patch)
  • Caching layer to reduce traffic on remote indices and speed lookups
  • Simple HTTP API suitable for use by Maven, Gradle, SBT, Mill, or CI scripts
  • Docker-ready distribution and JVM jar for standalone hosting

Installation / Configuration

Run from a JAR (Java 11+ recommended)

# Download latest release jar (replace URL with current release)
wget https://github.com/arvindand/maven-tools-mcp/releases/latest/download/mcp-server.jar

# Run with default settings
java -jar mcp-server.jar

# Override port or config via system properties
java -jar -Dserver.port=8081 mcp-server.jar

Run with Docker

# Pull image (replace image name/tag with published image if available)
docker pull arvindand/maven-tools-mcp:latest

# Run, exposing port 8080
docker run -p 8080:8080 --name mcp-server arvindand/maven-tools-mcp:latest

Configuration file (application.yml example)

server:
  port: 8080

maven:
  indexPath: /data/maven-index  # local index cache
  remoteIndexUrl: https://repo1.maven.org/maven2

context7:
  enabled: true
  endpoint: https://docs.context7.example/api

cache:
  ttlSeconds: 3600
cors:
  allowedOrigins: ["*"]

Environment variables can be used for common overrides, e.g. MCP_SERVER_PORT, MCP_MAVEN_INDEX_PATH, MCP_CONTEXT7_ENDPOINT.

Available Resources

The server exposes a small, RESTful set of endpoints to lookup and enrich dependency information. Typical routes include:

  • GET /api/v1/dependency?gav=group:artifact:version — detailed metadata for a GAV
  • GET /api/v1/suggest?ga=group:artifact — recommended versions and upgrade hints
  • GET /api/v1/docs?gav=group:artifact:version — Context7 documentation links
  • GET /api/v1/health — service health/status

Example: query a dependency

curl -s "http://localhost:8080/api/v1/dependency?gav=org.apache.commons:commons-lang3:3.12.0" | jq

Example JSON response (typical)

{
  "gav": "org.apache.commons:commons-lang3:3.12.0",
  "packaging": "jar",
  "licenses": ["Apache-2.0"],
  "pom": {
    "description": "Apache Commons Lang",
    "scm": { "url": "https://github.com/apache/commons-lang" }
  },
  "recommendedVersions": ["3.13.0", "3.12.0"],
  "docs": {
    "context7": "https://docs.context7.example/commons-lang3/3.12.0"
  }
}

Use Cases

  1. Automated upgrade checks (CI)

    • CI jobs call /api/v1/suggest?ga=org.foo:lib to get recommended newer versions and classify them as patch/minor/major. The job can fail builds for vulnerable or EOL versions.
  2. Editor or IDE integrations

    • IDE plugins query /api/v1/docs to show contextual docs and quick links for the selected dependency, improving developer discoverability of API docs.
  3. Pre-merge dependency audits

    • A pre-commit or pull-request bot queries MCP to validate licenses and check for known license incompatibilities before allowing a dependency addition.
  4. Cross-tool normalization

    • Organizations with mixed build tools (Maven/Gradle/SBT/Mill) use MCP as a single source of enrichment so all tools show consistent version suggestions and documentation links.
  5. Dependency resolution augmentation

    • Build plugins use MCP metadata to present human-friendly upgrade info in build output, or to auto-generate changelogs for updated dependencies.

Getting Started Examples

Simple shell example to check for newer versions

GA="org.apache.commons:commons-lang3"
curl -s "http://localhost:8080/api/v1/suggest?ga=${GA}" | jq '.recommendedVersions'

Integrate into a Gradle init script (conceptual)

// init.gradle (conceptual snippet)
def mcpUrl = 'http://localhost:8080'
gradle.taskGraph.whenReady {
  allprojects {
    // Example: annotate dependency reports by querying MCP (pseudo-code)
    configurations.compileClasspath.incoming.resolutionResult.allDependencies.each { dep ->
      // call MCP to fetch docs or suggested version
    }
  }
}

Note: integration details will depend on the plugin or script you write; MCP provides HTTP endpoints that are language-agnostic.

Where to find the project

Source code, issues, and releases are on GitHub: https://github.com/arvindand/maven-tools-mcp

For best results, host MCP close to your CI/build agents, populate the local Maven index cache for faster responses, and enable Context7 integration if you rely on contextual documentation links.