- Home
- MCP servers
- Java Decompiler
Java Decompiler
- python
8
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"ruoji6-java-decompile-mcp": {
"command": "uvx",
"args": [
"java-decompile-mcp"
],
"env": {
"CFR_PATH": "/你的路径/cfr-0.152.jar"
}
}
}
}You run this MCP server to decompile Java bytecode by leveraging CFR, enabling fast, multi-file processing with optional direct file saving and live progress. It supports single files, directories, and recursive traversal, making it practical for large projects or batch tasks while keeping output organized on disk.
How to use
You can operate the Java decompiler MCP server through an MCP client. Choose the pattern that fits your workload: decompile a single file, decompile many files in parallel, or decompile an entire directory tree. When you need speed, enable multi-threading and direct file output to avoid oversizing responses.
How to install
Prerequisites you need installed on your system:
Python 3.10 or newer and a Java Runtime Environment (JRE) are required.
You also need the MCP tooling environment to run MCP servers via a managed client.
Install or prepare the MCP runtime using the preferred method you choose below.
Configuration and usage details
CFR path configuration is required so the decompiler can be located and used. You can specify CFR by environment variable or by a local file path, and you can opt to automatically download CFR when needed.
For the recommended MCP setup, you configure a stdio MCP server that runs via the MCP client. The server uses a command to start the MCP entry point and passes the CFR jar path through an environment variable.
{
"mcpServers": {
"java_decompiler": {
"type": "stdio",
"name": "java_decompiler",
"command": "uvx",
"args": ["java-decompile-mcp"],
"env": {
"CFR_PATH": "/your/path/cfr-0.152.jar"
},
"disabled": false
}
}
}
Examples
# 使用 8 个线程并发处理,大幅提升速度
decompile_directory(
directory_path="/path/to/classes",
output_dir="/path/to/output",
save_to_file=True,
show_progress=True,
max_workers=8
)
# 反编译单个文件并查看内容
decompile_file(
file_path="/path/to/MyClass.class",
save_to_file=False
)
# 静默批量处理,仅返回统计,单线程
decompile_files(
file_paths=["/path/to/Class1.class", "/path/to/Class2.class", "/path/to/app.jar"],
show_progress=False,
max_workers=1
)
Troubleshooting and notes
If CFR is not found, ensure CFR_PATH is set to a valid CFR jar path or enable automatic CFR download when invoking the MCP tools.
Tools and commands you’ll use
The MCP server exposes a set of tools for decompilation tasks that you can invoke through the MCP client: decompile_file, decompile_files, decompile_directory, download_cfr_tool, check_cfr_status, and get_java_version.
Available tools
decompile_file
Decompile a single file and optionally save the result to disk. Returns a summary if saved.
decompile_files
Batch decompile multiple files with optional progress display and multi-threading.
decompile_directory
Decompile all .class and .jar files within a directory, with options for recursion and threading.
download_cfr_tool
Download the CFR decompiler tool to enable intra-process decompilation.
check_cfr_status
Check the status of the CFR tool to ensure it is available for use.
get_java_version
Return the Java version information currently available in the environment.