by handsomestwei
Analyze and decompile Java class files online with our Java decompiler software, featuring JD decompiler and JD GUI inte
Decompiles and analyzes Java class files from Maven projects and JAR dependencies using the CFR decompiler. Helps AI tools understand third-party library code when source code isn't available.
Java Class Analyzer is a community-built MCP server published by handsomestwei that provides AI assistants with tools and capabilities via the Model Context Protocol. Analyze and decompile Java class files online with our Java decompiler software, featuring JD decompiler and JD GUI inte It is categorized under developer tools.
You can install Java Class Analyzer in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
Apache-2.0
Java Class Analyzer is released under the Apache-2.0 license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Automate multi-step workflows combining AI and external tools
Example
Research → Summarize → Create document → Send notification
Complete complex tasks end-to-end without manual steps
Share your MCP server with the developer community
According to our notes, Java Class Analyzer benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
Java Class Analyzer is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
Java Class Analyzer has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
We wired Java Class Analyzer into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
We evaluated Java Class Analyzer against two servers with overlapping tools; this profile had the clearer scope statement.
Useful MCP listing: Java Class Analyzer is the kind of server we cite when onboarding engineers to host + tool permissions.
Strong directory entry: Java Class Analyzer surfaces stars and publisher context so we could sanity-check maintenance before adopting.
We evaluated Java Class Analyzer against two servers with overlapping tools; this profile had the clearer scope statement.
We wired Java Class Analyzer into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
We wired Java Class Analyzer into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
showing 1-10 of 34
一个基于Model Context Protocol (MCP)的Java类分析服务,可以扫描Maven项目依赖、反编译Java类文件、获取class方法列表等详细信息,并提供给LLM进行代码分析。
Cursor等AI工具直接生成调用二方(内部调用)、三方包(外部调用)接口的代码,但因AI无法读取未在当前工程中打开的依赖源码,导致生成的代码错误频出,甚至出现幻觉式编码。
为解决此问题,一般会直接拷贝源码内容喂给LLM;或者先将源码文件放到当前工程内,再在对话中引用。
而使用本地反编译MCP方案最有效,能精准解析jar包中的类与方法,显著提升代码生成的准确性和可用性。


npm install -g java-class-analyzer-mcp-server
安装后可以直接使用 java-class-analyzer-mcp 命令。
npm install java-class-analyzer-mcp-server
git clone https://github.com/handsomestWei/java-class-analyzer-mcp-server.git
cd java-class-analyzer-mcp-server
npm install
npm run build
运行以下命令生成配置模板:
java-class-analyzer-mcp config -o mcp-client-config.json
然后将生成的配置内容添加到你的MCP客户端配置文件中。
参考以下配置示例,添加到MCP客户端配置文件中:
全局安装后的配置:
{
"mcpServers": {
"java-class-analyzer": {
"command": "java-class-analyzer-mcp",
"args": ["start"],
"env": {
"NODE_ENV": "production",
"MAVEN_REPO": "D:/maven/repository",
"JAVA_HOME": "C:/Program Files/Java/jdk-11"
}
}
}
}
本地安装后的配置:
{
"mcpServers": {
"java-class-analyzer": {
"command": "node",
"args": [
"node_modules/java-class-analyzer-mcp-server/dist/index.js"
],
"env": {
"NODE_ENV": "production",
"MAVEN_REPO": "D:/maven/repository",
"JAVA_HOME": "C:/Program Files/Java/jdk-11"
}
}
}
}
command: 运行MCP服务器的命令,这里使用 nodeargs: 传递给Node.js的参数,指向npm run build编译后的dist文件夹内文件env: 环境变量设置NODE_ENV: 运行环境标识
production: 生产环境,减少日志输出,启用性能优化development: 开发环境,输出详细调试信息test: 测试环境MAVEN_REPO: Maven本地仓库路径(可选)
~/.m2/repository 路径JAVA_HOME: Java安装路径(可选)
${JAVA_HOME}/bin/java 执行Java命令(用于CFR反编译)java 命令CFR_PATH: CFR反编译工具的路径(可选,程序会自动查找)扫描Maven项目的所有依赖,建立类名到JAR包的映射索引。
参数:
projectPath (string): Maven项目根目录路径forceRefresh (boolean, 可选): 是否强制刷新索引,默认false示例:
{
"name": "scan_dependencies",
"arguments": {
"projectPath": "/path/to/your/maven/project",
"forceRefresh": false
}
}
反编译指定的Java类文件,返回Java源码。
参数:
className (string): 要反编译的Java类全名,如:com.example.QueryBizOrderDOprojectPath (string): Maven项目根目录路径useCache (boolean, 可选): 是否使用缓存,默认true。避免每次都重复生成。cfrPath (string, 可选): CFR反编译工具的jar包路径。已内置有,可以额外指定版本。示例:
{
"name": "decompile_class",
"arguments": {
"className": "com.example.QueryBizOrderDO",
"projectPath": "/path/to/your/maven/project",
"useCache": true,
"cfrPath": "/path/to/cfr-0.152.jar"
}
}
分析Java类的结构、方法、字段等信息。
参数:
className (string): 要分析的Java类全名projectPath (string): Maven项目根目录路径示例:
{
"name": "analyze_class",
"arguments": {
"className": "com.example.QueryBizOrderDO",
"projectPath": "/path/to/your/maven/project",
}
}
在当前工程,会生成以下缓存目录和文件。
.mcp-class-index.json: 类索引缓存文件.mcp-decompile-cache/: 反编译结果缓存目录(按包名结构).mcp-class-temp/: 临时文件目录(按包名结构)analyze_class或decompile_class时,自动检查并创建索引analyze_class或decompile_class获取类的详细信息mvn dependency:tree获取依赖树.mcp-class-index.json文件.mcp-class-temp目录(按包名结构).mcp-decompile-cache目录(按包名结构)Maven命令失败
CFR反编译失败
cfrPath参数指定CFR路径类未找到
npm install
npm run build
项目提供了独立的测试工具,可以直接测试MCP服务的各个功能,无需通过MCP客户端。
# 测试所有工具
node test-tools.js
# 测试特定工具
node test-tools.js --tool decompile_class --class com.alibaba.excel.EasyExcelFactory --project /path/to/project
# 不使用缓存
node test-tools.js --tool decompile_class --no-cache
# 指定CFR路径
node test-tools.js --tool decompile_class --cfr-path /path/to/cfr.jar
-t, --tool <工具名>: 指定要测试的工具 (scan|decompile|analyze|all)-p, --project <路径>: 项目路径-c, --class <类名>: 要分析的类名--no-refresh: 不强制刷新依赖索引--no-cache: 不使用反编译缓存--cfr-path <路径>: 指定CFR反编译工具的jar包路径-h, --help: 显示帮助信息通过 NODE_ENV 环境变量控制日志输出:
development: 输出详细调试信息production: 只输出关键信息Prerequisites
Time Estimate
15-60 minutes depending on server complexity
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
Compatibility
✓ Use when
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
✗ Avoid when
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.