javarepo-mcp
A Model Context Protocol extension that finds and retrieves the source code of Java classes from Maven repositories.
GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
5
Forks
0
Issues
0
JavaRepo MCP
A Model Context Protocol extension that finds and retrieves the source code of Java classes from Maven repositories.
Overview
JavaRepo MCP is a tool that helps developers access Java source code directly from Maven artifacts. It provides a Model Context Protocol (MCP) server extension that can be integrated with compatible editors and IDEs, allowing you to view and inspect the source code of libraries and dependencies without leaving your development environment.
Features
- Source Code Retrieval: Looks up Java classes from Maven artifacts by their coordinates (groupId, artifactId, version) and fully qualified class name
- Source Lookup Strategy:
- First tries to find the original source code in the Maven sources JAR
- Then searches for the source code in the local file system
- If source code is not found, decompiles the class using CFR
- MCP Integration: Built as a Model Context Protocol tool for seamless integration with compatible editors and tools
Requirements
- Java 17 or higher
- Maven repository with the target libraries
Installation
Clone the repository:
git clone https://github.com/yourusername/javarepo-mcp.git
Build the project:
cd javarepo-mcp mvn clean package
The built JAR will be available at
target/javarepo-mcp-1.0-SNAPSHOT.jar
Usage
This tool is designed to be used through the Model Context Protocol. It exposes a tool called findClassFromRepository
that accepts the following parameters:
groupId
: The Maven group ID of the libraryartifactId
: The Maven artifact ID of the libraryversion
: The version of the libraryclassName
: The fully qualified name of the class to retrieve
The tool returns the source code of the requested class as a string. If the original source code cannot be found, it will return a decompiled version.
Technical Details
JavaRepo MCP uses the following technologies:
- Model Context Protocol (MCP): For tool integration with editors and IDEs
- CFR Decompiler: For decompiling Java classes when source code is not available
- Maven Repository System: For locating and accessing Java artifacts and sources
License
This project is licensed under the terms included in the LICENSE file.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgements
- CFR Decompiler for Java decompilation capabilities
- Model Context Protocol for providing the integration framework
0
Followers
0
Repositories
0
Gists
0
Total Contributions