by idachev
Decompiles Java .class files, package names, and JAR archives into readable source code through an MCP‑compatible server.
Decompiles Java bytecode—whether supplied as a standalone .class file, a fully qualified package name, or a class inside a JAR—into human‑readable Java source code. It exposes the functionality via the Model Context Protocol (MCP) so AI assistants and other MCP‑aware tools can request decompilation programmatically.
npx -y @idachev/mcp-javadc
{
"mcpServers": {
"javaDecompiler": {
"command": "npx",
"args": ["-y", "@idachev/mcp-javadc"],
"env": { "CLASSPATH": "/path/to/classes" }
}
}
}
decompile‑from‑path
, decompile‑from‑package
, decompile‑from‑jar
).Q: Do I need a Java JDK installed? A: No. The server uses a pure‑JavaScript implementation of CFR, so only Node.js (v16+) is required.
Q: How do I specify custom classpaths?
A: Pass a classpath
array in the decompile‑from‑package
request or set the CLASSPATH
environment variable when starting the server.
Q: What happens if the class file is corrupted? A: The server returns a clear error message describing the failure, allowing the client to handle it gracefully.
Q: Can I run multiple instances concurrently?
A: Yes. Each instance is independent; just launch additional processes with the same npx
command.
Q: How do I test the server interactively? A: Use the official MCP Inspector:
npx @modelcontextprotocol/inspector node ./index.js
A Model Context Protocol (MCP) server for decompiling Java class files. This server allows AI assistants and tools that implement the MCP protocol to decompile Java bytecode into readable source code.
You can run the server directly with npx without installing:
# Run the server
npx -y @idachev/mcp-javadc
# Install globally
npm install -g @idachev/mcp-javadc
# Run the server
mcpjavadc
# Clone the repository
git clone https://github.com/idachev/mcp-javadc.git
cd mcp-javadc
# Install dependencies
npm install
# Run the server
npm start
The easiest way to run the server:
npm start
To use with an MCP client (like Claude or another MCP-compatible AI assistant):
# Configure the MCP client to use this server
npx some-mcp-client --server "node /path/to/mcp-javadc/index.js"
To add this tool to Claude Code:
claude mcp add javadc -s project -- npx -y @idachev/mcp-javadc
Example MCP client configuration:
{
"mcpServers": {
"javaDecompiler": {
"command": "npx",
"args": ["-y", "@idachev/mcp-javadc"],
"env": {
"CLASSPATH": "/path/to/java/classes"
}
}
}
}
The server provides three main tools:
Decompiles a Java .class file from a file path.
Parameters:
classFilePath
: Absolute path to the Java .class fileExample request:
{
"jsonrpc": "2.0",
"id": "1",
"method": "mcp.tool.execute",
"params": {
"tool": "decompile-from-path",
"args": {
"classFilePath": "/path/to/Example.class"
}
}
}
Decompiles a Java class from a package name.
Parameters:
packageName
: Fully qualified Java package and class name (e.g., java.util.ArrayList)classpath
: (Optional) Array of classpath directories to searchExample request:
{
"jsonrpc": "2.0",
"id": "2",
"method": "mcp.tool.execute",
"params": {
"tool": "decompile-from-package",
"args": {
"packageName": "java.util.ArrayList",
"classpath": ["/path/to/rt.jar", "/path/to/classes"]
}
}
}
Decompiles a Java class from a JAR file.
Parameters:
jarFilePath
: Absolute path to the JAR file (required)className
: Fully qualified class name to extract from the JAR (required) (e.g., "com.example.MyClass")Example request:
{
"jsonrpc": "2.0",
"id": "3",
"method": "mcp.tool.execute",
"params": {
"tool": "decompile-from-jar",
"args": {
"jarFilePath": "/path/to/example.jar",
"className": "com.example.MyClass"
}
}
}
The CFR decompiler (@run-slicer/cfr) is a JavaScript port of the popular CFR Java decompiler. It works well with:
If you encounter issues with a specific class file, try:
decompile-from-package
tool with explicit classpathdecompile-from-jar
tool with explicit class nameWhen working with JAR files from Maven repositories:
find ~/.m2 -name "*dependency-name*jar"
command to locate JAR filesgrep -v source | grep -v javadoc
jar tf your-jar-file.jar | grep .class
to list available classes in a JARCLASSPATH
: Java classpath for finding class files (used when no classpath is specified)# Run in development mode
npm run dev
# Create test fixtures (creates sample Java class for testing)
npm run test:setup
# Run tests
npm test
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format
# Run with MCP Inspector for interactive testing
npx @modelcontextprotocol/inspector node ./index.js
You can use the official MCP Inspector tool to test the server functionality interactively:
# Install and run the MCP Inspector with the decompiler server
npx @modelcontextprotocol/inspector node ./index.js
The Inspector provides a user-friendly web interface that allows you to:
This is especially useful for debugging and understanding the MCP server's capabilities before integrating it with other applications.
ISC
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "java-decompiler": { "command": "npx", "args": [ "-y", "@idachev/mcp-javadc" ], "env": {} } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.