# pzalutski-pixel/javalens-mcp [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/pzalutski-pixel/javalens-mcp  
**GitHub Stars:** 50  
**npm Downloads (last month):** 1034  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pzalutski-pixel-javalens-mcp

## Description
56 semantic Java analysis tools via Eclipse JDT. Compiler-accurate navigation, refactoring, find references, call hierarchy, and code metrics for AI agents.

## Tools
Capabilities this server exposes over MCP:

- **search_symbols** — Search types, methods, fields by glob pattern
- **go_to_definition** — Navigate to symbol definition
- **find_references** — Find all usages of a symbol
- **find_implementations** — Find interface/class implementations
- **get_type_hierarchy** — Get inheritance chain
- **get_document_symbols** — Get all symbols in a file
- **get_symbol_info** — Get detailed symbol information at position
- **get_type_at_position** — Get type details at cursor
- **get_method_at_position** — Get method details at cursor
- **get_field_at_position** — Get field details at cursor
- **find_annotation_usages** — Find all `@Annotation` usages
- **find_type_instantiations** — Find all `new Type()` calls
- **find_casts** — Find all `(Type) expr` casts
- **find_instanceof_checks** — Find all `x instanceof Type
- **find_throws_declarations** — Find all `throws Exception` in signatures
- **find_catch_blocks** — Find all `catch(Exception e)` blocks
- **find_method_references** — Find all `Type::method` expressions
- **find_type_arguments** — Find all `List<Type>` usages
- **find_reflection_usage** — Find `Class.forName()`, `Method.invoke()`, and other reflection calls
- **get_diagnostics** — Get compilation errors and warnings
- **validate_syntax** — Fast syntax-only validation
- **get_call_hierarchy_incoming** — Find all callers of a method
- **get_call_hierarchy_outgoing** — Find all methods called by a method
- **find_field_writes** — Find where fields are mutated
- **find_tests** — Discover JUnit/TestNG test methods
- **find_unused_code** — Find unused private members
- **find_unreachable_code** — Project-wide dead code — members unreachable from any main method or test, over the whole-program call graph
- **find_affected_tests** — The tests that exercise a symbol, directly or transitively — the set to run after changing it
- **find_possible_bugs** — Detect null risks, empty catches, resource leaks
- **get_hover_info** — Get documentation/signature for symbol
- **get_javadoc** — Get parsed Javadoc
- **get_signature_help** — Get method signature at call site
- **get_enclosing_element** — Get containing method/class at position
- **analyze_change_impact** — Blast radius — direct call sites by depth, or the full transitive closure over the project graph (`transitive=true`)
- **analyze_data_flow** — Variable read/write/declaration tracking within a method; opt-in `followCalls` tracks null/taint facts across calls to sinks
- **analyze_control_flow** — Branching, loops, return/throw points, nesting depth
- **get_di_registrations** — Find Spring DI registrations (@Component, @Bean, @Autowired, @Inject)
- **get_jpa_model** — Assembled JPA entity model — tables, id fields, relationships with resolved targets and mappedBy sides
- **get_http_endpoints** — Assembled HTTP route table — Spring and JAX-RS paths composed from class prefixes, mapped to handler methods
- **analyze_file** — Get imports, types, diagnostics in one call
- **analyze_type** — Get members, hierarchy, usages, diagnostics
- **analyze_method** — Get signature, callers, callees, overrides
- **get_type_usage_summary** — Get instantiations, casts, instanceof counts
- **rename_symbol** — Rename across entire project
- **organize_imports** — Sort and clean imports
- **extract_variable** — Extract expression to local variable
- **extract_method** — Extract code block to new method
- **extract_constant** — Extract to `static final` field
- **extract_interface** — Create interface from class methods
- **extract_superclass** — Move a member into a newly created superclass
- **inline_variable** — Replace variable with its initializer
- **inline_method** — Replace call with method body
- **change_method_signature** — Modify params/return, update all callers
- **convert_anonymous_to_lambda** — Convert anonymous class to lambda
- **encapsulate_field** — Generate accessors and rewrite all direct field accesses
- **pull_up** — Move a member into the superclass
- **push_down** — Move a member into the subclasses
- **introduce_parameter_object** — Bundle a method's parameters into a new class, updating callers
- **move_type_to_new_file** — Move a nested type into its own top-level file
- **suggest_imports** — Find import candidates for unresolved type
- **get_quick_fixes** — List available fixes for problem at position
- **apply_quick_fix** — Apply fix by ID (add import, remove import, add throws, try-catch)
- **apply_cleanup** — Apply one of 10 JDT clean-ups (convert loops, pattern matching, switch expressions, text blocks, ...) and return rewritten source
- **diagnose_and_fix** — Diagnose a file and return each problem's top quick-fix edits in one call
- **get_complexity_metrics** — Cyclomatic/cognitive complexity, LOC per method
- **get_dependency_graph** — Package/type dependencies as nodes and edges
- **find_circular_dependencies** — Detect package cycles using Tarjan's SCC algorithm
- **find_large_classes** — Find types exceeding method/field/line count thresholds
- **find_naming_violations** — Check against Java naming conventions
- **health_check** — Server status and capabilities
- **load_project** — Load Maven/Gradle/Bazel/plain Java project
- **get_project_structure** — Get package hierarchy
- **get_classpath_info** — Get classpath entries
- **get_type_members** — Get members by type name
- **get_super_method** — Find overridden method in superclass

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "javalens-mcp": {
    "command": "npx",
    "args": ["-y","javalens-mcp"],
    "env": {
      "JAVA_HOME": "",
      "JAVA_PROJECT_PATH": ""
    }
  }
}
```

