MCP Java Decompiler Server logo

MCP Java Decompiler Server

Community
idachev

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.

Publisheridachev
Repositorymcp-javadc
LanguageJavaScript
Forks
4
Stars
20
Available tools
3
Transport typestdio
Categories
LicenseISC
Links
  • Connect tools to AI workflows

    MCP Java Decompiler Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 3 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    20 stars and 4 forks from the linked repository.

MCP Java Decompiler Server (v1.2.4)

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.

Features

  • Decompile Java .class files from file path
  • Decompile Java classes from package name (e.g., java.util.ArrayList)
  • Decompile Java classes from JAR files
  • Specify which class to extract from JAR files
  • Full MCP-compatible API
  • Stdio transport for seamless integration
  • Clean error handling
  • Temporary file management

Prerequisites

  • Node.js 16+
  • npm
  • No Java requirement (using JavaScript port of CFR decompiler)

Installation

Option 1: Using npx (Recommended)

You can run the server directly with npx without installing:

bash
# Run the server
npx -y @idachev/mcp-javadc

Option 2: Global Installation

bash
# Install globally
npm install -g @idachev/mcp-javadc

# Run the server
mcpjavadc

Option 3: From Source

bash
# Clone the repository
git clone https://github.com/idachev/mcp-javadc.git
cd mcp-javadc

# Install dependencies
npm install

# Run the server
npm start

Usage

Quick Start

The easiest way to run the server:

bash
npm start

Integrating with MCP Clients

To use with an MCP client (like Claude or another MCP-compatible AI assistant):

bash
# Configure the MCP client to use this server
npx some-mcp-client --server "node /path/to/mcp-javadc/index.js"

Adding to Claude Code

To add this tool to Claude Code:

bash
claude mcp add javadc -s project -- npx -y @idachev/mcp-javadc

Example MCP client configuration:

json
{
  "mcpServers": {
    "javaDecompiler": {
      "command": "npx",
      "args": ["-y", "@idachev/mcp-javadc"],
      "env": {
        "CLASSPATH": "/path/to/java/classes"
      }
    }
  }
}

MCP Tools

The server provides three main tools:

1. decompile-from-path

Decompiles a Java .class file from a file path.

Parameters:

  • classFilePath: Absolute path to the Java .class file

Example request:

json
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "mcp.tool.execute",
  "params": {
    "tool": "decompile-from-path",
    "args": {
      "classFilePath": "/path/to/Example.class"
    }
  }
}

2. decompile-from-package

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 search

Example request:

json
{
  "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"]
    }
  }
}

3. decompile-from-jar

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:

json
{
  "jsonrpc": "2.0",
  "id": "3",
  "method": "mcp.tool.execute",
  "params": {
    "tool": "decompile-from-jar",
    "args": {
      "jarFilePath": "/path/to/example.jar",
      "className": "com.example.MyClass"
    }
  }
}

Known Issues

Java Class Decompilation

The CFR decompiler (@run-slicer/cfr) is a JavaScript port of the popular CFR Java decompiler. It works well with:

  1. Standard Java class files
  2. Classes that are part of a known package structure
  3. Modern Java features (all Java versions)
  4. JAR files containing Java classes

If you encounter issues with a specific class file, try:

  • Using the decompile-from-package tool with explicit classpath
  • Using the decompile-from-jar tool with explicit class name
  • Ensuring the class file is a valid Java bytecode file
  • Checking for corrupt class files or JAR archives

Maven Repository Usage

When working with JAR files from Maven repositories:

  • Use the find ~/.m2 -name "*dependency-name*jar" command to locate JAR files
  • Filter out source and javadoc JARs using grep -v source | grep -v javadoc
  • Use jar tf your-jar-file.jar | grep .class to list available classes in a JAR
  • Check that class names match the package structure in the JAR

Configuration

Environment Variables

  • CLASSPATH: Java classpath for finding class files (used when no classpath is specified)

Development

bash
# 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

Testing with MCP Inspector

You can use the official MCP Inspector tool to test the server functionality interactively:

bash
# 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:

  • List all available tools
  • Execute the decompilation tools with custom parameters
  • View and explore the decompiled output
  • Test different inputs and error scenarios

This is especially useful for debugging and understanding the MCP server's capabilities before integrating it with other applications.

How It Works

  1. The server uses the CFR decompiler (@run-slicer/cfr - a JavaScript port of the popular CFR Java decompiler)
  2. When a decompile request is received, the server:
    • Reads the class file data directly or extracts it from a JAR file
    • Processes the class file with CFR decompiler
    • Returns the formatted source code
  3. For JAR files, the server:
    • Creates a temporary directory for extraction
    • Extracts the JAR contents
    • Decompiles the specified class (or first class if none specified)
    • Cleans up the temporary directory

License

ISC

Installation

TypingMind
{
  "mcpServers": {
    "mcp-javadc": {
      "command": "npx",
      "args": [
        "-y",
        "@idachev/mcp-javadc"
      ]
    }
  }
}

Available Tools

  • decompile-from-path

    Decompiles a Java .class file from a given file path

  • decompile-from-package

    Decompiles a Java class from a package name

  • decompile-from-jar

    Decompiles a Java class from a JAR file

    Using mcp_javadc with Maven Repository

    When you need to decompile Java classes from dependencies in the M2 repository, follow these steps:

    Step 1: Find the JAR file location

    First, search for the dependency JAR in the local Maven repository:

    find ~/.m2 -name "*dependency-name*jar" | grep -v source | grep -v javadoc
    

    Notes:

    • Replace dependency-name with the artifact name
    • Filter out source and javadoc JARs using grep
    • Look for the correct version based on the project's POM file

    Step 2: Use the correct mcp_javadc function

    Once you have the JAR path, use this function:

    For specific class decompilation:

    • jarFilePath: The absolute path to the JAR (from Step 1)
    • className: Fully qualified class name to decompile

    For contextual exploration: If needed, first try to find all available classes in the JAR: jar tf /path/to/the.jar | grep .class | sort

    Example workflow:

    1. Read the POM file to identify dependency version 2

Use MCP Java Decompiler Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Java Decompiler Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Java Decompiler Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Java Decompiler Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-javadc": {
      "command": "npx",
      "args": [
        "-y",
        "@idachev/mcp-javadc"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Java Decompiler Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Java Decompiler Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Java Decompiler Server to help me with this task?
MCP Java Decompiler Server
Sure. I read it.
Here is what I found using MCP Java Decompiler Server.

Frequently asked questions

What is the MCP Java Decompiler Server MCP server used for?

MCP Java Decompiler Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Java Decompiler Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Java Decompiler Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Java Decompiler Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Java Decompiler Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Java Decompiler Server MCP to TypingMind?

MCP Java Decompiler Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP Java Decompiler Server MCP provide in TypingMind?

MCP Java Decompiler Server exposes 3 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Java Decompiler Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Java Decompiler Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