@changpu/jar-api-parser
v1.4.0
Published
MCP tool for parsing Java jar packages and extracting API information from Gradle cache
Maintainers
Readme
Jar API Parser - MCP 工具
一个用于解析 Java jar 包接口方法信息的 MCP (Model Context Protocol) 工具。自动从 Gradle cache 中定位并解析二方包的 API 信息。
功能特性
- ✅ 自动定位 Gradle cache 中的 jar 包
- ✅ 解析接口和抽象类的方法签名
- ✅ 提取方法参数列表和返回值类型
- ✅ 支持泛型信息解析
- ✅ 支持按方法名过滤
- ✅ 支持 NPM 全局安装和 npx 使用
安装
方式一:NPM 全局安装(推荐)
npm install -g @changpu-jingling/jar-api-parser方式二:使用 npx(无需安装)
npx @changpu-jingling/jar-api-parser方式三:项目本地安装
npm install @changpu-jingling/jar-api-parser配置 MCP 服务器
Claude Desktop 配置
编辑配置文件:~/Library/Application Support/Claude/claude_desktop_config.json
使用 npx(推荐):
{
"mcpServers": {
"jar-api-parser": {
"command": "npx",
"args": ["-y", "@changpu-jingling/jar-api-parser"]
}
}
}使用全局安装:
{
"mcpServers": {
"jar-api-parser": {
"command": "jar-api-parser"
}
}
}Claude Code CLI 配置
编辑配置文件:~/.config/claude-code/config.json
{
"mcpServers": {
"jar-api-parser": {
"command": "npx",
"args": ["-y", "@changpu-jingling/jar-api-parser"]
}
}
}配置完成后,重启 Claude Desktop 或 Claude Code CLI。
使用示例
查询接口方法
// 查询 OrderStatusApi 的所有方法
{
"gav": "com.webuy:ordercenter-client:1.2.35-RELEASE",
"className": "com.webuy.ordercenter.client.OrderStatusApi"
}
// 查询特定方法
{
"gav": "com.webuy:ordercenter-client:1.2.35-RELEASE",
"className": "com.webuy.ordercenter.client.OrderStatusApi",
"methodName": "queryBuyerOrderListCount"
}输出示例
{
"artifact": {
"groupId": "com.webuy",
"artifactId": "ordercenter-client",
"version": "1.2.35-RELEASE"
},
"jarPath": "~/.gradle/caches/modules-2/files-2.1/...",
"classes": [
{
"className": "OrderStatusApi",
"packageName": "com.webuy.ordercenter.client",
"isInterface": true,
"methods": [
{
"name": "queryBuyerOrderListCount",
"returnType": "Result",
"parameters": [
{
"index": 0,
"name": "request",
"type": "QueryOrderListCountRequest"
}
],
"isPublic": true,
"isAbstract": true
}
]
}
]
}