by idachev
mcp-javadc is a Model Context Protocol (MCP) server that decompiles Java class files into human-readable source code. It enables AI assistants and other tools to understand and work with Java bytecode without requiring a Java installation.
mcp-javadc is a Model Context Protocol (MCP) server designed for decompiling Java class files. It allows AI assistants and other tools that implement the MCP protocol to convert Java bytecode back into human-readable source code. This project leverages a JavaScript port of the CFR decompiler, eliminating the need for a Java installation.
mcp-javadc can be used in several ways:
npx -y @idachev/mcp-javadcnpm install -g @idachev/mcp-javadc, then run mcpjavadc.npm install), and run npm start.Once the server is running, it can be integrated with MCP clients (like Claude) by configuring the client to use the server's command. The server exposes three main tools via its MCP-compatible API:
decompile-from-path: Decompiles a .class file from a given file path.decompile-from-package: Decompiles a Java class from a package name, with optional classpath specification.decompile-from-jar: Decompiles a Java class from a JAR file, requiring the JAR path and the class name to extract..class files from file paths, package names, or JAR archives.Q: What are the prerequisites for running mcp-javadc? A: Node.js 16+ and npm are required. No Java installation is needed.
Q: What if I encounter issues with decompiling a specific class file?
A: Ensure the class file is valid Java bytecode. You can try using decompile-from-package with an explicit classpath or decompile-from-jar with an explicit class name. Also, verify that the class names match the package structure within JARs.
Q: How can I test mcp-javadc interactively?
A: You can use the official MCP Inspector tool by running npx @modelcontextprotocol/inspector node ./index.js. This provides a web interface to test the server's functionality.
Q: Does mcp-javadc support all Java versions? A: The underlying CFR decompiler (JavaScript port) is designed to work with modern Java features across all Java versions.
Q: How does mcp-javadc handle JAR files? A: When decompiling from JARs, the server creates a temporary directory, extracts the JAR contents, decompiles the specified class, and then cleans up the temporary directory.
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 javadocjar 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.
Discover more MCP servers with similar functionality and use cases
by zed-industries
Provides real-time collaborative editing powered by Rust, enabling developers to edit code instantly across machines with a responsive, GPU-accelerated UI.
by cline
Provides autonomous coding assistance directly in the IDE, enabling file creation, editing, terminal command execution, browser interactions, and tool extension with user approval at each step.
by continuedev
Provides continuous AI assistance across IDEs, terminals, and CI pipelines, offering agents, chat, inline editing, and autocomplete to accelerate software development.
by github
Enables AI agents, assistants, and chatbots to interact with GitHub via natural‑language commands, providing read‑write access to repositories, issues, pull requests, workflows, security data and team activity.
by block
Automates engineering tasks by installing, executing, editing, and testing code using any large language model, providing end‑to‑end project building, debugging, workflow orchestration, and external API interaction.
by RooCodeInc
An autonomous coding agent that lives inside VS Code, capable of generating, refactoring, debugging code, managing files, running terminal commands, controlling a browser, and adapting its behavior through custom modes and instructions.
by lastmile-ai
A lightweight, composable framework for building AI agents using Model Context Protocol and simple workflow patterns.
by firebase
Provides a command‑line interface to manage, test, and deploy Firebase projects, covering hosting, databases, authentication, cloud functions, extensions, and CI/CD workflows.
by gptme
Empowers large language models to act as personal AI assistants directly inside the terminal, providing capabilities such as code execution, file manipulation, web browsing, vision, and interactive tool usage.