LSP4J
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.
claude mcp add --transport stdio stephanj-lsp4j-mcp java -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"
How to use
The LSP4J-MCP Server wraps the Eclipse JDT Language Server (JDTLS) through LSP4J to expose Java IDE capabilities to an AI assistant via the MCP protocol. It provides tools for exploring and navigating Java code such as finding symbols by name, locating references, jumping to definitions, listing all symbols in a file, and discovering interfaces that declare a given method. Once running, you can query these tools through Claude Code or any MCP-enabled client by prompting with natural language requests that map to these tools. For example, you can ask the assistant to find all methods named 'save', locate where a particular class is defined, or retrieve a list of all symbols defined in a given Java file. The server communicates with JDTLS to perform the underlying language analysis and returns structured results that the AI assistant can present to you.
How to install
Prerequisites:
- Java 21+ installed
- Maven 3.8+ installed
- JDTLS installed (e.g., via Homebrew: brew install jdtls)
Install steps:
- Clone or download the LSP4J-MCP project.
- Build the project with Maven:
mvn clean package
- Locate the generated JAR at target/lsp4j-mcp-1.0.0-SNAPSHOT.jar.
- Run the MCP server using one of the supported configurations. Example using the included runtime:
./run.sh /path/to/your/java/project
Alternatively, run directly with Java:
java -jar target/lsp4j-mcp-1.0.0-SNAPSHOT.jar /path/to/your/java/project jdtls
- If you want to configure Claude Code, create an MCP configuration entry like the one below (adjust paths as needed).
Additional notes
Notes:
- Logs are written to the file specified by the LOG_FILE environment variable (default: /tmp/lsp4j-mcp.log). stdout is reserved for MCP protocol communication.
- Ensure JDTLS is available on the system PATH or adjust the command/args to point to the exact JDTLS launcher if using the direct Java command option.
- The MCP server starts JDTLS as a subprocess and communicates via LSP4J (JSON-RPC over stdio). If you run into port or I/O issues, verify the Java process has permissions to read the workspace and the JDTLS resources.
- Replace /path/to/your/java/project with the workspace you want to analyze and /path/to/LSP4J-MCP/target/lsp4j-mcp-1.0.0-SNAPSHOT.jar with the actual build artifact path.
- The provided tools (find_symbols, find_references, find_definition, document_symbols, find_interfaces_with_method) cover common code navigation tasks helpful for AI-assisted code understanding.
Related MCP Servers
mcp-unity
Model Context Protocol (MCP) plugin to connect with Unity Editor — designed for Cursor, Claude Code, Codex, Windsurf and other IDEs
jadx-ai
Plugin for JADX to integrate MCP server
decipher-research-agent
Turn topics, links, and files into AI-generated research notebooks — summarize, explore, and ask anything.
desktop
Agentify Desktop lets Codex/Claude/OpenCode control your logged-in ChatGPT, Claude, AiStudio, Gemini, Grok, Perplexity web sessions via MCP, parallel hidden/visible tabs, file upload + image download
ClaudeR
Connect RStudio to Claude, Codex, Gemini, and other AI assistants via MCP. Multi-agent orchestration, async execution, and zero-config setup with uvx.
openapi
OpenAPI definitions, converters and LLM function calling schema composer.