**Requires environment variables:** `JAVA_HOME`, `JAVA_PROJECT_PATH` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What pzalutski-pixel/javalens-mcp MCP server does

pzalutski-pixel/javalens-mcp MCP server gives AI agents semantic access to Java projects through Eclipse JDT. Its analysis is based on resolved Java structure rather than matching strings in source files, so queries can distinguish overloaded methods, inherited members, type arguments, field reads, and field writes.

The server covers code navigation, symbol inspection, fine-grained reference searches, call relationships, diagnostics, and selected static-analysis checks. It can locate definitions and implementations, inspect types and methods at a source position, identify annotation or cast usage, find test methods, and report possible null risks, empty catch blocks, and resource leaks.

## How it works

Eclipse JDT creates an indexed workspace for each MCP session. The workspace stores search indexes, compilation state, and metadata outside the source tree; the project is linked rather than copied. This keeps the Java project free of Eclipse-generated files and allows separate sessions to analyze the same source independently.

JDT resolves inheritance, method overloading and overriding, generic types, imports, and classpath dependencies. The implementation supports Java source versions from 1.1 through 25 while requiring Java 21 or later to run the server. A bundled Lombok agent helps JDT resolve generated members such as accessors from `@Data`.

Queries include both broad navigation and targeted reference categories. For example, an agent can search for all instantiations of a type, `instanceof` checks, `throws` declarations, catch blocks, method references, reflection calls, or writes to a field. Call-hierarchy tools report incoming callers and outgoing calls, while affected-test analysis identifies tests that exercise a symbol directly or transitively.

## Setup and configuration

pzalutski-pixel/javalens-mcp MCP server requires Java 21 or newer on `PATH` or available through `JAVA_HOME`. Node.js 18 or newer is needed only for the npm and `npx` installation route. A release archive can be downloaded and run with Java directly, or `npx -y javalens-mcp` can download and cache the distribution.

The direct configuration starts the bundled JAR with Java and supplies a workspace location through the `-data` argument. The npm configuration uses `npx` and can set `JAVA_PROJECT_PATH` to load a project automatically at startup. Project loading occurs in the background, so clients may connect before indexing has finished. The workspace directory should be treated as server-managed metadata rather than a replacement for the project’s own build outputs.

## Tools and capabilities

The available tools include:

- Symbol search, definition lookup, document symbols, hover information, and type or method inspection.
- Reference and structure queries for implementations, inheritance, annotations, casts, instantiations, `instanceof`, throws clauses, catches, method references, type arguments, and reflection.
- Incoming and outgoing call hierarchy, field-write detection, test discovery, affected-test discovery, unused private-code detection, and unreachable-code analysis.
- Compilation diagnostics and fast syntax validation.
- Possible-bug detection for null risks, empty catches, and resource leaks.

## Limitations and notes

pzalutski-pixel/javalens-mcp MCP server is an analysis server, not a compiler. It parses and understands Java source, but the material does not describe it as a replacement for the project’s build or test system. Results depend on the project being loaded and indexed, including the relevant source, dependencies, and classpath information.

The server uses a separate workspace and creates session-specific metadata. Concurrent sessions therefore do not share one analysis state. Automatic project loading is asynchronous, so an agent should wait until indexing has completed before relying on repository-wide results.

_Full upstream README: https://allmcps.com/mcp/pzalutski-pixel-javalens-mcp/readme_

