RJ

ruoji6/java-decompile-mcp

Developer tools

This page was translated automatically. Technical details may differ from the original. View the original

75 stars 6 forks Quality 73 Trend 14MIT

A Java decompilation tool based on MCP (Model Context Protocol) that uses the CFR decompiler to decompile .class and .jar files.

Overview

A Java decompilation tool based on MCP (Model Context Protocol) that uses the CFR decompiler to decompile .class and .jar files. - ✅ Single file decompilation (.class / .jar) - ✅ Batch decompilation of multiple files - ✅ Recursive directory scanning decompilation - ✅ Custom output directory - ✅ Automatic download of CFR decompiler - ✅ Direct save to file system (avoid token restrictions) - ✅ Real-time progress display - Detailed ✅ statistics - ✅ When decompiling a large number of files, returning all results as strings may exceed the MCP's token limit (e.g., 413,072 characters). 1. (Recommended) - Add save_to_file parameter (default true) - Write decompiled results directly to the specified directory - Only return summary information (successes, failures, output paths, etc.) - Avoid transferring large amounts of content via MCP 2. - Added show_progress parameter (default true) - Displays current processing progress: [1/46] In processing: Controller.class - Real-time feedback on processing status 3. - Number of successful/failed/skipped files - Total number of .java files generated - Output directory path - Clear formatted output - Python >=3.10 - Java Runtime Environment (JRE) - uv (Python package manager) No installation required, just use it directly in the MCP configuration (allowing AI to automatically download cfr-0.152.jar then manually configure the path):

Overview (machine translated)

A Java decompilation tool based on MCP (Model Context Protocol) that uses the CFR decompiler to decompile .class and .jar files.

Functional Features

  • ✅ Decompiling individual files (.class / .jar)
  • ✅ Batch decompile multiple files
  • ✅ Recursive directory scanning and decompilation
  • ✅ Custom output directory
  • ✅ Automatically downloads the CFR decompiler
  • ✅ Directly saved to the file system (avoiding token restrictions)
  • ✅ Real-time progress display
  • ✅ Detailed statistics
  • ✅ Multithreaded concurrency processing (significantly increased speed)

Highlights of improvements

🚀 Solving Decompilation Issues of Large or Bulk Files

Question: When decompiling a large number of files, returning all results as strings may exceed the MCP token limit (e.g., 413,072 characters).

Solution:

  1. Save directly to file system (recommended)
  • Added save_to_file parameter (default true)
  • The decompilation result is written directly to the specified directory
  • Only returns summary information (successes, failures, output paths, etc.)
  • Avoid transferring large amounts of content through MCP
  1. Real-Time Progress Display
  • Added show_progress parameter (default true)
  • Display current processing progress: [1/46] 处理中: Controller.class
  • Real-time feedback on processing status
  1. Detailed Statistical Report
  • Number of successful/failed/skipped files
  • Total number of generated .java files
  • Output directory path
  • Clear formatted output

Usage examples

Scenario 1: Decompiling Large Numbers of Files (Recommended Method)

Scenario 2: Decompiling a Small Number of Files and Viewing Their Contents

Scenario 3: Silent Batch Processing

Environmental Requirements

  • Python >= 3.10
  • Java Runtime Environment (JRE)
  • uv (Python package manager)

Installation

No installation required, just use it directly in the MCP configuration (allowing AI to automatically download cfr-0.152.jar then manually configure the path):

Method Two: Local Development

MCP Configuration

Add to .kiro/settings/mcp.json or claude_desktop_config.json] the following:

Method Two: Local Development Model

Add to .kiro/settings/mcp.json:

⚠️ > Local development mode requires replacing the path with the actual project path

Project Address

GitHub: https://github.com/RuoJi6/java-decompile-mcp

Available tools

1. decompile_file

This page was translated automatically. Technical details may differ from the original.

Install

uvx java-decompile-mcp
New to MCP? Start with the mcpskill.org guide →

Configuration

{ "mcpServers": { "java-decompiler": { "type": "stdio", "command": "uvx", "args": ["java-decompile-mcp"], "env": { "CFR_PATH": "/你的路径/cfr-0.152.jar" }, "disabled": false } } }