LSP4J MCP

v1.0.0Developer Toolsstable

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.

claudecodecodexgeminijavalanguageserverprotocol
Share:
25
Stars
0
Downloads
0
Weekly
0/5

What is LSP4J MCP?

LSP4J MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.

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.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A Java MCP (Model Context Protocol) server that wraps JDTLS

Use Cases

Java IDE features for AI assistants
Eclipse JDT Language Server integration
Language-aware code analysis
stephanj

Maintainer

LicenseMIT
Languagejava
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx lsp4j-mcp

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use LSP4J MCP

LSP4J MCP is a Java MCP server that wraps JDTLS (Eclipse JDT Language Server) using the LSP4J library to give AI assistants IDE-grade Java intelligence. It exposes tools for finding Java symbols and class definitions, locating all references to a symbol, listing all symbols in a file, and discovering interfaces containing a given method — all powered by the same language server used in Eclipse and VS Code. Java developers use it with Claude Code, Codex, or Gemini to perform accurate, compiler-aware code navigation across large Java projects without manual file reading.

Prerequisites

  • Java 21 or higher (JDK, not just JRE)
  • Maven 3.8 or higher for building the project
  • JDTLS (Eclipse JDT Language Server) installed — e.g., `brew install jdtls` on macOS
  • An MCP-compatible client such as Claude Code, Claude Desktop, or a compatible IDE extension
  • A Java project directory to analyze (must be a valid Maven or Gradle project for full JDTLS features)
1

Install JDTLS

JDTLS must be installed and available as a command on your PATH. On macOS use Homebrew; on Linux download from the Eclipse JDT Language Server releases page.

# macOS
brew install jdtls

# Verify
jdtls --version
2

Clone and build the server

LSP4J MCP is not published to Maven Central or npm; build it from source using Maven. The resulting JAR will be in the target directory.

git clone https://github.com/stephanj/LSP4J-MCP.git
cd LSP4J-MCP
mvn clean package
3

Test the server from the command line

Run the server directly against your Java project to confirm it starts and JDTLS initializes correctly. Replace the path arguments with your actual project path and JDTLS command.

java -jar target/lsp4j-mcp-1.0.0-SNAPSHOT.jar /path/to/your/java/project jdtls

# Or use the convenience script
./run.sh /path/to/your/java/project
4

Add the server to your MCP client configuration

Create or edit your .mcp.json file in the project root (for Claude Code) or claude_desktop_config.json (for Claude Desktop). Set LOG_FILE to redirect verbose JDTLS output away from MCP stdio.

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

Use Java navigation tools in your AI assistant

Ask your AI assistant to find class definitions, list method references, or discover interface implementations. The server delegates to JDTLS and returns compiler-accurate results based on the actual project classpath.

LSP4J MCP Examples

Client configuration (.mcp.json for Claude Code)

MCP configuration for Claude Code using the built LSP4J MCP JAR. Place this .mcp.json in the root of the Java project you want to analyze.

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

Prompts to try

Prompts that use the Java symbol navigation and reference tools exposed by LSP4J MCP.

- "Find the definition of the UserService class in this project"
- "List all references to the calculateTotal method in OrderService.java"
- "Show me all symbols defined in src/main/java/com/example/OrderController.java"
- "Find all interfaces in the project that have a method called process"
- "Where is the CustomerRepository interface implemented?"
- "List all methods in the PaymentService class"

Troubleshooting LSP4J MCP

Server fails to start with 'jdtls not found' or similar error

Ensure jdtls is on your PATH by running `which jdtls` or `jdtls --version` in a terminal. If installed via Homebrew, run `brew link jdtls`. On Linux, add the JDTLS bin directory to your PATH in ~/.bashrc or ~/.zshrc.

JDTLS takes a long time to initialize on first run

JDTLS performs a full project index on first startup, which can take several minutes for large projects. Subsequent starts reuse the index cache. Check /tmp/lsp4j-mcp.log for progress messages.

find_references returns empty results for valid symbols

JDTLS must complete indexing before reference searches work accurately. Wait for initialization to finish (watch the log file for 'Project import finished') and retry. Ensure the workspace path passed to the JAR is the project root containing pom.xml or build.gradle.

Frequently Asked Questions about LSP4J MCP

What is LSP4J MCP?

LSP4J MCP is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install LSP4J MCP?

Follow the installation instructions on the LSP4J MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with LSP4J MCP?

LSP4J MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is LSP4J MCP free to use?

Yes, LSP4J MCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "lsp4j-mcp": { "command": "npx", "args": ["-y", "lsp4j-mcp"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use LSP4J MCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides