Menu

A javap alternative for AI agents: an MCP server that reads Java bytecode
📰

A javap alternative for AI agents: an MCP server that reads Java bytecode

DEV Community: kotlin·Mohammad Mostafa Dastjerdi·14 days ago
#SxiG26G0
#devtokotlin#devto#dev#tojson#gson
Long article (613 words) — no AI summary yet.
Reading 0:00
15s threshold

When an AI coding agent needs to know what a dependency jar actually contains, it usually reaches for the tools a human would: unzip -l , javap , grep , sed . That works, but it is expensive. javap -c dumps the whole class, the agent pages through it with head , and a lot of tokens go to output it never needed.

jdx is an open-source (Apache-2.0) command line tool and MCP server that answers IDE-style questions about any JVM jar, -sources.jar , class directory, Maven coordinate or the JDK itself, and returns only the part you asked for.

The cost of the javap route

The jdx README has a reproducible benchmark ( sh docs/bench-compare.sh ) for one task: list Gson's API, then show only toJson(Object) on gson-2.14.0.

Route Calls Output

unzip + javap + grep + sed 5 ~17.5 KB (~4.4k tokens), and head -200 misses the method (it is at line 542 of 1265)

jdx members + jdx body 2 ~4.6 KB (~1.2k tokens)

The method body alone is 267 bytes from jdx, versus 60,590 bytes for javap -c on the class (226x) or 58,251 bytes…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.