jar-inspector-mcp
jar-inspector-mcp
Claude Code が Java アーカイブの内部を読み取れるようにする MCP サーバー — クラス、API、ソース、リソース、バイトコード — 展開せずに。
問題
Claude Code が JVM プロジェクトで作業していて、jar の中身を知る必要がある場合、シェルツールに頼ってしまいます:
unzip -l target/lib/jackson-databind-2.16.1.jar # 780 lines of entry listing
unzip -o app.jar -d /tmp/x && cat /tmp/x/…/Foo.java # a whole file to answer one question
javap -p -c -cp app.jar com.acme.Foo # 300 KB of bytecodeそのすべてがコンテキストウィンドウに流れ込み、そのほとんどはノイズで、一部はワーキングツリーに一時ファイルを書き込みます。
解決策
10 個の焦点を絞ったツールが実際の質問 — 「この jar には何が入っているか」「このクラスの API は何か」「この文字列はどこで設定されているか」— に答え、その情報だけを返します。
jackson-databind-2.16.1.jar (779 クラス、展開時 4.1 MB) で測定:
代わりに | jar-inspector | |||
| 79,674 文字 |
| 2,632 文字 | 97% 削減 |
| 36,008 文字 |
| 18,061 文字 | 50% 削減 |
| 303,105 文字 |
| 21,409 文字 | 93% 削減 |
ディスクに書き込まれることは一切なく、JDK も不要です — クラスファイルパーサーは純粋な Python です。(jar_disassemble だけが例外で、javap を外部コマンドとして実行します。)
インストール
uv と Python 3.10+ が必要です。
# from GitHub, nothing to clone
claude mcp add jar-inspector -- uvx --from git+https://github.com/pgatzka/jar-inspector-mcp jar-inspector-mcp
# or from a local clone
git clone https://github.com/pgatzka/jar-inspector-mcp && cd jar-inspector-mcp
claude mcp add jar-inspector -- uv run --directory "$PWD" jar-inspector-mcp--scope project を追加すると .mcp.json を通じてリポジトリと共有でき、--scope user を追加するとどこでも有効になります。代わりに手動で設定する場合:
// .mcp.json
{
"mcpServers": {
"jar-inspector": {
"command": "uvx",
"args": ["--from", "git+https://github.com/pgatzka/jar-inspector-mcp", "jar-inspector-mcp"]
}
}
}claude mcp list、または Claude Code 内の /mcp で確認します。
他の MCP クライアント: このサーバーは stdio で通信するため、uvx --from … jar-inspector-mcp をコマンドとしてどこでも使用できます。
ツール
Tool | 回答 |
| このアーティファクトは何か? マニフェスト、パッケージ、クラス数、バイトコードレベル、ソースが添付されているか |
| 中にはどのエントリがあるか? グロブと種類でフィルタリング、ページング対応 |
|
|
| このクラスの API は何か? 宣言、アノテーション、フィールド、メソッドシグネチャ |
| 実際には何をするか? 添付された |
| この設定には何が入っているか? 1 つのテキストエントリ: MANIFEST、 |
| この文字列はどこにあるか? テキストエントリとコンパイル済み文字列定数を横断して grep |
| このクラスは何に触れているか? 内部参照と外部参照 |
| このメソッドは何にコンパイルされるか? |
| jar はどこにあるか? ビルド出力、Maven リポジトリ、Gradle キャッシュを検索 |
すべてのツールは読み取り専用で、以下を受け付ける jar 引数を取ります:
アーカイブ —
.jar、.war、.ear、.aar、.zip、.jmod展開済みクラスディレクトリ —
target/classes、build/classes/java/mainネストされたアーカイブ —
app.jar!BOOT-INF/lib/dep-1.0.jar(Spring Boot のファット jar)
出力例
jar_class_outline の出力をそのまま示します (テストが検証する正確な出力です):
com.acme.demo.UserService [class, Java 21, UserService.java]
// source is attached -- jar_read_source(jar, 'com.acme.demo.UserService') shows it
@Deprecated
@Marker(enabled=true, code='z', tags={"alpha", "beta"})
public class UserService implements Repository<String, Integer>
// fields (2)
public static final String CACHE_KEY = "user.cache"
protected volatile boolean dirty
// constructors (1)
public UserService(Map<Integer, String> users)
// methods (5)
public long count()
public List<String> findAll()
public Optional<String> findById(Integer id) throws IllegalStateException
public <R extends Comparable<R>> List<R> mapAll(Function<String, R> fn)
public void rename(int id, String newName, String... aliases)
// nested (1)
UserService.Builder
// 4 more member(s) hidden (visibility below 'protected', synthetic or bridge)ジェネリックシグネチャ、パラメータ名 (-g 付きでコンパイルされた場合)、可変長引数、宣言済み例外、定数値、レコード、enum、default メソッドはすべて保持されます。メソッド本体、ブリッジメソッド、定数プールは保持されません。
設定
環境変数 | 効果 |
| サーバーが読み取り可能なパス区切り形式のルート。未設定の場合は制限なし |
|
|
| Maven リポジトリの場所 ( |
jar_find は次の順序で検索します: ./target、./build/libs、./libs、./lib、Maven リポジトリ、Gradle モジュールキャッシュ、Ivy キャッシュ、Coursier キャッシュ。
サーバーを 1 つのツリーに制限するには:
claude mcp add jar-inspector --env JAR_INSPECTOR_ALLOW="$HOME/work:$HOME/.m2" \
-- uvx --from git+https://github.com/pgatzka/jar-inspector-mcp jar-inspector-mcpClaude に使うよう促す
このサーバーには MCP の instructions が同梱されており、これらのツールが unzip、jar xf、javap の代わりになることをクライアントに伝えます。それでも Claude がシェルを使おうとする場合は、プロジェクトの CLAUDE.md に 1 行追加してください:
To inspect jars, use the jar-inspector MCP tools instead of unzip/jar/javap.仕組み
クラス解析は、クラスファイル形式に対する依存関係のないリーダーです: 定数プール、アクセスフラグ、
Signature、MethodParameters、LocalVariableTable、Exceptions、Record、InnerClasses、実行時アノテーション属性。メソッド本体はjar_disassembleが要求しない限りスキップされます。アーカイブは
zipfileを通じてメモリ上で読み取られます。ネストされた jar は外側のエントリのバイトから開かれるため、Spring Boot のファット jar を展開する必要はありません。ソースは、アーカイブ自体、次に Maven レイアウトの兄弟
-sources.jar、次に Gradle のキャッシュが使用する隣接するハッシュディレクトリから解決されます。出力は常に上限が設定され、切り詰められた場合とページング方法が必ず示されます。
開発
uv sync
uv run pytest # 49 testsテストは tests/java 内の Java を javac でコンパイルし、実際のバイトコードに対して検証するため、ジェネリクス、ブリッジメソッド、レコードが実際にテストされます。JDK がない場合はスキップされます。さらに、パーサーは Maven と Gradle に同梱されているすべての jar 内のすべてのクラスに対してチェックされています — 65,573 クラス、失敗なし。
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
An MCP server that gives your AI access to the source code and docs of all public github repos
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pgatzka/jar-inspector-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server