Sponsored by Deepsite.site

Maven Indexer Mcp

Created By
tangcent21 hours ago
A Model Context Protocol (MCP) server that indexes your local Maven repository (~/.m2/repository) and Gradle cache (~/.gradle/caches/modules-2/files-2.1) to provide AI agents with tools to search for Java classes, method signatures, and source code.
Content

Maven Indexer MCP Server

npm version Tests

A Model Context Protocol (MCP) server that indexes your local Maven repository (~/.m2/repository) and Gradle cache ( ~/.gradle/caches/modules-2/files-2.1) to provide AI agents with tools to search for Java classes, method signatures, and source code.

Key Use Case: While AI models are well-versed in popular public libraries (like Spring, Apache Commons, Guava), they often struggle with:

  1. Internal Company Packages: Private libraries that are not public.
  2. Non-Well-Known Public Packages: Niche or less popular open-source libraries.

This server bridges that gap by allowing the AI to "read" your local dependencies, effectively giving it knowledge of your private and obscure libraries.

Features

  • Semantic Class Search: Search for classes by name or purpose.
  • Inheritance Search: Find all implementations of an interface or subclasses of a class.
  • On-Demand Analysis: Extracts method signatures and Javadocs directly from JARs.
  • Source Code Retrieval: Provides full source code if available.
  • Real-time Monitoring: Automatically updates the index when repositories change.

Getting Started

Add the following config to your MCP client:

{
  "mcpServers": {
    "maven-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "maven-indexer-mcp@latest"
      ]
    }
  }
}

This will automatically download and run the latest version of the server. It will auto-detect your Maven repository location (usually ~/.m2/repository) and Gradle cache.

MCP Client configuration

Cline

Follow Cline's MCP guide and use the config provided above.

Codex

Follow the configure MCP guide using the standard config from above.

Cursor

Click the button to install:

Cursor

Or install manually:

Go to Cursor Settings -> MCP -> New MCP Server. Use the config provided above.

JetBrains AI Assistant & Junie

Go to Settings | Tools | AI Assistant | Model Context Protocol (MCP) -> Add. Use the config provided above. The same way maven-indexer can be configured for JetBrains Junie in Settings | Tools | Junie | MCP Settings ->Add. Use the config provided above.

Kiro

In Kiro Settings, go to Configure MCP > Open Workspace or User MCP Config > Use the configuration snippet provided above.

Or, from the IDE Activity Bar > Kiro > MCP Servers > Click Open MCP Config. Use the configuration snippet provided above.

Qoder

In Qoder Settings, go to MCP Server > + Add > Use the configuration snippet provided above.

Alternatively, follow the MCP guide and use the standard config from above.

Trae

Go to Settings -> MCP -> + Add -> Add Manually to add an MCP Server. Use the config provided above.

Windsurf

Follow the configure MCP guide using the standard config from above.

Your first prompt

Enter the following prompt in your MCP Client to check if everything is working:

Find the class `StringUtils` in my local maven repository and show me its methods.

Your MCP client should read the class StringUtils from your local Maven repository and show its methods.

Configuration (Optional)

If the auto-detection fails, or if you want to filter which packages are indexed, you can add environment variables to the configuration:

  • MAVEN_REPO: Absolute path to your local Maven repository (e.g., /Users/yourname/.m2/repository). Use this if your repository is in a non-standard location.
  • GRADLE_REPO_PATH: Absolute path to your Gradle cache (e.g., /Users/yourname/.gradle/caches/modules-2/files-2.1).
  • INCLUDED_PACKAGES: Comma-separated list of package patterns to index (e.g., com.mycompany.*,org.example.*). Default is * (index everything).
  • MAVEN_INDEXER_CFR_PATH: (Optional) Absolute path to a specific CFR decompiler JAR. If not provided, the server will attempt to use its bundled CFR version.

Example with optional configuration:

{
  "mcpServers": {
    "maven-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "maven-indexer-mcp@latest"
      ],
      "env": {
        "MAVEN_REPO": "/Users/yourname/.m2/repository",
        "GRADLE_REPO_PATH": "/Users/yourname/.gradle/caches/modules-2/files-2.1",
        "INCLUDED_PACKAGES": "com.mycompany.*",
        "MAVEN_INDEXER_CFR_PATH": "/path/to/cfr-0.152.jar"
      }
    }
  }
}

Local Development

If you prefer to run from source:

  1. Clone the repository:

    git clone https://github.com/tangcent/maven-indexer-mcp.git
    cd maven-indexer-mcp
    
  2. Install dependencies and build:

    npm install
    npm run build
    
  3. Use the absolute path in your config:

    {
      "mcpServers": {
        "maven-indexer": {
          "command": "node",
          "args": ["/absolute/path/to/maven-indexer-mcp/build/index.js"]
        }
      }
    }
    

Available Tools

  • search_classes: Search for Java classes in the local Maven repository and Gradle caches.
    • WHEN TO USE: 1. Internal/Private Code: You need to find a class from a company-internal library. 2. Obscure Libraries: You are using a less common public library that the AI doesn't know well. 3. Version Verification: You need to check exactly which version of a class is present locally.

      • Note: For well-known libraries (e.g., standard Java lib, Spring), the AI likely knows the class structure already, so this tool is less critical.
    • Examples: "Show me the source of StringUtils", "What methods are available on DateTimeUtils?", "Where is this class imported from?".

    • Input: className (e.g., "StringUtils", "Json parser")

    • Output: List of matching classes with their artifacts.

  • get_class_details: Decompile and read the source code of external libraries/dependencies. Use this instead of 'SearchCodebase' for classes that are imported but defined in JAR files.
    • Key Value: "Don't guess what the internal library does—read the code."
    • Tip: Essential for internal/proprietary code where documentation is scarce or non-existent.
    • Input: className (required), artifactId (optional), type ("signatures", "docs", "source")
    • Output: Method signatures, Javadocs, or full source code.
    • Note: If artifactId is omitted, the tool automatically selects the best available artifact (preferring those with source code attached).
  • search_artifacts: Search for artifacts in Maven/Gradle caches by coordinate (groupId, artifactId).
  • search_implementations: Search for classes that implement a specific interface or extend a specific class. Useful for finding SPI implementations in external libraries.
    • Input: className (e.g. "java.util.List")
    • Output: List of implementation/subclass names and their artifacts.
  • refresh_index: Trigger a re-scan of the Maven repository.

Development

  • Run tests: npm test
  • Watch mode: npm run watch

License

ISC

Server Config

{
  "mcpServers": {
    "maven-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "maven-indexer-mcp@latest"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Playwright McpPlaywright MCP server