Gradle Class Finder MCP
Find and decompile classes within Gradle dependencies.
Gradle Class Finder MCP
一个基于 Model Context Protocol (MCP) 的 Gradle 项目类查找服务,帮助在 Gradle 项目依赖中查找指定的类并获取其源代码。
功能特性
- 在 Gradle 项目依赖中查找指定的类
- 获取类的源代码或反编译代码
- 支持 JDK 类查找
- 智能类名解析(支持简单类名)
- Kotlin 类智能识别和反编译
运行方式
方式一:Java 原生运行
前置要求
- JDK 17 或更高版本
- Gradle 8.5 或更高版本(可选,项目包含 Gradle Wrapper)
构建项目
# 使用 Gradle Wrapper(推荐)
./gradlew shadowJar
# 或者使用系统安装的 Gradle
gradle shadowJar
构建完成后,会在 build/libs/ 目录下生成 gradle-class-finder-mcp.jar 文件。
运行服务
# 直接运行 JAR 文件
java -jar build/libs/gradle-class-finder-mcp.jar
# 或者使用 Gradle 运行
./gradlew run
方式二:Docker 运行
前置要求
- Docker 20.10 或更高版本
构建 Docker 镜像
docker build -t gradle-class-finder-mcp .
运行容器
# 基本运行
docker run gradle-class-finder-mcp
# 使用自定义内存设置
docker run -e JAVA_OPTS="-Xmx1g -Xms512m" gradle-class-finder-mcp
# 挂载本地项目目录(用于分析本地项目)
docker run -v /path/to/your/project:/workspace gradle-class-finder-mcp
配置 Claude Desktop
在 Claude Desktop 的配置文件中添加以下配置:
Java 原生运行配置
{
"mcpServers": {
"gradle-class-finder": {
"command": "java",
"args": ["-jar", "/path/to/gradle-class-finder-mcp.jar"]
}
}
}
Docker 运行配置
{
"mcpServers": {
"gradle-class-finder": {
"command": "docker",
"args": ["run", "-i", "gradle-class-finder-mcp"]
}
}
}
使用示例
查找类
使用工具 find_class 查找类:
- workspace_dir: /path/to/gradle/project
- class_name: com.example.MyClass
获取源代码
使用工具 get_source_code 获取源代码:
- jar_path: /path/to/library.jar
- class_name: com.example.MyClass
环境变量
JAVA_OPTS: JVM 参数设置(例如:-Xmx512m -Xms256m)
故障排除
Java 原生运行常见问题
-
找不到主类
- 确保使用
shadowJar任务构建,而不是普通的jar任务 - 检查 JAR 文件是否存在于
build/libs/目录
- 确保使用
-
依赖解析失败
- 确保目标项目有有效的 Gradle 配置
- 检查网络连接,确保能访问 Maven 仓库
Docker 运行常见问题
-
构建失败
- 确保 Docker 守护进程正在运行
- 检查是否有足够的磁盘空间
-
容器无法访问本地文件
- 使用
-v参数正确挂载本地目录 - 检查文件权限
- 使用
开发指南
项目结构
gradle-class-finder-mcp/
├── src/
│ └── main/
│ └── java/
│ └── com/opencare/mcp/
│ ├── GradleClassFinderMcpServer.java
│ ├── service/
│ ├── decompiler/
│ └── util/
├── build.gradle
├── Dockerfile
└── README.md
本地开发
# 运行测试
./gradlew test
# 清理构建
./gradlew clean
# 构建并运行
./gradlew clean shadowJar run
License
MIT License
İlgili Sunucular
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Chrome DevTools MCP
chrome-devtools-mcp lets your coding agent (such as Gemini, Claude, Cursor or Copilot) control and inspect a live Chrome browser
NuGet Package README
Fetches comprehensive information about NuGet packages from the NuGet Gallery, including READMEs, metadata, and search functionality.
Iris
MCP-native agent evaluation and observability server — log traces, evaluate output quality, and track agent costs with 12 built-in eval rules and a real-time dashboard.
MCP DevTools
A development tools server for Git management, file operations, AI-assisted editing, and terminal execution, integrable with AI assistants and code editors.
Frappe MCP Server
An MCP server for the Frappe Framework, enabling AI assistants to interact with Frappe's REST API for document management and schema operations.
MCP Hot-Reload
A Hot Module Replacement (HMR) proxy server for MCP servers that automatically restarts on file changes, buffers messages, and manages connections.
Sequa MCP
A proxy that connects local STDIO with remote MCP servers, enabling IDEs to use MCP without extra infrastructure.
DevTools Debugger MCP
Exposes full Chrome DevTools Protocol debugging capabilities, including breakpoints, call stacks, and source maps.
WireMCP
Empowers LLMs with real-time network traffic analysis using tshark. Requires Wireshark's tshark to be installed.
Document Schema Specifications
A collection of document schemas for standardizing project documentation across various software projects.