SL

stephanj/lsp4j-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

39 stars 6 forks 品質 67 トレンド 20

LSP4J を使用して JDTLS (Eclipse JDT Language Server) をラップする Java MCP (Model Context Protocol) サーバーで、Claude のような AI アシスタントに Java IDE 機能を提供します.

概要

LSP4J を使用して JDTLS (Eclipse JDT Language Server) をラップする Java MCP (Model Context Protocol) サーバーで、Claude のような AI アシスタントに Java IDE 機能を提供します。 このMCPサーバーは、以下のツールを公開します。 - Java 21 + - Maven 3.8 + - JDTLS をインストール (例: Homebrew: brew install jdtls) ターゲット/lsp4j-mcp-1.0.0-SNAPSHOT.jarでシェードされたJARを作成します。 多段画像を作成。 これは、Java 21, シェードMCPサーバー, ピン化されたEclipse JDTLS分布: stdio 上で実行し、/workspace で Java プロジェクトをマウントします。 Linux では、言語サーバーがプロジェクトメタデータをマウントされたワークスペースに書き込む必要があるときにホスト UID/GID を使用します。 サーバは stdio を使っているので、イメージはネットワークポートを明示しません。 コンテナログは、stdout が MCP プロトコルで予約されている間、stderr に書かれています。 デフォルトで UID/GID 10001 として動作し、コンテナメモリの 1 GB 以上を期待します.

概要(AI 翻訳)

LSP4J を使用して JDTLS (Eclipse JDT Language Server) をラップする Java MCP (Model Context Protocol) サーバーで、Claude のような AI アシスタントに Java IDE 機能を提供します。

##特徴

このMCPサーバーは、以下のツールを公開します。

| ツール | 概要 | お問い合わせ | [find_symbols | 名称から探す | | [find_references | 特定のファイルの位置でシンボルへのすべての参照を見つける | | [[T2] | [[T2] | [[T2] | [[T2] | [[T2] ] | [[T2] | [[T2] ] | [[T2] ] | [[T2] ] | [[T2] ] | [[[[T2] ] ] | [[[T2] ] ] | [[[T2] ] ] | [[T2] ] ] | [[[[T2] ] ] シンボルの定義へ進む | | [document_symbols | Javaファイルで定義されている全てのシンボルを取得する | | [find_interfaces_with_method | 特定の名前でメソッドを含むすべてのインターフェイスを見つける |

前提条件

  • Java 21 以降
  • Maven 3.8 +
  • JDTLS インストール (例: Homebrew: [brew install jdtls))

##ビルド

target/lsp4j-mcp-1.0.0-SNAPSHOT.jarでシェードされたJARを作成します。

使用法

##Option 1: スクリプトを実行

Option 2: Java コマンドの指示

例:

Option 3: クロード コード MCP 構成

[.mcp.jsonに追加します。

##Option 4: ドッカー

多段画像を作成。 これは、Java 21, シェード MCP サーバー, そして、 pinned Eclipse JDTLSの配分:

stdio 上で実行し、Java プロジェクトを [/workspace でマウントします

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 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  

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
GitHub で README 全文を見る

インストール

docker run --rm -i --mount type=bind source=/absolute/path/to/java/project target=/workspace lsp4j-mcp:local
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "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" } } } }