MCP Directory

How to add JavaLens to Windsurf

Compiler-accurate Java code analysis for AI agents, built on Eclipse JDT with 75 semantic tools. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.

Last updated June 14, 2026 · 31 · stdio · no auth

Windsurf config for JavaLens

npx -y javalens-mcp
{
  "mcpServers": {
    "javalens": {
      "command": "npx",
      "args": [
        "-y",
        "javalens-mcp"
      ],
      "env": {
        "JAVA_PROJECT_PATH": "/path/to/your/java/project"
      }
    }
  }
}

Setup steps

  1. 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
  2. 2Paste the JavaLens config below.
  3. 3Fill in placeholder secrets, then save.
  4. 4Click Refresh in the MCP panel.
  5. 5JavaLens's tools become available to Cascade.

Before you start

  • Java 21 or later on PATH or via JAVA_HOME (server runtime)
  • Node.js 18+ (only for the npm/npx install path)
  • A Maven, Gradle, Bazel, or plain Java project to analyze

What JavaLens can do in Windsurf

search_symbols

Search types, methods, and fields by glob pattern.

go_to_definition

Navigate to a symbol's definition.

find_references

Find all usages of a symbol.

find_implementations

Find interface/class implementations.

get_type_hierarchy

Get a type's inheritance chain.

get_document_symbols

Get all symbols in a file.

get_symbol_info

Get detailed symbol information at a position.

get_type_at_position

Get type details at the cursor.

Security

Runs locally over stdio with no authentication. During project load, JavaLens may invoke `mvn`/`gradle` subprocesses to resolve classpaths; failures surface as structured LoadWarnings rather than silently degrading analysis. Refactoring tools return text edits and do not modify files directly. Requires Java 21+ on PATH (or JAVA_HOME); the npm path additionally needs Node.js 18+.

JavaLens + Windsurf FAQ

Where is the Windsurf config file?

Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the JavaLens config there under the "mcpServers" key and restart the client.

Is JavaLens safe to use with Windsurf?

Runs locally over stdio with no authentication. During project load, JavaLens may invoke `mvn`/`gradle` subprocesses to resolve classpaths; failures surface as structured LoadWarnings rather than silently degrading analysis. Refactoring tools return text edits and do not modify files directly. Requires Java 21+ on PATH (or JAVA_HOME); the npm path additionally needs Node.js 18+.

How do I install JavaLens?

Two paths. With Node.js 18+, point your MCP client at `npx -y javalens-mcp`, which downloads and caches the ~23 MB distribution on first run. Without Node, download `javalens.zip`/`javalens.tar.gz` from GitHub Releases, extract it, and point your client at the bundled jar with `java -jar /path/to/javalens.jar -data /path/to/javalens-workspaces`. Both paths require Java 21+ on PATH or JAVA_HOME.

Why use JavaLens instead of LSP or grep?

LSP targets IDE autocomplete and basic navigation, and grep is purely textual. JavaLens uses Eclipse JDT for compiler-accurate analysis: it distinguishes field reads from writes, finds specific reference kinds (casts, annotations, instanceof, throws), computes cyclomatic complexity, detects circular dependencies and dead code, and resolves types across inheritance and generics — capabilities LSP and text search lack.

Do I have to reload the project after editing files?

Not in the default strict disk-sync mode. JavaLens content-hashes known source files before every query, repairs exactly what changed, waits for the index to absorb the repair, and only then answers, so the agent loop is just edit → query. `load_project` is needed only on first use, when a response reports RELOAD_REQUIRED (e.g. pom.xml changed), or to rebuild from scratch. Set JAVALENS_DISK_SYNC=manual to restore the pre-1.5.0 behavior.

View repo Full JavaLens page