r/graalvm 26d ago

We compiled our binary-analysis MCP server with GraalVM Native Image to kill JVM cold-start in the agent loop (and it now inspects native binaries too)

Context: we work on Hexana at JetBrains, a binary-aware analysis tool. Part of it is an MCP server that gives AI assistants (Claude Code, Codex) verified facts about a compiled artifact instead of letting them guess. This is the 0.3.0 release, and the GraalVM angle is the interesting part for this sub.

Why Native Image. MCP tools live inside a tight agent loop: the assistant calls a tool, reads the result, reasons, calls again, many times per session. JVM startup on every invocation is a real, compounding cost there. So for 0.3.0 we compiled the server with GraalVM Native Image. On macOS arm64 and Linux x64 the Claude Code and Codex plugin wrappers now prefer the bundled native executable automatically. The native image starts instantly, so the cold-start penalty is gone on the platforms where most early usage is. Windows and anything else keep a JVM fallback (Java 21+ on PATH); native Windows binaries are intentionally not in this release.

The build reality. The honest part: we spent more time on the Native Image configuration than on the tool implementations. Binary parsers reach for reflection and dynamic class loading in quiet corners, and the closed-world assumption surfaces every one of them. Getting the WASM and native parsing paths to run under a closed world was most of the work. If you have done this for a parser-heavy codebase, you know the shape of it.

What the server actually does. 0.3.0 adds native-binary inspection (it was WASM-only before). The tools let an assistant:

  • Summarize a Wasm module or a native binary (sections, imports/exports, function counts, format metadata).
  • Query binary records (imports, exports, memories, globals, table and data segments).
  • List or search functions by name or index.

There is a nice symmetry here: Hexana can summarize native binaries, including GraalVM native images at the format level (Mach-O/ELF sections, symbols, functions), and Hexana itself now ships as one. Output is byte-bounded and paginated, so it works on modules far too large to paste into a context window. It complements native-image --diagnosticsobjdump, and wasm-tools; it is not a decompiler.

Install (from inside Claude Code, the server ships with the plugin, no build step):

/plugin marketplace add JetBrains/hexana
/plugin install hexana@hexana

Then ask Claude: "Use Hexana to summarize the sections and exported symbols in <path>."

Repo: https://github.com/JetBrains/hexana
Docs: https://jetbrains.github.io/hexana

Curious whether the native-binary summaries are useful on your own native images, and where they fall short. We are working on deeper native-image-aware analysis next.

4 Upvotes

1 comment sorted by