Java JAR MCP Server

Java JAR MCP Server

Enables AI assistants to look up Java class definitions and list dependencies from Maven projects by analyzing local JAR files via the Model Context Protocol.

Category
Visit Server

README

Java JAR MCP Server

English | 中文 | 日本語

An npm package that provides MCP (Model Context Protocol) server functionality for Java Maven projects. This server enables AI assistants to access Java class definitions from Maven dependencies, solving the limitation where Cursor and other VSCode-based IDEs cannot automatically read jar file classes.

Features

  • Class Definition Lookup: Find Java class definitions from Maven dependencies
  • Dependency Listing: List all Maven dependencies for a project
  • JAR Class Search: Search for classes within JAR files using patterns

Installation

Prerequisites

  • Node.js 18+
  • Maven installed (for Maven projects)

Using via npx

{
  "mcpServers": {
    "java-jar-mcp": {
      "command": "npx",
      "args": ["-y", "@biggerball/java-jar-mcp@latest"],
      "env": {
        "MAVEN_REPO_PATH": "/Users/username/.m2/repository"
      }
    }
  }
}

Usage

After configuration, the MCP server will automatically start and provide the following tools to AI assistants:

Available MCP Tools

find_class_definition

Find the definition of a Java class from Maven dependencies.

Parameters:

  • className (string, required): Fully qualified class name (e.g., java.util.ArrayList)
  • pomPath (string, required): Path to pom.xml file (e.g., "/path/to/project/pom.xml")

Returns: Class definition with source code (if available), methods, and fields

Example:

{
  "className": "com.alibaba.fastjson2.filter.BeforeFilter",
  "pomPath": "/path/to/project/pom.xml"
}

list_project_dependencies

List all Maven dependencies for a project.

Parameters:

  • pomPath (string, required): Path to pom.xml file (e.g., "/path/to/project/pom.xml")

Returns: List of dependencies with JAR file paths

search_classes_in_jar

Search for classes matching a pattern in a JAR file.

Parameters:

  • jarPath (string): Path to the JAR file
  • searchPattern (string): Search pattern (supports wildcards * and ?)

Returns: List of matching class names

Support & Donation

If you find this project helpful and would like to support its development, I'd be grateful if you could buy me a coffee! ☕

Your support helps me continue improving this project and creating more useful tools for the developer community.

Buy Me a Coffee

If you enjoy using this project, your support would mean a lot to me. Thank you! 🙏

Local Development Installation

  1. Clone the repository

  2. Install dependencies and build:

    npm install
    npm run build
    
  3. Use local path in MCP configuration:

    {
      "mcpServers": {
        "java-jar-mcp": {
          "command": "node",
          "args": ["/path/to/java-jar-mcp/dist/index.js"],
          "env": {
            "MAVEN_REPO_PATH": "/Users/username/.m2/repository"
          }
        }
      }
    }
    

How It Works

The MCP server works through the following steps:

  1. Parse pom.xml: Read and parse the Maven project's pom.xml file
  2. Locate JAR files: Find corresponding JAR files in the local Maven repository based on Maven coordinates
  3. Extract class definitions: Extract Java class definition information from JAR files

Development

Project Structure

java-jar-mcp/
├── src/
│   ├── index.ts         # MCP server entry point
│   ├── mavenParser.ts   # pom.xml parsing
│   ├── jarLocator.ts    # JAR file location
│   ├── classExtractor.ts # Class definition extraction
│   ├── tools.ts         # MCP tool implementations
│   └── cache.ts         # LRU cache implementation
└── dist/                # Compiled MCP server

Building

# Build MCP server
npm run build

# Watch mode build
npm run watch

Testing

npm test

Future Improvements

  • Support for Gradle projects
  • Enhanced Maven property resolution
  • Automatic multi-module project detection and dependency merging

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured