JarWise is a Java code analysis tool that helps developers understand method call hierarchies in Java projects. It provides a Model Context Protocol (MCP) server that exposes tools for analyzing Java code structure and relationships.
JarWise uses JavaParser to analyze Java source code and JAR files, building an index of classes, methods, and their relationships. It can trace method call hierarchies, helping developers understand how different parts of a codebase interact.
The tool is particularly useful for:
- Understanding complex codebases
- Tracing method call flows
- Analyzing dependency relationships
- Exploring inheritance hierarchies
- Discovering REST API endpoints
- Java 21 or higher
- Gradle 8.0 or higher
JarWise supports two operating modes:
- Use case: Single Java project
- Configuration:
jar-wise.mode=LOCAL - Path: Set
jar-wise.project-pathto your Java project directory
- Use case: Multiple Java projects
- Configuration:
jar-wise.mode=SERVER - Path: Set
jar-wise.project-pathto root directory containing multiple Java projects
You can set these via environment variables:
JAR_WISE_MODE: Set toLOCAL(default) orSERVERJAR_WISE_PROJECT_PATH: Path to project or root directory
./gradlew buildJar files are important for type resolution. Always make sure you build the Java project before using JarWise. Thinjar with all dependencies and bootjar are both supported.
JAR_WISE_PROJECT_PATH=${pwd} ./gradlew bootRunOr using the JAR file:
JAR_WISE_PROJECT_PATH=${pwd} java -jar app/build/libs/app.jar After running, JarWise service will scan all java source files and Jar files.
- Start the JarWise MCP server (see instructions above)
- Configure your MCP client to connect to JarWise:
{
"mcpServers": {
"jar-wise": {
"url": "http://localhost:8080/mcp",
"transportType": "streamableHttp"
}
}
}Example requests you can make through MCP-compatible clients:
- Find call hierarchy:
find_call_hierarchywith signature parameter - Get REST API summary:
find_rest_api_summaryto list all APIs - Search code:
search_codeto find classes, methods, or APIs by name - Analyze code relationships and method flows
This integration allows you to leverage JarWise's code analysis capabilities within your preferred development environment that supports MCP.
This project is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0) - see the LICENSE file for details.
- Using the library: You can freely use this library in your applications (including commercial ones) without any restrictions
- Modifying the library: If you modify this library and distribute it, you must make the modified source code available under LGPL-3.0
- Linking: You can link this library with proprietary code without making your entire application open source