代理扫描程序
AI代理、MCP服务器和代理技能的安全扫描程序。发现已安装的AI代理客户端,连接到其配置的MCP服务器,并检测及时注入、工具中毒、有毒流和其他安全威胁。
灵感源自 snyk/代理扫描,在Go中重新实现为单个静态二进制文件。
特性
- 自动发现 11个以上的AI代理客户端(Claude Desktop、Claude Code、Cursor、VS Code、Windsurf、Gemini CLI、Kiro、Codex等)
- MCP协议客户端 支持stdio、SSE和流式HTTP传输
- 13安全规则 检测提示注入、工具阴影、硬编码秘密、恶意代码、有毒流等
- 技能扫描 用于包含以下内容的代理技能目录
SKILL.md - 直接扫描 来自包装经理(
npm:,pypi:,oci://)和URL(sse://,streamable-http://) - MCP服务器模式 --将代理扫描程序本身作为具有后台定期扫描功能的MCP服务器运行
- 跨平台 支持(macOS、Linux、Windows)
- 单个二进制 零运行时依赖关系
安装
来源
git clone https://github.com/go-authgate/agent-scanner.git
cd agent-scanner
make build二进制将位于 bin/agent-scanner.
跨平台构建
make build_linux_amd64
make build_linux_arm64
make build_darwin_amd64
make build_darwin_arm64
make build_windows_amd64用法
扫描(默认)
发现并扫描您计算机上的所有MCP服务器:
agent-scanner scan扫描特定的配置文件:
agent-scanner scan ~/.cursor/mcp.json直接扫描远程MCP服务器:
agent-scanner scan sse://localhost:3000/sse
agent-scanner scan streamable-https://example.com/mcp扫描npm/PyPI MCP包:
agent-scanner scan npm:@modelcontextprotocol/server-filesystem@latest
agent-scanner scan pypi:mcp-server-sqlite@0.1.0扫描技巧
扫描单个技能目录(必须包含 SKILL.md):
agent-scanner scan ./path/to/my-skill扫描包含多种技能的父目录:
agent-scanner scan ./skills/从已知客户端目录中自动发现和扫描技能(例如。 ~/.claude/commands):
agent-scanner scan --skills检查
列出不进行安全分析的工具、提示和资源:
agent-scanner inspectMCP服务器模式
将代理扫描程序作为MCP服务器运行,暴露 scan 和 get_scan_results 工具:
agent-scanner mcp-server在仅工具模式下运行(无背景扫描):
agent-scanner mcp-server --tool自定义背景扫描间隔:
agent-scanner mcp-server --scan-interval 60将代理扫描程序安装到Claude Desktop配置中:
agent-scanner install-mcp-server
agent-scanner install-mcp-server ~/.config/claude/claude_desktop_config.json选项
--json Output results as JSON
--skills Include skill directory scanning
--verbose Enable verbose logging
--server-timeout N MCP server connection timeout in seconds (default: 10)
--skip-ssl-verify Disable SSL certificate verification
--scan-all-users Scan all user home directories
--print-errors Show server startup errors/tracebacks
--print-full-descriptions Show full entity descriptions
--analysis-url URL Remote verification server URL
--control-server URL Upload results to control serverJSON输出
agent-scanner scan --json | jq '.[] | .issues'问题代码
关键(电子代码)
| 代码 | 描述 |
|---|---|
| E001 | 工具描述中的提示注射 |
| E002 | 跨服务器工具参考(工具阴影) |
| E003 | 工具描述劫持代理行为 |
| E004 | 技能快速注射 |
| E005 | 技能中可疑的下载URL |
| E006 | 技能中的恶意代码模式 |
警告(W代码)
| 代码 | 描述 |
|---|---|
| W001 | 描述中可疑的触发词 |
| W002 | 实体太多(>100) |
| W007 | 凭证处理不安全 |
| W008 | 硬编码秘密 |
| W009 | 直接财务执行能力 |
| W011 | 不可信的第三方内容暴露 |
| W012 | 无法验证的外部依赖关系 |
| W013 | 系统服务修改 |
有毒物质流动(TF代码)
| 代码 | 描述 |
|---|---|
| TF001 | 数据泄漏流(不可信来源→ 私人数据→ 公共水槽) |
| TF002 | 破坏性流(不受信任的来源→ 不可逆作用) |
支持的客户
| 客户端 | macOS | Linux | Windows |
|---|---|---|---|
| 克劳德桌面 | ✓ | — | ✓ |
| 克劳德代码 | ✓ | ✓ | ✓ |
| 光标 | ✓ | ✓ | ✓ |
| VS代码 | ✓ | ✓ | ✓ |
| 风浪 | ✓ | ✓ | ✓ |
| Gemini CLI | ✓ | ✓ | ✓ |
| Kiro | ✓ | ✓ | ✓ |
| 食品法典 | ✓ | ✓ | ✓ |
| OpenCode | ✓ | ✓ | — |
| OpenClaw | ✓ | ✓ | ✓ |
| 反重力 | ✓ | ✓ | — |
建筑
Discovery → Inspect → Analyze → Report/Push- 发现 --查找已安装的AI代理客户端并解析其MCP配置文件
- 检查 --同时连接到MCP服务器,提取工具/提示/资源签名
- 分析 --运行本地安全规则+可选的远程基于机器学习的分析
- 报告 --输出为彩色终端文本或JSON
- 推 --将编辑后的结果上传到控制服务器
发展
make test # Run tests with coverage
make lint # Run golangci-lint
make fmt # Format code
make build # Build binary许可证
看 许可证 了解详情。
