gradle-analyzer-mcp
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., "@gradle-analyzer-mcpAnalyze dependencies of the app module"
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.
Gradle 依赖分析
一个专为 Android 项目设计的 Gradle 依赖分析工具,支持 Version Catalog (TOML) 配置。
功能特性
1. 依赖分析
分析指定模块的所有依赖配置
支持 implementation, api, kapt, ksp, testImplementation 等配置
识别 Version Catalog 引用(libs.xxx)
识别模块间依赖(project:xxx)
2. 模块管理
列出项目中的所有模块
对比不同模块的依赖差异
查找重复依赖
3. Version Catalog 解析
解析
gradle/libs.versions.toml文件提取版本号、库定义、插件定义
支持 bundles 配置
4. 版本检查
检查依赖版本更新(基础功能)
可扩展集成第三方版本检查 API
5. 依赖树生成
调用 Gradle 命令生成完整依赖树
支持指定配置(如 debugRuntimeClasspath)
Related MCP server: Project Explorer MCP Server
安装
前置要求
Python 3.10 或更高版本
pip 包管理器
方法 1: 从 PyPI 安装(推荐,发布后可用)
pip install gradle-analyzer-mcp在 Kiro 的 MCP 配置文件中添加(.kiro/settings/mcp.json):
{
"mcpServers": {
"gradle-analyzer": {
"command": "uvx",
"args": ["gradle-analyzer-mcp"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}方法 2: 从 GitHub 源码安装
# 克隆仓库
git clone https://github.com/hpuhsp/gradle-analyzer-mcp.git
cd gradle-analyzer-mcp
# 安装依赖
pip install -e .在 Kiro 的 MCP 配置文件中添加:
{
"mcpServers": {
"gradle-analyzer": {
"command": "python",
"args": ["/path/to/gradle-analyzer-mcp/server.py"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}方法 3: 使用 uvx 直接运行(无需安装)
{
"mcpServers": {
"gradle-analyzer": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hpuhsp/gradle-analyzer-mcp.git", "python", "server.py"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}可用工具
1. analyze_dependencies
分析指定模块的依赖配置
参数:
project_path(必需): 项目根目录路径module(可选): 模块名称,默认 "app"
示例:
{
"project_path": "D:\\WorkPlace\\Android\\Test",
"module": "app"
}返回示例:
{
"module": "app",
"dependencies": {
"implementation": [
"libs.bundles.coroutines",
"project:msc",
"project:base"
],
"kapt": [
"libs.arouter.compiler",
"libs.hilt.compiler"
],
"ksp": [
"libs.androidx.room.compiler",
"libs.glide.ksp"
]
}
}2. list_all_modules
列出项目中的所有模块
参数:
project_path(必需): 项目根目录路径
返回示例:
{
"total": 4,
"modules": ["app", "base", "swallow", "msc"]
}3. parse_version_catalog
解析 libs.versions.toml 文件
参数:
project_path(必需): 项目根目录路径
返回示例:
{
"versions": {
"agp": "8.7.3",
"kotlin": "2.0.21",
"hilt": "2.57.2"
},
"libraries": {
"androidx-core-ktx": "...",
"hilt-android": "..."
},
"plugins": {...},
"bundles": {...}
}4. check_version_updates
检查依赖版本更新
参数:
project_path(必需): 项目根目录路径
5. find_duplicate_dependencies
查找重复依赖
参数:
project_path(必需): 项目根目录路径
返回示例:
{
"total_duplicates": 5,
"duplicates": {
"libs.hilt.android": [
{"module": "app", "configuration": "implementation"},
{"module": "base", "configuration": "implementation"}
]
}
}6. generate_dependency_tree
生成依赖树(调用 Gradle)
参数:
project_path(必需): 项目根目录路径module(可选): 模块名称,默认 "app"
7. compare_module_dependencies
对比两个模块的依赖
参数:
project_path(必需): 项目根目录路径module1(必需): 第一个模块名称module2(必需): 第二个模块名称
使用示例
在 Kiro 中使用
配置好 MCP 服务器后,在 Kiro 中直接对话:
分析 app 模块的依赖列出项目中的所有模块查找重复的依赖对比 app 和 base 模块的依赖差异技术栈
Python 3.10+
MCP (Model Context Protocol) 0.9.0+
tomli (TOML 解析)
目录结构
gradle-analyzer/
├── server.py # MCP 服务器主文件
├── pyproject.toml # Python 项目配置
├── README.md # 说明文档
└── .gitignore # Git 忽略文件扩展建议
集成版本检查 API:
Maven Central API
GitHub Releases API
自定义版本服务
依赖冲突检测:
解析 Gradle 依赖树
识别版本冲突
提供解决方案
依赖可视化:
生成依赖关系图
导出为 DOT/SVG 格式
安全扫描:
集成 CVE 数据库
检查已知漏洞
故障排除
问题:找不到 mcp 模块
解决方案:
pip install mcp问题:找不到 tomli 模块
解决方案:
pip install tomli问题:Gradle 命令执行失败
解决方案:
确保项目根目录有
gradlew或gradlew.bat检查 Gradle 配置是否正确
尝试手动运行
./gradlew :app:dependencies
开发与贡献
本地开发
# 克隆仓库
git clone https://github.com/hpuhsp/gradle-analyzer-mcp.git
cd gradle-analyzer-mcp
# 创建虚拟环境(推荐)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试
pytest
# 本地测试 MCP 服务器
python server.py贡献指南
欢迎提交 Issue 和 Pull Request!
Fork 本仓库
创建特性分支 (
git checkout -b feature/AmazingFeature)提交更改 (
git commit -m 'Add some AmazingFeature')推送到分支 (
git push origin feature/AmazingFeature)开启 Pull Request
许可证
MIT License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/hpuhsp/gradle-analyzer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server