1. Conduid
  2. AI
  3. Lsp4j MCP
MCP server · AI

Lsp4j MCP

A Java MCP (Model Context Protocol) server that wraps JDTLS (Eclipse JDT Language Server) using LSP4J to provide Java IDE features to AI assistants like Claude.

53Fair

Scored 2 hours ago · breakdown

About Lsp4j MCP

Lsp4j MCP is an MCP server published by stephanj in the AI category: a Java MCP (Model Context Protocol) server that wraps JDTLS (Eclipse JDT Language Server) using LSP4J to provide Java IDE features to AI assistants like Claude.

The repository has 37 stars and 6 forks, with the last commit 12 days ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/stephanj/LSP4J-MCP

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (5)

document_symbolsGet all symbols defined in a Java file

Parameters not published.

find_definitionGo to the definition of a symbol

Parameters not published.

find_interfaces_with_methodFind all interfaces containing a method with a given name

Parameters not published.

find_referencesFind all references to a symbol at a given file location

Parameters not published.

find_symbolsSearch for Java symbols (classes, methods, fields) by name

Parameters not published.

Ask AI

✦

Ask AI about Lsp4j MCP

Powered by Claude · Grounded in docs

I know everything about Lsp4j MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 2 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v1.0.0v1.0.0 · 5 Jan 2026First release

README

LSP4J-MCP Server

A Java MCP (Model Context Protocol) server that wraps JDTLS (Eclipse JDT Language Server) using LSP4J to provide Java IDE features to AI assistants like Claude.

Features

This MCP server exposes the following tools:

Tool Description
find_symbols Search for Java symbols (classes, methods, fields) by name
find_references Find all references to a symbol at a given file location
find_definition Go to the definition of a symbol
document_symbols Get all symbols defined in a Java file
find_interfaces_with_method Find all interfaces containing a method with a given name

Prerequisites

  • Java 21+
  • Maven 3.8+
  • JDTLS installed (e.g., via Homebrew: brew install jdtls)

Build

mvn clean package

This creates a shaded JAR at target/lsp4j-mcp-1.0.0-SNAPSHOT.jar.

Usage

Option 1: Run Script

./run.sh /path/to/your/java/project

Option 2: Direct Java Command

java -jar target/lsp4j-mcp-1.0.0-SNAPSHOT.jar <workspace-path> <jdtls-command>

Example:

java -jar target/lsp4j-mcp-1.0.0-SNAPSHOT.jar /Users/me/projects/myapp jdtls

Option 3: Claude Code MCP Configuration

Add to your .mcp.json:

{
  "mcpServers": {
    "java-lsp": {
      "command": "java",
      "args": [
        "-jar",
        "/path/to/LSP4J-MCP/target/lsp4j-mcp-1.0.0-SNAPSHOT.jar",
        "/path/to/your/java/project",
        "jdtls"
      ],
      "env": {
        "LOG_FILE": "/tmp/lsp4j-mcp.log"
      }
    }
  }
}

Option 4: Docker

Build the multi-stage image. It includes Java 21, the shaded MCP server, and a pinned Eclipse JDTLS distribution:

docker build -t lsp4j-mcp:local .

Run it over stdio and mount the Java project at /workspace:

docker run --rm -i \
  --mount type=bind,source=/absolute/path/to/java/project,target=/workspace \
  lsp4j-mcp:local

On Linux, use the host UID/GID when the language server needs to write project metadata into the mounted workspace:

docker run --rm -i \
  --user "$(id -u):$(id -g)" \
  --mount type=bind,source=/absolute/path/to/java/project,target=/workspace \
  lsp4j-mcp:local

Example MCP configuration:

{
  "mcpServers": {
    "java-lsp-docker": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--mount",
        "type=bind,source=/absolute/path/to/java/project,target=/workspace",
        "lsp4j-mcp:local"
      ]
    }
  }
}

The server uses stdio, so the image exposes no network port. Container logs are written to stderr while stdout remains reserved for the MCP protocol. The image runs as UID/GID 10001 by default and expects at least 1 GB of container memory.

Project Structure

LSP4J-MCP/
├── pom.xml                              # Maven build configuration
├── run.sh                               # Startup script
├── mcp-config.json                      # Example MCP configuration
├── src/
│   ├── main/
│   │   ├── java/com/devoxx/lsp4jmcp/
│   │   │   ├── client/
│   │   │   │   ├── JdtlsClient.java         # LSP client for JDTLS
│   │   │   │   └── JdtlsLanguageClient.java # LSP callback handler
│   │   │   ├── tools/
│   │   │   │   └── JavaTools.java           # Tool implementations
│   │   │   └── server/
│   │   │       └── McpServerMain.java       # MCP server entry point
│   │   └── resources/
│   │       └── logback.xml                  # Logging configuration
│   └── test/
│       └── java/com/devoxx/lsp4jmcp/
│           ├── client/JdtlsClientTest.java
│           ├── tools/JavaToolsTest.java
│           └── server/McpServerMainTest.java
└── README.md

Testing

Run all tests:

mvn test

Dependencies

  • LSP4J - Eclipse Language Server Protocol for Java
  • MCP Java SDK - Model Context Protocol SDK
  • JDTLS - Eclipse JDT Language Server

Example Prompts

Once the MCP server is configured, you can ask your AI assistant questions that will trigger the LSP tools. Here are some examples:

Finding Symbols

"Find all classes named Repository in this project"

"Search for methods containing 'save' in their name"

"Where is the UserService class defined?"

"List all interfaces in this codebase"

Finding References

"Find all usages of the processOrder method at line 45 in OrderService.java"

"Where is the CustomerRepository interface used throughout the codebase?"

"Show me all places that call the constructor at line 12 of PaymentGateway.java"

Go to Definition

"What is the definition of the method being called at line 78, column 15 in CheckoutController.java?"

"Take me to the implementation of the interface method at line 23 in MyService.java"

Document Symbols

"List all methods and fields in the Customer.java file"

"What symbols are defined in src/main/java/com/example/service/OrderService.java?"

"Give me an overview of the structure of ConfigurationManager.java"

Finding Interface Methods

"Which interfaces define a method called 'findById'?"

"Find all classes that have a method named 'process'"

"Show me all interfaces containing the 'validate' method"

Complex Queries

"I need to understand how the authenticate method works. First find its definition, then show me all places it's called."

"Refactor help: Find all usages of the deprecated legacyProcess method so I can update them"

"I want to implement a new Repository interface. Show me all existing Repository interfaces and their methods."

Logging

Logs are written to the file specified by the LOG_FILE environment variable (default: /tmp/lsp4j-mcp.log).

Note: stdout is reserved for MCP protocol communication, so all logging goes to file.

Architecture

Claude Code ──MCP──▶ McpServerMain ──LSP4J──▶ JDTLS ──▶ Java Codebase
                         │
                         ▼
                    JavaTools
                    (find_symbols, find_references, etc.)

The server:

  1. Starts JDTLS as a subprocess
  2. Connects via LSP4J (JSON-RPC over stdio)
  3. Exposes LSP features as MCP tools
  4. Communicates with Claude Code via MCP protocol

Examples using Claude Code

License

MIT

README fetched from the repository 2 hours ago. The original is authoritative.

Questions

About Lsp4j MCP

How do I install Lsp4j MCP?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Lsp4j MCP safe to use with an AI agent?

Its trust score is 53 out of 100 (fair). It passes 3 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Lsp4j MCP still maintained?

Yes — the last commit was 12 days ago. The repository has 37 stars and 6 forks and 6 open issues.