Java JAR Decompiler & Reverse Engineering MCP Server
This server provides a comprehensive, systematic 6-phase pipeline for Java JAR decompilation, reverse engineering, and de-obfuscation. Key capabilities:
Multi-Engine Decompilation: Decompile JARs using CFR, Vineflower, Fernflower, Procyon, JADX, etc., with customizable parameters and output analytics.
Decompiler Discovery: List all decompiler binaries available in the local decompiler directory.
Output Analysis: Inspect decompiled directories to count Java files, detect warning/error comments, and preview directory structure.
Candidate Evaluation & Mavenization: Quantitatively score decompiler outputs based on file count, compilation errors, leftover .class files, and warnings; select the best candidate, and scaffold it into a Maven project with a generated
pom.xml.Compilation: Run
mvn clean compileon the Maven project, capturing and formatting compilation errors for human review.ASM Bytecode Comparison: Compare the recompiled output against the original JAR using ASM to produce File/Bytecode Match %, Business Context Similarity %, and Code Readability Score.
AST-Based Obfuscation Detection: Parse Java sources with GumTree Spoon AST diff to identify obfuscated variable/method names (e.g., synthetic identifiers, single-letter names) and infer meaningful replacements from declared types.
Variable Renaming: Apply rename operations across all source files, adding changelog comments, without modifying business logic.
Full De-obfuscation Pipeline: Execute an end-to-end workflow that copies sources, compiles, detects obfuscations, renames, verifies compilation, and confirms zero remaining obfuscations.
Fallback for Missing Logic: Automatically swap files from an alternative decompiler candidate when bytecode similarity is below a threshold, retaining only swaps that compile and improve similarity.
Guided Workflows: Predefined prompts support common tasks like mavenization, fixing compilation errors, bytecode comparison, variable renaming, and full de-obfuscation.
Allows structuring decompiled Java sources into Maven projects and compiling them with Maven, including compilation error analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Java JAR Decompiler & Reverse Engineering MCP Server Decompile the target JAR and show me the best source code candidate."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Java JAR & WAR Decompiler & Reverse Engineering MCP Server (v1.1.1)
A production-ready Model Context Protocol (MCP) server written in Node.js for Java .jar and .war package decompilation, multi-engine candidate benchmark evaluation, Maven project structuring, non-breaking syntax repair, GumTree Spoon AST analysis & obfuscation renaming, ASM bytecode parity metrics evaluation, Generic Differential Logic Fallback, and Strict Dual-JDK Runtime Isolation.
š Table of Contents
Related MCP server: Java Inspector
Release Notes & Version 1.1.1 Changelog
š What's New in Version 1.1.1
Version 1.1.1 introduces comprehensive Web Application Archive (.war) decompilation and packaging support, strict dual-JDK runtime isolation, automatic internal dependency bundling via system scope, multi-engine comparative optimization scoring, human-in-the-loop JiBX reporting, and cross-platform ASM bytecode parity fixes:
Strict Dual-JDK Process Isolation (
JAVA_8_HOME&JAVA_17_HOMEvia.env):Decoupled decompilation and compilation execution environments configured via
.env/ system environment variables.Decompilation & Modern AST Tools: Strictly executed using Java 17+ (
JAVA_17_HOME, e.g. OpenJDK 17 or JDK 23), required by engines like Vineflower and modern AST parsers.Compilation & Parity Verification: Strictly executed using JDK 8 (
JAVA_8_HOME,javac 1.8,mvnunder Java 8,javap 1.8,jar 1.8) to guarantee exact target runtime compatibility.Automated tool resolution (
resolveJdk8Tool,resolveJdk17Tool,getJdk8Env,getJdk17Env) with defensive fallback and path normalization.Added
.env.exampleto provide turnkey setup instructions.
Full WAR Archive & Web Application Support:
Added complete unpacking, decompilation, and Maven project structuring for Java Web Applications (
.war).Automatically detects WAR structures, preserves
WEB-INF/web.xml, bundles embedded runtime libraries underWEB-INF/lib/*.jar, and configurespom.xmlwith<packaging>war</packaging>(maven-war-plugin).
Internal & Unresolvable Dependency Bundling (
lib/+<scope>system</scope>):Extracts internal, legacy, or proprietary dependencies (such as embedded WAR JARs) that are not available in public Maven repositories.
Stores extracted libraries in
${project.basedir}/lib/and declares them inpom.xmlusing<scope>system</scope>with<systemPath>${project.basedir}/lib/<jar-name>.jar</systemPath>.Enhanced
generatePomXml()insrc/config.jsto emit clean<systemPath>tags for system-scoped dependencies.
Multi-Engine Comparative Optimization Scoring:
Evaluates decompiled candidates file-by-file across multiple engines (e.g. CFR vs Vineflower) using a qualitative and quantitative optimization scoring model.
Scores candidates on code readability, meaningful variable names, business logic fidelity, absence of synthetic casts/warning banner noise, and structural preservation.
Formally integrated into
iterative_decompilation_fix_pipeline_prompt.
JiBX / Raw Bytecode Detection & Human-In-The-Loop (HITL) Reporting:
Updated
fix_compilation_errors_promptto detect unresolvable JiBX binding files, unparsed raw bytecodes, or lost business logic.Automatically halts execution and generates a comprehensive markdown report (
logs/compilation_issues_and_fixes_report.md) detailing the problems and proposed remediations, enforcing human-in-the-loop approval before applying modifications.
Robust Cross-Platform ASM Bytecode Parity Engine (
compare_bytecode_and_analyze):Switched
javapandjarCLI invocations toexecFileSyncwith argument arrays, eliminating Windows shell parsing failures caused by spaces in paths (C:\Program Files\...,C:\Users\...).Implemented dynamic class inspection for
.warfiles by extractingWEB-INF/classesforjavap.Added compiler-synthetic lambda normalization (
lambda$synthetic(...)), allowing accurate parity matching between OpenJDK javac (lambda$0) and Eclipse ECJ (lambda$init$0).Fixed boundary condition calculations where classes with 0 fields or 0 methods correctly report 100% parity.
š¦ Prior Releases
Generic Post-Compilation Differential Logic Fallback (
fallback_to_candidate_for_missing_logic): Evaluates post-compilation business logic similarity and differentially swaps candidate files.Automatic Type Extraction & Contextual Name Inference (
inferMeaningfulName): Captures declared Java Types and suggests domain-meaningful variable names.Dynamic AST Rename Pipeline (
run_ast_deobfuscation_pipeline): On-the-fly AST mappings for both root outputs and Mavensrc/main/java.Deduplication & Flexible Path Resolution: Deduplicates AST detections and resolves multi-nested source roots.
1. Pipeline Architecture & Reverse Engineering Workflow
For every target Java .jar package, the MCP server executes a systematic 6-phase pipeline:
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Phase 1: ā ā Phase 2: ā ā Phase 3: ā ā Phase 4: ā ā Phase 5: ā ā Phase 6: ā
ā Multi-Engine āāāā>ā Quantitative āāāā>ā Mavenization āāāā>ā Non-Breaking āāāā>ā AST De- āāāā>ā ASM Bytecode ā
ā Decompilation ā ā Evaluation ā ā & Structure ā ā Syntax Repair ā ā Obfuscation ā ā Comparison ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāPhase 1: Multi-Engine Decompilation (
decompile_jar)Decompile target JAR using multiple engine variants (CFR 0.152, Vineflower 1.12.0, Fernflower, Procyon, JADX) into isolated output directories.
Phase 2: Comparative Candidate Evaluation (
evaluate_and_mavenize_sources)Test-compile each candidate output using
javac -g -parameters -proc:none -encoding UTF-8.Calculate quantitative quality score based on Java source count, compiler error count, remaining
.classfiles, and inline warning comments.
Phase 3: Maven Project Structuring (
evaluate_and_mavenize_sources)Copy winning candidate sources to
src/main/javaand resources tosrc/main/resources.Generate production-ready
pom.xmlwith source/target compliance and compiler args (-g -parameters).
Phase 4: Non-Breaking Syntax Repair (
compile_maven_project&fix_compilation_errors_prompt)Fix compilation errors reported in logs without modifying business logic (type casting, generic inference, sneaky throw casts, synthetic package-info artifacts).
Phase 5: AST Obfuscation Detection & Refactoring (
run_ast_deobfuscation_pipeline)Parse Abstract Syntax Tree using GumTree Spoon AST Diff (
gumtree-spoon-ast-diff-1.124.jar).Detect obfuscated/synthetic variable and method identifiers (
var0,var1,arg0, closure captures, single-letter variables).Apply context-aware, domain-accurate renames across files without altering functional behavior.
Re-compile and re-scan AST to confirm 0 obfuscations remain.
Phase 6: ASM Bytecode Parity & Metrics Analysis (
compare_bytecode_and_analyze)Perform ASM bytecode comparison against original JAR.
Record metrics: File/Bytecode Match %, Business Context Similarity %, and Code Readability Score in log reports.
2. Candidate Evaluation & Scoring Model
The evaluate_and_mavenize_sources tool selects the optimal decompiled candidate engine using a quantitative multi-factor scoring formula:
$$\text{Score} = (\text{JavaFiles} \times 100) - (\text{JavacErrors} \times 200) - (\text{RemainingClassFiles} \times 50) - (\text{DecompilerWarnings} \times 10)$$
Detailed Evaluation Criteria Breakdown:
Compilation Pass Rate under Debug Flags (Weight: -200 per error):
Each candidate is test-compiled using:
javac -g -parameters -proc:none -encoding UTF-8Rationale: Penalizes engines that emit invalid syntax, generic type inference failures, or broken lambdas. Zero compilation errors provides a massive score advantage.
AST Source Coverage (Weight: +100 per
.javafile):Counts total
.javasource files successfully reconstructed.Rationale: Rewards decompilers that fully reconstruct class structures, inner classes, and interface hierarchies without dropping files.
Unhandled Bytecode / Remaining
.classFiles (Weight: -50 per.classfile):Counts
.classbinary files left behind in output directory.Rationale: Severe penalty for decompiler engines that fail on complex bytecode constructs (e.g., Kotlin synthetic bridges, inner classes) and leave un-decompiled
.classfiles.
Inline Decompiler Warning Comments (Weight: -10 per warning):
Scans top 150 lines of every
.javafile for issue markers:// FAILED to decompile method ...// Could not decompile ...// Exception decompiling .../* Synthetic */
Rationale: Penalizes engines that emit partial method stubs or swallow exceptions inline.
3. Directory Structure
server/
āāā bin/
ā āāā cli.js # Executable CLI entry point for NPX / global execution
āāā src/
ā āāā index.js # Main MCP server initialization & handler registration
ā āāā decompilerHandler.js # Core decompiler execution, Maven build, AST, & ASM engine
ā āāā tools/
ā ā āāā definitions.js # Structured MCP Tool declarations & JSON schemas (10 tools)
ā āāā prompts/
ā āāā definitions.js # Structured MCP Prompt declarations & templates (6 prompts)
āāā scripts/ # Utility helper scripts
āāā index.js # Forwarding entrypoint (imports src/index.js)
āāā package.json # Package manifest & configuration
āāā README.md # Server documentation4. Setup & Installation
Prerequisites
Node.js:
v18.0.0or higherJava 8 (JDK 8): Strictly used for Maven compilation (
mvn clean compile), fallbackjavac, and bytecode parity analysis.Java 17+ (JDK 17+): Used exclusively for modern decompilation engines (e.g. Vineflower requires Java 17+) and GumTree Spoon AST analysis.
Apache Maven:
mvnCLI installed and available in environment path
Environment Configuration (.env)
The MCP server uses a decoupled multi-JDK configuration via .env to enforce that decompilation runs under JDK 17+ while compilation strictly targets JDK 8:
cp .env.example .envConfigure your local JDK paths in .env:
# JDK 8 Home Path (Strictly used for compilation and parity verification)
JAVA_8_HOME=C:\Program Files\Eclipse Adoptium\jdk-8.0.504.1-hotspot
# JDK 17+ Home Path (Used ONLY for decompilation via Vineflower and AST analysis)
JAVA_17_HOME=C:\Program Files\Eclipse Adoptium\jdk-23.0.0.37-hotspotInstallation
cd reverse-engineering-mcp-server
npm install5. MCP Client Configurations
Claude Desktop Configuration
Add the server entry to your claude_desktop_config.json:
{
"mcpServers": {
"jar-decompiler": {
"command": "node",
"args": [
"C:/Users/ghosh/OneDrive/Desktop/Decompilation/server/index.js"
]
}
}
}Antigravity CLI / Gemini Config
Add the server entry to your .gemini/antigravity-cli/mcp_config.json:
{
"mcpServers": {
"jar-decompiler": {
"command": "node",
"args": [
"C:/Users/ghosh/OneDrive/Desktop/Decompilation/server/index.js"
]
}
}
}6. Complete MCP Tools Reference (10 Tools)
1. decompile_jar
Decompiles a Java .jar file into a target directory and returns comprehensive decompilation analytics, tree output, and logs.
Parameters:
jarPath(string, required): Path to.jarfile.outputDir(string, optional): Destination directory.decompilerPath(string, optional): Explicit path to decompiler.jar.decompilerType(string, optional):'auto','cfr','vineflower','fernflower','procyon','jadx', or'generic'.extraArgs(array of strings, optional): Additional command-line flags.
2. list_decompilers
Lists all Java decompiler files (.jar or executables) currently found in the decompiler/ folder.
Parameters:
decompilerDir(string, optional): Path to decompiler folder.
3. analyze_decompilation_output
Analyzes an existing directory containing decompiled source code to count Java files, detect decompilation warnings/errors, and produce a directory tree preview.
Parameters:
outputDir(string, required): Path to decompiled directory.
4. evaluate_and_mavenize_sources
Evaluates decompiled outputs (comparing AST structure, line count, compiler warning count), chooses the optimal candidate using the quantitative scoring model, and structures it into a clean Maven project with pom.xml.
Parameters:
outputsDir(string, required): Path to directory containing candidate folders (e.g.outputs/).targetMavenDir(string, required): Path to target directory (e.g.mavenized_merged_source/).groupId(string, optional): Maven groupId (default:org.apache.commons).artifactId(string, optional): Maven artifactId (default:commons-io).version(string, optional): Maven version (default:2.22.0).
5. compile_maven_project
Compiles a Maven project using mvn clean compile, parses compilation errors into a human-readable format, and writes the log file.
Parameters:
projectDir(string, required): Path to Maven project root.logPath(string, optional): Path for compilation error log file.
6. compare_bytecode_and_analyze
Performs ASM bytecode analysis comparing the original JAR against the recompiled mavenized source, outputting percentage match, business context similarity, and variable readability scores.
Parameters:
originalJarPath(string, optional): Path to original JAR.mavenDir(string, optional): Path to mavenized project root.logPath(string, optional): Path to output comparison report.asmJarPath(string, optional): Path to ASM library JAR.
7. generate_ast_and_detect_obfuscation
Uses GumTree Spoon AST Diff to parse Java source files, generate AST representations, and detect obfuscated or synthetic variable/method names (var0, arg1, single-letter variables, closure captures).
Parameters:
sourceDir(string, optional): Path to Java source directory.gumtreeJarPath(string, optional): Path to GumTree Spoon JAR.logPath(string, optional): Path to output obfuscation report.
8. rename_obfuscated_variables
Copies mavenized source to final output directory, applies obfuscated variable renames with meaningful names, adds changelog comments to modified files, and generates a comprehensive rename log. NEVER modifies business logic.
Parameters:
renames(array of objects, required): Array of{ file, oldName, newName, line }.sourceDir(string, optional): Source directory.targetDir(string, optional): Target output directory.logPath(string, optional): Output log file path.
9. run_ast_deobfuscation_pipeline
Runs the complete end-to-end AST de-obfuscation pipeline: copies mavenized_merged_source to mavenized_final_output, compiles, parses AST via GumTree Spoon to find obfuscated vars/methods, applies context-aware renames without changing business logic, verifies compilation, re-scans AST, and outputs logs to logs/ast_renamed_variables_methods.txt.
Parameters:
sourceDir(string, optional): Source directory.targetDir(string, optional): Target output directory.gumtreeJarPath(string, optional): GumTree Spoon JAR path.logPath(string, optional): Output report log file path.renames(array of objects, optional): Custom rename entries array.
10. fallback_to_candidate_for_missing_logic
Generic post-compilation differential fallback. If ASM business logic similarity is below targetSimilarityThreshold (e.g. 98%), scans alternative decompiler candidate outputs (e.g. CFR), performs differential file swapping, tests compilation, and retains swaps only if business logic parity improves.
Parameters:
targetMavenDir(string, optional): Path to target mavenized project (default:mavenized_final_output).candidateDir(string, optional): Path to fallback candidate output directory (default:outputs/avalon-logkit-2.1_cfr).originalJarPath(string, optional): Path to original target JAR file for ASM parity analysis.targetSimilarityThreshold(number, optional): Target Business Logic Similarity threshold percentage (default:98.0).logPath(string, optional): Output report log file path (default:logs/generic_logic_fallback_report.txt).
7. Complete MCP Prompts Reference (6 Prompts)
1. evaluate_and_mavenize_prompt
System prompt for comparing decompiled AST outputs, selecting the optimal candidate with minimal code loss, and mavenizing it.
Arguments:
outputsDir,targetMavenDir
2. fix_compilation_errors_prompt
Mandatory system prompt for fixing Java compilation errors without modifying business logic (syntax, generic, and type-cast fixes only). Now includes automated JiBX / raw bytecode detection: if missing JiBX bindings or raw unparsed bytecodes are detected, generates a structured markdown report (logs/compilation_issues_and_fixes_report.md) and halts for Human-in-the-Loop (HITL) approval.
Arguments:
logFile,projectDir,reportFile(optional)
3. compare_bytecode_prompt
System prompt for running ASM bytecode comparisons between the original JAR/WAR and recompiled mavenized project, calculating similarity metrics and debug readability scores.
Arguments:
originalJarPath,mavenDir,logPath
4. rename_obfuscated_variables_prompt
System prompt for AST-based detection and renaming of obfuscated/synthetic variable names in decompiled Java source, preserving all business logic.
Arguments:
sourceDir,targetDir,logPath
5. ast_deobfuscation_pipeline_prompt
Comprehensive system prompt for copying source to final output, compiling baseline, building GumTree Spoon AST, detecting obfuscated vars/methods, applying context-aware renames, verifying build success, and writing log files.
Arguments:
sourceDir,targetDir,logPath
6. iterative_decompilation_fix_pipeline_prompt
Complete production workflow prompt for executing end-to-end decompilation, candidate optimization scoring, internal library bundling into lib/ with <scope>system</scope>, strict JDK 8 compilation, and bytecode verification with user sign-off.
Arguments:
jarPath,mavenDir
8. Execution Verification
Run syntax checks across all server modules:
node --check index.js; node --check src/index.js; node --check src/decompilerHandler.js; node --check src/tools/definitions.js; node --check src/prompts/definitions.js; node --check bin/cli.jsExpected Output: Exit code 0 (clean pass).
Available Tools
9 toolsanalyze_decompilation_outputA
Analyzes an existing directory containing decompiled source code to count Java files, detect decompilation warnings/errors, and produce a directory tree.
Inputs: outputDir (required).
compare_bytecode_and_analyzeA
Performs ASM bytecode analysis comparing the original JAR against the recompiled mavenized source, outputting percentage match, business context similarity, and variable readability scores into a text log.
Inputs: logPath, mavenDir, asmJarPath, originalJarPath.
compile_maven_projectA
Compiles a Maven project using mvn clean compile, parses any compilation errors into a human-readable format, and writes the log file.
Inputs: projectDir (required), logPath.
decompile_jarA
Decompiles a Java .jar file into a target directory and returns comprehensive decompilation analytics, tree output, and logs.
Inputs: jarPath (required), extraArgs, outputDir, decompilerPath, +1 more.
evaluate_and_mavenize_sourcesA
Evaluates decompiled outputs (comparing AST structure, line count, compiler warning count), chooses the best candidate with minimal code loss, and structures it into a clean Maven project with pom.xml.
Inputs: outputsDir (required), targetMavenDir (required), groupId, version, +1 more.
generate_ast_and_detect_obfuscationB
Uses GumTree Spoon AST Diff to parse Java source files, generate AST representations, and detect obfuscated or synthetic variable names (e.g., var0, arg1, single-letter, closure captures).
Inputs: logPath, sourceDir, gumtreeJarPath.
list_decompilersB
Lists all Java decompiler files (.jar or executables) currently found in the decompiler folder.
Inputs: decompilerDir.
rename_obfuscated_variablesA
Copies mavenized source to final output directory, applies obfuscated variable renames with meaningful names, adds changelog comments to modified files, and generates a comprehensive rename log. NEVER modifies business logic.
Inputs: renames (required), logPath, sourceDir, targetDir.
run_ast_deobfuscation_pipelineA
Runs the complete end-to-end AST de-obfuscation pipeline: copies mavenized_merged_source to mavenized_final_output, compiles, parses AST via GumTree Spoon to find obfuscated vars/methods, applies context-aware renames without changing business logic, verifies compilation, re-scans AST, and outputs logs to logs/ast_renamed_variables_methods.txt.
Inputs: logPath, renames, sourceDir, targetDir, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 9 tools
Each tool targets a distinct stage of the decompilation workflow (decompile, list, analyze, AST, mavenize, compile, compare, rename, pipeline). Despite some conceptual overlap between standalone tools and the pipeline, the descriptions clearly differentiate their scope and usage.
All tool names follow a consistent snake_case verb_noun pattern (e.g., decompile_jar, list_decompilers, compile_maven_project). The naming style is uniform and predictable across the entire set.
9 tools is well-scoped for a decompilation and reverse engineering server, covering each necessary step without being excessive. The count falls comfortably within the ideal 3-15 range.
The tool surface covers the full reverse engineering lifecycle: decompile, analyze, generate AST, mavenize, compile, compare, and rename. No obvious gaps hinder the core workflow, and the pipeline tool provides an end-to-end path.
Maintenance
Related MCP Connectors
Evidence-oriented REA + Ghidra static-analysis workflows, read-only PE32 and Delphi VMT tools.
Ship better Java with your coding agent.
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
12 Binary/Forensics MCP tools: entropy triage, ELF/PE/WASM disasm, PCAP, EXIF, SQLite, ZIP.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables AI tools to analyze Java dependencies by scanning Maven projects, decompiling JAR files, and extracting detailed class information including methods, fields, and inheritance relationships. Solves the problem of AI hallucinations when generating code that calls external dependencies by providing accurate class structures through decompilation.321 npm42Apache 2.0
- AlicenseAqualityCmaintenanceDecompiles Maven dependencies into readable Java source directly inside your AI agent.1078 npm1Apache 2.0
- AlicenseAqualityDmaintenanceDecompiles Java .class files, packages, and JARs into readable source code, enabling AI assistants to inspect Java bytecode.371 npm21ISC
- AlicenseNot gradedqualityCmaintenanceEnables agents to reverse-engineer software across native binaries, managed code, Electron apps, websites, and live runtime behavior, returning findings linked to the evidence and limitations behind each conclusion. It also maintains a durable workspace where those behaviors can be inspected, questioned, compared against real execution, and exported as runnable handoffs.MIT