name: jlens-mcp-en description: "Professional-grade Java codebase analysis and Maven dependency management skill. Triggers when: (1) Analyzing Java class structures with multi-version isolation in multi-module projects, (2) Deep parsing Maven dependency trees and troubleshooting version conflicts, (3) Searching for classes in massive Jar files using cursor-based pagination, (4) Automating Maven build tasks, (5) Intelligently identifying local source code vs. third-party libraries. This skill guides the Agent to prefer registered MCP services and provides a command-line Fallback mechanism."
JLens MCP Expert Navigation Guide (V1.1.1)
JLens is a Model Context Protocol (MCP) server designed for AI Agents. It provides deep understanding of Java projects through real reflection analysis and bytecode parsing. Unlike simple text search, JLens can identify class inheritance, method signatures, visibility modifiers, and complex Maven dependency topologies.
1. Core Tools and Interaction Details
1.1 Class Inspection (inspect_java_class)
Interaction Logic:
- State Machine Responses:
status: "SUCCESS": Parsing successful. ReaddecompiledSourcefor logic, andmethods/fieldsfor structure.status: "LOCAL_SOURCE": Important! The target class belongs to the current workspace. Ignore metadata and directly read the source code using theread_filetool via the providedsourceFilepath.status: "NOT_FOUND": Class does not exist. Check thesuggestionfield; you might need to runbuild_modulefirst.
- Key Parameters:
bypassCache: If class structure seems outdated (e.g., after recent source changes), set totrueto bypass GAV cache for real-time parsing.
1.2 Paginated Search (search_java_class)
Pagination Protocol:
- Result Parsing: If
hasMoreistruein the response, you must record thenextCursor. - Subsequent Requests: Pass
cursor: "<nextCursor>"in the next call untilhasMoreisfalse. Results are sorted by fully qualified name for stability.
1.3 Dependency Analysis (list_module_dependencies)
Metadata Parsing:
- Returns a standard Maven dependency model. Focus on the
scopefield (e.g.,test,provided) to determine if a class is available at runtime.
2. Task-Driven Workflows
Scenario A: Troubleshooting NoClassDefFoundError or NoSuchMethodError
- Locate Dependencies: Call
list_module_dependenciesto check if multiple versions of Jars contain conflicting classes. - Version-Isolated Inspection: Use JLens's multi-version isolation feature to load the class for different module contexts respectively. Compare
methodslists to find missing methods. - Build Verification: After modifying pom.xml, call
build_moduleto refresh the local repository and verify the build passes.
Scenario B: Massive Code Refactoring Support
- Global Search: Use
search_java_classwith wildcards (e.g.,com.api.*Service) to find all relevant interfaces. - Batch Inspection: Use
list_class_fieldsto quickly extract private fields of all implementation classes to evaluate state storage. - Source Navigation: When
LOCAL_SOURCEis detected, automatically switch toread_fileto modify code.
3. Execution Strategy
3.1 Protocol Priority
- Probe Registered Service: First check if
jlens-mcp-serverexists in the environment. - Direct Request: If present, use standard MCP
call_toolrequests.
3.2 Command-Line Fallback (When no registered service)
If no service is found, the Agent must autonomously use shell tools to execute:
NPM Mode (Preferred):
npx -y @bhxch/jlens-mcp-server --tool <tool_name> --args '<json_arguments>'
Python Mode:
uvx jlens-mcp-server --tool <tool_name> --args '<json_arguments>'
4. Performance and Limitations
- GAV Cache: JLens shares cache by
GroupId:ArtifactId:Version. Parsing results for third-party libraries (like Spring) are shared across projects, usually responding within 100ms. - Initial Indexing: The first run of
search_java_classon large projects may trigger full indexing (~60s). Subsequent requests are millisecond-level. - JDK Requirement: Underlying environment must be Java 25+.