Skip to main content
MCP server CX Codex

JavaLens — Claude Code MCP server: semantic Java analysis

An MCP server that hands your agent 75 semantic Java tools built on Eclipse JDT: reference search, refactoring, type analysis. Useful when text search mixes up overloads and implementations.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env JAVA_PROJECT_PATH=<JAVA_PROJECT_PATH> --env JAVALENS_TIMEOUT_SECONDS=<JAVALENS_TIMEOUT_SECONDS> --env JAVALENS_LOG_LEVEL=<JAVALENS_LOG_LEVEL> --transport stdio javalens -- npx -y javalens-mcp
Open on GitHub

What JavaLens does

JavaLens plugs into an agent as an MCP server and answers code questions through Eclipse JDT Core, the engine behind Eclipse IDE. That is where the accuracy comes from. It tells a field read apart from a field write, and locates casts, annotations, catch blocks, instanceof checks, method references and generic type arguments. Queries hit an index JDT builds when the project loads instead of walking source files.

The 75 tools cover symbol navigation, implementation lookup, refactoring such as rename and extract method, metrics including cyclomatic complexity, dead-code reachability, and the tests that transitively exercise a symbol. Source parsing spans Java 1.1 through 25, markdown Javadoc and compact source files included. Lombok members resolve too, because a bundled agent handles @Data accessors so they are not reported as undefined.

Java 21 or newer must sit on PATH, or JAVA_HOME must point at it. That applies to both install routes. Node.js 18+ matters only for the npx route; the release archive skips it. Project loading runs in the background, so the server answers right away while health_check reports progress. No Java 21 means no server, so check the version first.

One thing to watch: models lean toward grep and file reads even when semantic analysis wins. Put a note in CLAUDE.md telling the agent to reach for JavaLens tools on Java code.

What it helps with

  • find every call to a method without matching same-named methods elsewhere
  • separate field writes from field reads
  • list interface implementations rather than any mention of the type
  • rename a symbol safely across the project
  • measure cyclomatic complexity of a method

Example prompts for the agent

  • Use JavaLens to find every call to UserService.save() in this project
  • Show me the implementations of PaymentGateway and where each one is used
  • Rename calcTotal to calculateTotal across the whole project

How to install JavaLens

Platform CLI

claude mcp add --env JAVA_PROJECT_PATH=<JAVA_PROJECT_PATH> --env JAVALENS_TIMEOUT_SECONDS=<JAVALENS_TIMEOUT_SECONDS> --env JAVALENS_LOG_LEVEL=<JAVALENS_LOG_LEVEL> --transport stdio javalens -- npx -y javalens-mcp

Replace <…> with your own values

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about JavaLens

How do I install JavaLens in Claude Code?

The short way is claude mcp add javalens -- npx -y javalens-mcp. To pass environment variables, use the longer form: `claude mcp add --env JAVA_PROJECT_PATH=<JAVA_PROJECT_PATH> --env JAVALENS_TIMEOUT_SECONDS=<JAVALENS_TIMEOUT_SECONDS> --env JAVALENS_LOG_LEVEL=<JAVALENS_LOG_LEVEL> --transport stdio javalens -- npx -y javalens-mcp`.

What does JavaLens do?

It gives an agent 75 semantic Java analysis tools on Eclipse JDT: reference and implementation search, navigation, refactoring, metrics, dead-code reachability. It beats text search where overloads, inheritance and generics matter.

What does JavaLens need to run?

Java 21 or newer on PATH, or a set JAVA_HOME. Node.js 18+ is needed only for the npx install; the GitHub release archive does not require it.

Similar MCP servers

Everything for Programming languages →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor