使用说明
Argus-存储库分析和安全评估工具
一个强大的模型上下文协议(MCP)工具,用于分析代码存储库、执行安全扫描和评估多种编程语言的代码质量。
特性
-
多语言支持
- 去:gocyclo,golangci皮棉分析
- Java:PMD静态分析
- Pylint,Bandit安全检查
- JavaScript/TypeScript:ESLint分析
- 自动语言检测
-
安全扫描
- 集成Trivy漏洞扫描程序
- 全面的安全报告
- 支持多个分支机构
-
Git操作
- 分支机构计数和管理
- 提交历史分析
- 差异比较
- 存储库结构可视化
安装
先决条件
- Python 3.8+
- Git
- libmagic(系统依赖性)
系统相关性
macOS
brew install libmagic
Linux(Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y libmagic1
通过紫外线安装
uvx argus
用法
基本MCP命令
# Analyze repository structure
analyze_repository_structure(
repo_url="https://gitlab.com/user/repo",
gitlab_credentials={"api_key": "your-token"}, # Optional
branch="main" # Optional
)
# Perform code quality analysis
analyze_code_quality(
repo_url="https://gitlab.com/user/repo",
language="python" # Optional, will auto-detect if not specified
)
# Security scan
security_scan_repository(
repo_url="https://gitlab.com/user/repo",
scan_type="trivy"
)
# Compare changes
compare_git_changes(
repo_url="https://gitlab.com/user/repo",
source="feature-branch",
target="main"
)
# Security scan repository
security_scan_repository(
repo_url="https://gitlab.com/user/repo",
scan_type="trivy"
)
### MCP Configuration
```json
{
"command": "uvx",
"args": [
"--from",
"git+https://github.com/athapong/argus",
"argus"
],
"alwaysAllow": [
"get_commit_history",
"enumerate_branches",
"compare_git_changes",
"analyze_code_quality",
"security_scan_repository"
],
"timeout": 300
}
支持的分析工具
| 语言 | 工具 | 安装 |
|---|---|---|
| Go | gocyclo,golangci lint | go install github.com/fzipp/gocyclo/cmd/gocyclo@latest |
| Java | PMD | macOS: brew install pmd,Linux:自动安装 |
| Python | Pylint,Bandit | 通过依赖项自动安装 |
| JavaScript | ESLint | npm install -g eslint |
环境变量
SKIP_SYSTEM_CHECK:设置为任何值以跳过系统依赖性检查PATH:自动更新以安装工具
错误处理
该工具提供详细的错误消息和优雅的回退:
- 依赖安装失败显示警告而不是错误
- 如果自动检测失败,语言检测将回退到指定语言
- 工具执行错误被捕获在响应结构中
许可证
MIT许可证
贡献
- 分叉存储库
- 创建功能分支
- 提交您的更改
- 推到分支
- 创建新的Pull请求
