MCP server that lets LLMs browse and decompile Java JARs with optional source attachment.
npm install jar-viewer-mcpMCP server that lets an LLM browse JAR contents, attach *-sources.jar source, and decompile .class files with CFR. It also runs Maven/Gradle dependency resolution to surface absolute paths for local artifacts.
javap) on PATH (for CFR and describe_class)scan_project_dependencies for Maven projects./gradlew) or Gradle on PATH when using scan_project_dependencies for Gradle projectsbash
npm install
npm run build
node dist/index.js # or add to your MCP registry
`Tools
- list_jar_entries(jarPath, innerPath?): Lists up to 100 items from the JAR, folding by directory level for quick navigation.
- read_jar_entry(jarPath, entryPath): Reads the requested entry. For .class, it first looks for a sibling *-sources.jar and otherwise decompiles with CFR; falls back to javap signatures if needed.
- describe_class(jarPath, className?, entryPath?, memberVisibility?, methodQuery?, limit?): Returns method signatures for a class using javap (no decompilation). Use memberVisibility="public" (default) or "all" for all members.
- resolve_class(projectPath, className, dependencyQuery?, includeMembers?, memberVisibility?, methodQuery?, limit?): Locates the class inside project dependency jars. If includeMembers=true, also returns method signatures (same filters as describe_class).
- scan_project_dependencies(projectPath, excludeTransitive?, configurations?, includeLogTail?, query?): Detects Maven/Gradle projects (by pom.xml or build.gradle(.kts)/settings.gradle(.kts)), then resolves absolute artifact paths. Uses mvn dependency:list for Maven, and an injected Gradle init script (mcpListDeps) for Gradle. Results are cached per project root. query does a case-insensitive substring match on groupId:artifactId and the artifact path.
- excludeTransitive: set to true to return only first-level dependencies.
- configurations: Gradle-only list of configuration names to include (e.g. ["runtimeClasspath"]).
- includeLogTail: set to true to include the last lines of build output for debugging.lib/cfr-0.152.jar is bundled and copied into dist/lib during npm run build; paths are resolved at runtime via import.meta.url` to avoid hard-coding.