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.
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
Maintainer
Works with
Installation
Manual Installation
npx lsp4j-mcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
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 --versionClone 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 packageTest 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/projectAdd 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"
}
}
}
}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.
LSP4J MCP Alternatives — Similar Developer Tools Servers
Looking for alternatives to LSP4J MCP? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
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.
Set Up LSP4J MCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.