mcpscanner/cli

GitHub: mcpscanner/cli

MCP 服务器安全扫描工具,用于发现身份验证绕过、注入漏洞、CORS 配置错误等安全风险并生成严重度评分报告。

Stars: 0 | Forks: 0

# mcpscanner [Model Context Protocol (MCP)](https://modelcontextprotocol.io) 服务器的安全扫描器。在攻击者之前发现漏洞。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/mcpscanner/cli/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/mcpscanner/cli?color=2bd4a7)](https://github.com/mcpscanner/cli/releases) [![License](https://img.shields.io/github/license/mcpscanner/cli?color=blue)](LICENSE) ![Go](https://img.shields.io/github/go-mod/go-version/mcpscanner/cli) ![Platforms](https://img.shields.io/badge/platforms-macOS%20%C2%B7%20Linux%20%C2%B7%20Windows-555) ## 安装 ``` # One-liner (macOS / Linux) curl -fsSL https://install.mcpscanner.dev/install.sh | sh ``` **其他方法:** ``` # Homebrew (macOS / Linux) brew install mcpscanner/tap/mcpscanner # 从源码构建 (需要 Go 1.24+) go install github.com/mcpscanner/cli@latest # 或者直接从 GitHub Releases 下载二进制文件 # https://github.com/mcpscanner/cli/releases ``` ``` # Scoop (Windows) scoop bucket add mcpscanner https://github.com/mcpscanner/scoop-bucket scoop install mcpscanner ``` ## 用法 ``` # 扫描 MCP server mcpscanner scan https://your-mcp-server.com/mcp # JSON 输出 mcpscanner scan https://your-mcp-server.com/mcp --format json # 保存 HTML 报告 mcpscanner scan https://your-mcp-server.com/mcp --format html --output report.html # 使用 auth token mcpscanner scan https://your-mcp-server.com/mcp --token "sk-your-token" # 交互模式 mcpscanner scan --interactive # 扫描内部/私有 IP (默认禁用以确保安全) mcpscanner scan http://192.168.1.100:8080/mcp --allow-internal # 扫描配置文件 (Claude Desktop / Cursor 格式) mcpscanner scan --config ~/.claude/claude_desktop_config.json # 安静模式 (无进度指示器) mcpscanner scan https://your-mcp-server.com/mcp --no-progress --format json ``` ## 检查内容 ### 工具分析 - 通过 JSON-RPC 2.0 枚举工具 - 检测文件系统、代码执行、数据库和网络工具 - 识别路径和 URL 参数 - 输入验证分析(缺失约束) - 过度的工具暴露(>20 个工具) ### 身份验证 - 未认证访问检测 - 默认/弱凭据测试(test、admin、password 等) ### 传输安全 - 缺失 TLS(纯 HTTP) - CORS 配置错误(通配符、源反射) ### 主动探测 - 路径遍历(../../etc/passwd) - 命令注入(; id, | whoami) - SQL 注入(' OR '1'='1) - SSRF(云元数据 endpoint) - Prompt 注入反射 ### 速率限制 - 突发请求测试(20 次快速请求) ### 自我保护 - SSRF 防护阻止扫描内部 IP、环回地址、链路本地地址和云元数据 endpoint - 响应大小上限(10 MB) - 工具数量上限(500) - 无重定向策略 - 防御性 schema 标准化 ## 评分 ``` Score = 100 - (Critical x 40) - (High x 15) - (Medium x 5) - (Low x 1) A = 90+ | B = 80+ | C = 70+ | D = 50+ | F = <50 ``` ## 输出格式 | 格式 | 标志 | 描述 | |--------|------|-------------| | Text | `--format text` | 人类可读的终端输出(默认) | | JSON | `--format json` | 用于 CI/CD 集成的结构化 JSON | | HTML | `--format html` | 带深色主题的独立 HTML 报告 | ## 标志 | 标志 | 简写 | 默认值 | 描述 | |------|-------|---------|-------------| | `--format` | `-f` | `text` | 输出格式:text、json、html | | `--output` | `-o` | stdout | 将报告写入文件 | | `--timeout` | `-t` | `60` | HTTP 超时时间(秒) | | `--token` | | | 认证 token(作为 Bearer 发送) | | `--config` | `-c` | | 扫描 MCP 服务器配置文件(mcpServers JSON) | | `--no-progress` | | `false` | 禁用实时进度显示 | | `--interactive` | `-i` | `false` | 交互模式 | | `--allow-internal` | | `false` | 允许扫描私有 IP | ## 开发 ``` # 运行测试 go test ./... # 使用 race detector 运行测试 go test -race ./... # 构建 go build -o mcpscanner . # Vet go vet ./... ``` ## 许可证 Apache 2.0 — 见 [LICENSE](LICENSE)。 ## 关于 **MCP Scanner CLI** 是 [MCP Scanner](https://mcpscanner.dev) 的开源命令行界面,由 [codelake Technologies LLC](https://codelake.dev)(Akyros Labs 旗下品牌)构建。 访问 [mcpscanner.dev](https://mcpscanner.dev)。
标签:AI安全, Chat Copilot, DOE合作, EVTX分析, Go语言, GraphQL安全矩阵, MCP, 安全扫描器, 文档结构分析, 日志审计, 程序破解, 聊天机器人