Carlos-Projects/mcpscope
GitHub: Carlos-Projects/mcpscope
MCP-Scope 是一个统一的安全仪表板,将来自多种 MCP/A2A 安全扫描器的结果汇聚为集中化的安全态势视图,支持 Web 界面、REST API 和 CLI 访问。
Stars: 0 | Forks: 0
# MCP-Scope
**用于 MCP/A2A 扫描器结果的统一安全仪表板**
[](https://python.org)
[](https://github.com/Carlos-Projects/mcpscope/actions)
[](LICENSE)
[](https://github.com/Carlos-Projects/mcpscope/releases)
[](https://docs.astral.sh/ruff)
[](https://huggingface.co/spaces/Syntho/mcpscope)
[](https://api.star-history.com/svg?repos=Carlos-Projects/mcpscope&type=Date)
**[在 HuggingFace Spaces 上在线体验](https://huggingface.co/spaces/Syntho/mcpscope)** — 查看包含预置演示数据的仪表板。
接收来自多个 MCP/A2A 安全扫描器(Cisco MCP Scanner、Cisco A2A Scanner、mcp-scan、MCPwn、SARIF)的输出,并通过 Web 仪表板、REST API 和 CLI 呈现统一的安全态势视图。
## 快速开始
```
pip install -e .
# 生成演示数据并探索
mcpscope seed
mcpscope serve
# 直接对服务器运行扫描
mcpscope scan mcp-scan https://mcp-server.example.com/mcp
# 从不同扫描器导入结果
mcpscope import cisco-mcp results.json
mcpscope import cisco-a2a results.json
mcpscope import mcpwn results.json
mcpscope import sarif report.sarif
# 导出合规报告
mcpscope report --format csv --output report.csv
# 备份/恢复
mcpscope backup backup.db
mcpscope restore backup.db
```
## 命令
| 命令 | 描述 |
|---------|-------------|
| `serve` | 启动 FastAPI Web 仪表板 |
| `scan` | 直接针对目标运行扫描器 |
| `import` | 将扫描器 JSON/SARIF 结果导入 SQLite |
| `report` | 导出 JSON、CSV 或 PDF 合规报告 |
| `seed` | 生成演示扫描数据 |
| `prune` | 删除超过 N 天的扫描记录 |
| `backup` | 备份 SQLite 数据库 |
| `restore` | 从备份还原 SQLite 数据库 |
| `config` | 查看或设置配置选项 |
## API Endpoint
| Endpoint | 描述 |
|----------|-------------|
| `GET /` | 带有过滤器和选项卡的仪表板 UI |
| `GET /findings/{id}` | 漏洞详情页 |
| `GET /docs` | Swagger UI |
| `GET /api/health` | 健康检查 |
| `GET /api/scans` | 列出扫描记录(分页) |
| `GET /api/scans/{id}` | 包含漏洞的扫描详情 |
| `GET /api/scans/{a}/diff/{b}` | 比较两次扫描 |
| `GET /api/findings` | 查询漏洞(分页、可过滤) |
| `GET /api/findings/{id}` | 单个漏洞 |
| `GET /api/stats/summary` | 汇总统计数据 |
| `GET /api/stats/top-tools` | 存在最多漏洞的工具 |
| `GET /api/stats/severity-trend` | 随时间变化的漏洞趋势 |
| `GET /api/stats/duplicates` | 去重后的漏洞 |
| `GET /api/report/json` | 完整的 JSON 报告 |
| `GET /api/report/csv` | 导出 CSV |
## API 使用示例
```
# 健康检查
curl http://localhost:8080/api/health
# 列出扫描(分页)
curl "http://localhost:8080/api/scans?page=1&page_size=10"
# 获取包含 findings 的扫描
curl http://localhost:8080/api/scans/scan-id-here
# 使用 filters 查询 findings
curl "http://localhost:8080/api/findings?severity=critical&page=1"
# 搜索 findings
curl "http://localhost:8080/api/findings?search=command"
# 比较两次扫描
curl "http://localhost:8080/api/scans/scan-a/diff/scan-b"
# 获取统计摘要
curl http://localhost:8080/api/stats/summary
# 获取重复项
curl http://localhost:8080/api/stats/duplicates
# 导出为 CSV
curl http://localhost:8080/api/report/csv -o report.csv
# 完整 JSON 报告
curl http://localhost:8080/api/report/json
# 使用 API key 认证
curl -H "X-API-Key: your-key" http://localhost:8080/api/scans
# Swagger 文档
open http://localhost:8080/docs
```
## 仪表板功能
- **概览选项卡** — 严重程度饼图、热门工具条形图、随时间变化的严重程度趋势
- **漏洞选项卡** — 具有严重程度/扫描器/工具/搜索、分页、可点击行进入详情视图的可过滤表格
- **重复项选项卡** — 跨扫描按工具 + 标题 + 严重程度分组的漏洞
- **差异选项卡** — 任意两次扫描之间的并排比较
- **扫描选项卡** — 带有严重程度统计的历史扫描表格
- **自动刷新** — 可配置的自动刷新间隔
- **漏洞详情页** — 包含原始 JSON 数据的完整详情
## 支持的扫描器
| 扫描器 | CLI 名称 | 格式 |
|---------|----------|--------|
| Cisco MCP Scanner | `cisco-mcp` | 带有按分析器分组漏洞的 `scan_results` |
| Cisco A2A Scanner | `cisco-a2a` | 带有 AI 安全分类元数据的 `findings` |
| mcp-scan (Invariant Labs) | `mcp-scan` / `mcpscan` | 带有严重程度代码的 `issues` 数组 |
| MCPwn (ressl) | `mcpwn` | 带有 MCP-XXX ID 的标准漏洞 |
| MCPwn (Teycir legacy) | `mcpwn` | 旧版的基于测试的格式 |
| SARIF | `sarif` | 标准 SARIF 2.1 格式 |
## 截图
| 仪表板概览 | 漏洞表格 |
|---|---|
|  |  |
| **扫描差异** | **漏洞详情** |
|  |  |
_运行 `mcpscope seed && mcpscope serve` 并打开 http://localhost:8080 以查看实时仪表板。_
## CI/CD 集成
使用 API 密钥保护 API:
```
mcpscope config set api_key "your-secret-key"
mcpscope serve
# 所有 /api/* endpoints 现在需要:X-API-Key: your-secret-key
```
包含一个用于自动化扫描的 [GitHub Actions 工作流](.github/workflows/scan.yml)。
针对严重/高危漏洞的 Slack 告警:
```
mcpscope config set slack_webhook_url "https://hooks.slack.com/services/..."
```
用于自定义集成的 Webhook URL:
```
mcpscope config set webhook_urls '["https://your-server.com/webhook"]'
```
## 配置
配置文件位于 `~/.mcpscope/config.json`:
```
mcpscope config show
mcpscope config set port 9090
mcpscope config set auto_refresh_seconds 60
mcpscope config set max_upload_mb 100
```
## Docker
```
docker build -t mcpscope .
docker run -p 8080:8080 -v mcpscope-data:/root/.mcpscope mcpscope
```
## 开发
```
pip install -e ".[dev]"
pytest
```
## 安全事件 (MCPGuard 集成)
MCP-Scope 可以接收来自 MCPGuard 的实时安全事件:
```
# 配置 MCPGuard 的 config.yaml:
mcpscop_url: http://localhost:8000
# 事件显示在 "Live Events" dashboard 标签页中
```
| Endpoint | Method | 描述 |
|----------|--------|-------------|
| `/api/events` | POST | 接入安全事件 |
| `/api/events` | GET | 列出事件(过滤器:severity、event_type) |
| `/api/events/stats` | GET | 事件统计信息 |
| `/api/events` | DELETE | 清除所有事件 |
## 相关项目
MCP-Scope 是面向 AI agent 的 **Carlos-Projects** 安全生态系统的一部分:
- [**MCPGuard**](https://github.com/Carlos-Projects/mcpguard) — 带有 HTMX 仪表板的 MCP/A2A 协议运行时安全代理
- [**MCPwn**](https://github.com/Carlos-Projects/mcpwn) — 用于 MCP 服务器的攻击性安全测试框架
- [**Palisade Scanner**](https://github.com/Carlos-Projects/palisade-scanner) — 扫描 Web 内容以检测 prompt 注入和对抗性内容
- [**AgentGate**](https://github.com/Carlos-Projects/agentgate) — 面向访问网站的 AI agent 的基于策略的防火墙和蜜罐 middleware
## 安全
发现漏洞?请参阅 [SECURITY.md](SECURITY.md)。
## 许可证
[MIT](LICENSE)标签:AV绕过, FastAPI, GraphQL安全矩阵, LNA, MCP/A2A, Python, 安全仪表盘, 安全扫描器, 无后门, 网络测绘, 请求拦截, 逆向工具