Click on "Install 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 Decompiler MCP Serverdecompile the /path/to/app.jar file into the /src/decompiled directory"
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 Decompiler MCP Server
一个基于 MCP (Model Context Protocol) 的 Java 反编译工具,使用 CFR 反编译器对 .class 和 .jar 文件进行反编译。
功能特性
✅ 单个文件反编译(.class / .jar)
✅ 多个文件批量反编译
✅ 目录递归扫描反编译
✅ 自定义输出目录
✅ 自动下载 CFR 反编译器
环境要求
Python >= 3.10
Java Runtime Environment (JRE)
uv (Python 包管理器)
安装
方式一:通过 uvx 直接使用(推荐)
无需安装,直接在 MCP 配置中使用(可让ai自动下载cfr-0.152.jar然后你手动配置路径):
方式二:本地开发
MCP 配置
方式一:使用 uvx(推荐,已发布到 PyPI)
在 .kiro/settings/mcp.json 或 claude_desktop_config.json 中添加:
方式二:本地开发模式
在 .kiro/settings/mcp.json 中添加:
⚠️ 本地开发模式需要将路径替换为实际的项目路径
项目地址
GitHub: https://github.com/RuoJi6/java-decompiler-mcp
可用工具
1. decompile_file
反编译单个文件
参数:
file_path(必需): 要反编译的文件路径output_dir(可选): 输出目录,默认为文件所在目录下的decompiled文件夹
示例:
2. decompile_files
批量反编译多个文件
参数:
file_paths(必需): 文件路径列表output_dir(可选): 输出目录
示例:
3. decompile_directory
反编译目录下所有 .class 和 .jar 文件
参数:
directory_path(必需): 目录路径output_dir(可选): 输出目录recursive(可选): 是否递归子目录,默认 true
示例:
4. download_cfr_tool
下载 CFR 反编译器
参数:
target_dir(可选): 下载目标目录,默认当前工作目录
5. check_cfr_status
检查 CFR 反编译器状态
6. get_java_version
获取 Java 版本信息
CFR 配置
CFR 反编译器查找顺序:
环境变量
CFR_PATH项目目录下的
cfr-*.jar自动下载(首次调用反编译工具时)
方式一:MCP 配置中指定(推荐)
在 mcp.json 的 env 中设置:
方式二:放到项目目录
将 cfr-*.jar 文件放到项目根目录,会自动识别。
方式三:自动下载
调用 download_cfr_tool 工具,会自动从镜像下载到项目目录。
手动运行测试
许可证
MIT License