内容
# DepGuard MCP 服务器
[](https://github.com/foudhilriahi/DepGuard/actions/workflows/ci.yml)
[](https://github.com/foudhilriahi/DepGuard/actions/workflows/pages.yml)
[](https://github.com/foudhilriahi/DepGuard/actions/workflows/proof-artifact.yml)
[](https://github.com/foudhilriahi/DepGuard/actions/workflows/publish-docker.yml)
[](https://github.com/foudhilriahi/DepGuard/pkgs/container/depguard)
[](https://foudhilriahi.github.io/DepGuard/)
DepGuard 是一个用于实时依赖风险检查的生产级 MCP 服务器。
它检查软件包更新的以下内容:
- OSV 漏洞(CVE/GHSA)
- npm 软件包弃用
- 本地缓存以实现快速重复查找
## 状态
- Docker 镜像:`ghcr.io/foudhilriahi/depguard:latest`
- 多架构发布:`linux/amd64`,`linux/arm64`
- GitHub Pages 直播证明:`https://foudhilriahi.github.io/DepGuard/`
---
## 1) 最快使用 DepGuard 的方法(Docker + MCP)
将以下内容添加到您的 MCP 客户端配置中:
```json
{
"mcpServers": {
"depguard": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"CACHE_TTL_SECONDS=86400",
"-e",
"DEPGUARD_CACHE_PATH=/data/cache.sqlite",
"-v",
"depguard-cache:/data",
"ghcr.io/foudhilriahi/depguard:latest"
]
}
}
}
```
保存配置后重启您的 AI IDE/CLI。
### 可用的 MCP 工具
- `check_package`
- `check_packages_bulk`
- `scan_package_json`
- `get_cached_result`
---
## 2) 真实的在线证明(无模拟)
### 直播证明页面
`docs/` 中的 GitHub Pages 应用程序对以下网址进行真实的浏览器调用:
- `https://api.osv.dev/v1/querybatch`
- `https://registry.npmjs.org/<package>`
### CI 证明工件
`docs/proof/latest.json` 通过在 CI 中运行 **实际的 DepGuard 核心逻辑** 生成:
- 工作流:`.github/workflows/proof-artifact.yml`
- 脚本:`scripts/generate-proof.mjs`
这不是模拟数据。
---
## 3) 在线测试 Docker 镜像(无需本地 Docker)
使用 GitHub Actions 手动工作流:
- 工作流:`.github/workflows/docker-smoke.yml`
- 触发器:**Actions → Docker Smoke Test (GHCR) → Run workflow**
它验证:
1. 可以从 GHCR 拉取镜像
2. 镜像清单检查有效
3. 容器运行时有效(`node --version`)
4. MCP 入口点文件存在(`/app/dist/index.js`)
因此,即使在本地没有安装 Docker,您也可以证明您的容器有效。
---
## 4) GitHub Pages 设置
使用基于工作流的 Pages 部署以保持一致性:
1. GitHub 仓库 → **Settings → Pages**
2. 来源:**GitHub Actions**
3. 保持 `.github/workflows/pages.yml` 启用
---
## 5) 本地开发(可选)
```bash
npm install
npm run test
npm run build
npm run dev
```
---
## 6) 环境变量
- `CACHE_TTL_SECONDS`(默认 `86400`)
- `DEPGUARD_CACHE_PATH`(默认 `.depguard-cache.sqlite`)
- `DEPGUARD_HTTP_TIMEOUT_MS`(默认 `7000`)
- `DEPGUARD_HTTP_RETRIES`(默认 `2`)
- `DEPGUARD_HTTP_RETRY_DELAY_MS`(默认 `250`)
---
## 7) 本仓库中的 CI/CD 工作流
- `ci.yml` → 测试 + 构建
- `pages.yml` → 将 `docs/` 部署到 GitHub Pages
- `proof-artifact.yml` → 刷新真实证明 JSON
- `publish-docker.yml` → 发布多架构 GHCR 镜像
- `docker-smoke.yml` → 手动在线容器验证