java-lsp-mcp
Supports Gradle-based Java projects, providing workspace and dependency navigation, diagnostics, compilation, tests, and refactoring previews for Gradle project structures.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@java-lsp-mcpfind affected tests for the change in PaymentService.java"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
java-lsp-mcp
Java semantic intelligence for Model Context Protocol (MCP) clients, powered by Eclipse JDT Language Server and ECJ.
java-lsp-mcp gives coding agents semantic navigation, diagnostics, compilation, tests, and refactoring previews. It never edits source files: changes are returned as hash-bound edits and optional diffs for the client to apply.
Features
Workspace and dependency navigation
Maven, Gradle, Eclipse, modular, and unmanaged projects
Current-snapshot diagnostics and ECJ compilation
Parallel JUnit tests, suspended JDWP test launches, affected-test discovery, and JaCoCo coverage
Read-only fixes, refactorings, import, and formatting previews
Bounded, paginated agent-friendly results
Related MCP server: ACE-MCP
Prerequisites
Node.js 24+ — the server runs on your Node; release launchers use
nodefromPATH.A JDK — pointed to by
JAVA_HOMEor--tooling-jdk. It runs JDT LS and your tests.A Java workspace — Maven, Gradle, Eclipse, modular, or unmanaged.
Release archives bundle JDT LS, JUnit, and JaCoCo. Everything else comes from the prerequisites above.
Installation
Download the archive for your platform from the releases page, unpack it, and run:
java-lsp-mcp/bin/java-lsp-mcp serve --workspace /absolute/path/to/project --trust-workspaceOn Windows use bin\java-lsp-mcp.cmd. Then verify with java-lsp-mcp doctor --workspace /project.
To use it in VS Code, add the launcher to .vscode/mcp.json in your project:
{
"servers": {
"java-lsp-mcp": {
"command": "/absolute/path/to/java-lsp-mcp/bin/java-lsp-mcp",
"args": ["serve", "--workspace", "/absolute/path/to/project", "--trust-workspace"]
}
}
}java-lsp-mcp print-config generic --workspace /project --trust-workspace prints the equivalent snippet for other clients.
Configuration
Flags for serve (a java-lsp-mcp.json or java-lsp-mcp.toml file in the workspace and JAVA_LSP_MCP_* environment variables work too; flags win, then env, then the file):
Flag | What it does |
| The project to work on (absolute path, required). |
| Allow Maven/Gradle import, compilation, and test execution. Without it the server only reads code — review the project first. |
| JDK that runs JDT LS (defaults to |
| JDK that runs your tests (defaults to the tooling JDK). |
| Never touch the network; Maven/Gradle resolve from caches only. |
| Leave a module out of import, compilation, and tests (repeatable). |
| Extra directory or jar on the test runtime classpath (repeatable). |
| Override file-encoding detection when the project has no Eclipse settings. |
| Shared operation timeout in ms and per-result output budget in bytes. |
| Operational tuning; all logs go to stderr, never stdout. |
Other commands: doctor checks the setup, version prints versions, describe-tools prints the complete machine-readable tool schemas, print-config generates client configuration, and clear-cache wipes the workspace index.
Tools
Tool | Purpose |
| Readiness and runtime status |
| Source declarations |
| Workspace and dependency symbols |
| Symbol declarations |
| Semantic usages |
| Callers and callees; incoming callers default to production scope |
| Supertypes, subtypes, implementations |
| Current-snapshot diagnostics; fails fast with |
| ECJ workspace compilation with automatic loaded-prerequisite recovery |
| Maven/Gradle configuration re-sync into JDT ( |
| JUnit execution or suspended JDWP debug launch ( |
| Statically connected tests |
| Candidate unused private members |
| Available fixes and refactorings |
| Rename, action, import, format previews |
| Discover local JVMs started with the JDWP agent |
| JDWP debug-session lifecycle |
| Source breakpoints and bounded stop-event waits |
| Filtered runtime thread/stack, local, collection, and object inspection |
| Continue and step over, into, or out |
| ECJ/JDI Hot Code Replace with change and active-frame reporting |
Run java-lsp-mcp describe-tools for the complete machine-readable tool schemas.
Contributing
Contributions are welcome. See CONTRIBUTING.md.
Build from source with:
npm ci
npm run fetch-runtime
npm run check
bin/java-lsp-mcp serve --workspace /absolute/path/to/project --trust-workspaceSecurity
Review SECURITY.md before granting workspace trust. Report vulnerabilities privately.
License
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Ship better Java with your coding agent.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Project memory, semantic code search, and grounded agent context.
Codebase graphs, caller impact analysis, and recorded project context for AI coding agents.
Related MCP Servers
- AlicenseBqualityCmaintenanceProvides Java development capabilities through Eclipse JDT.LS, enabling symbol navigation, code diagnostics, workspace searching, and Javadoc access across Java projects.10MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to perform local code search, indexing, and analysis across Java, JavaScript/TypeScript, .NET/C#, and Python projects through the MCP protocol.1Apache 2.0
- FlicenseBqualityDmaintenanceWraps the Eclipse JDT Language Server to enable AI assistants to understand Java codebases, search symbols, navigate definitions/references, and read third-party .class files.7-
- AlicenseNot gradedqualityAmaintenanceEnables agents to perform local hybrid code search and code intelligence across a workspace, including semantic and full-text search, symbol lookup, file outlines, and caller analysis.MIT