MCP Java Decompiler Server
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., "@MCP Java Decompiler Serverdecompile the java.util.ArrayList class"
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.
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
Related MCP server: Java Inspector
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:
# Run the server
npx -y @idachev/mcp-javadcOption 2: Global Installation
# Install globally
npm install -g @idachev/mcp-javadc
# Run the server
mcpjavadcOption 3: From Source
# Clone the repository
git clone https://github.com/idachev/mcp-javadc.git
cd mcp-javadc
# Install dependencies
npm install
# Run the server
npm startUsage
Quick Start
The easiest way to run the server:
npm startIntegrating with MCP Clients
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"Adding to Claude Code
To add this tool to Claude Code:
claude mcp add javadc -s project -- npx -y @idachev/mcp-javadcExample MCP client configuration:
{
"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:
{
"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:
{
"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:
{
"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:
Standard Java class files
Classes that are part of a known package structure
Modern Java features (all Java versions)
JAR files containing Java classes
If you encounter issues with a specific class file, try:
Using the
decompile-from-packagetool with explicit classpathUsing the
decompile-from-jartool with explicit class nameEnsuring 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 filesFilter out source and javadoc JARs using
grep -v source | grep -v javadocUse
jar tf your-jar-file.jar | grep .classto list available classes in a JARCheck 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
# 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.jsTesting with MCP Inspector
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.jsThe 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
The server uses the CFR decompiler (@run-slicer/cfr - a JavaScript port of the popular CFR Java decompiler)
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
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
Available Tools
3 toolsdecompile-from-jarA
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 javadocNotes:
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:
Read the POM file to identify dependency version
Search the M2 repository for the JAR
Use mcp_javadc to decompile relevant classes
If multiple versions exist, select the one matching the project's version requirement
| Name | Required | Description | Default |
|---|---|---|---|
| className | Yes | Fully qualified class name to decompile from the JAR (e.g., "com.example.MyClass") | |
| jarFilePath | Yes | The absolute path to the JAR file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden of behavioral disclosure. It only states the core function and provides usage workflow; it does not describe what the decompilation returns, whether it creates files, requires special permissions, or how errors are handled. For a tool with no annotation safety profile, this is a significant transparency gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with a clear one-sentence overview followed by a multi-section guide with headings, code blocks, and notes. While organized, it is lengthy for a simple function and includes details like 'grep -v source' that may be beyond the tool's core usage. The repeated mention of 'mcp_javadc' (a different name) and the Maven-specific workflow add unnecessary verbosity, though the structure is readable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has two parameters, no output schema, and no annotations. The description provides a complete workflow for the Maven repository use case, which is valuable, but it does not explain the output format (decompiled source code) or address non-Maven JAR usage. It also lacks differentiation from sibling tools beyond the source type. This is adequate for a clear use case but incomplete for general application.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%—both parameter descriptions already explain the values clearly. The description adds some contextual meaning by showing how to locate the jarFilePath via Maven commands and gives an example of className format, but these are supplemental rather than essential. Baseline 3 is appropriate because the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening line 'Decompiles a Java class from a JAR file' clearly states the verb (decompiles), resource (Java class), and source (JAR file). This immediately distinguishes it from sibling tools decompile-from-path and decompile-from-package by specifying the input type. The additional detail about fully qualified class names further clarifies the exact purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes a detailed 'Using mcp_javadc with Maven Repository' section that explains when to use this tool: when decompiling classes from dependency JARs in the M2 repository. It provides step-by-step instructions including finding the JAR and using the function. However, it does not explicitly mention alternatives or when not to use this tool, so it misses the exclusion part, though the context is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
decompile-from-packageB
Decompiles a Java class from a package name
| Name | Required | Description | Default |
|---|---|---|---|
| classpath | No | Array of classpath directories to search | |
| packageName | Yes | Fully qualified Java package and class name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description must disclose behavioral traits, but it only states the basic action without detailing return values, side effects, classpath resolution behavior, error conditions, or whether the operation is read-only. This is minimal disclosure beyond the one-sentence purpose.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, tightly crafted sentence that conveys the essential purpose without any filler or repetition. It is front-loaded with the action and object, making it highly scannable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of annotations and output schema, the description is insufficiently complete. It does not explain what the decompilation returns, how the classpath is used, or how this tool differs behaviorally from siblings, leaving significant gaps for an agent deciding whether and how to use it.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptive text for both packageName and classpath, so the schema already fully explains the parameters. The description adds no extra meaning about parameter semantics, making the baseline score appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Decompiles') and the resource ('a Java class from a package name'), immediately distinguishing it from sibling tools that decompile from paths or JARs. The specific phrase 'from a package name' conveys the exact scope of the tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when the input is a fully-qualified Java package/class name, but it does not explicitly mention when to choose this tool over decompile-from-path or decompile-from-jar, nor does it provide exclusions or alternative recommendations. The schema clarifies parameter format but not selection criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
decompile-from-pathA
Decompiles a Java .class file from a given file path
| Name | Required | Description | Default |
|---|---|---|---|
| classFilePath | Yes | The absolute path to the .class file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It only states the action 'decompiles' without mentioning whether output is returned, if side effects exist, or any error behaviors. This is a significant gap for a tool with no structured behavioral metadata.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that conveys the necessary information without unnecessary words. It is concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With only one parameter and no output schema, the description should at least clarify what the agent receives after decompilation (e.g., decompiled source code). The current description omits this, leaving the tool somewhat incomplete despite its simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, with classFilePath described as 'The absolute path to the .class file'. The description does not add any parameter details beyond the schema, so it meets the baseline but does not exceed it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'decompiles' and the resource 'Java .class file', with the qualifier 'from a given file path' that distinguishes it from sibling tools decompile-from-package and decompile-from-jar. This meets the bar for specific verb+resource+scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use or alternatives are mentioned, but the description implies usage for individual .class files at a specific path. The sibling tool names provide context, yet the description itself lacks explicit guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool targets a distinct input source: file path, package name, and JAR file. The purposes are clearly separated with no overlap, so an agent can accurately select the correct tool.
All tool names follow the exact same pattern: 'decompile-from-' followed by the source type. This consistent verb_noun structure makes the API predictable and easy to learn.
With only 3 tools, the server is tightly scoped to the core decompilation task. Each tool earns its place by covering a different input method, and the count is well within the ideal range.
The server covers the primary decompilation sources (file, package, JAR), which handles most use cases. However, there is no batch operation or way to list classes within a package/JAR, requiring manual workarounds or repeated calls for larger tasks.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Ship better Java with your coding agent.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI tools to analyze Java dependencies by scanning Maven projects, decompiling JAR files, and extracting detailed class information including methods, fields, and inheritance relationships. Solves the problem of AI hallucinations when generating code that calls external dependencies by providing accurate class structures through decompilation.32742Apache 2.0
- AlicenseAqualityAmaintenanceDecompiles Maven dependencies into readable Java source directly inside your AI agent.102631Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to look up Java class definitions and list dependencies from Maven projects by analyzing local JAR files via the Model Context Protocol.204MIT
- AlicenseAqualityDmaintenanceEnables exploration and decompilation of Minecraft source code, allowing users to list versions, search classes, and decompile .class files on-the-fly.32MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/idachev/mcp-javadc'
If you have feedback or need assistance with the MCP directory API, please join our Discord server