Vorota-ai/shodan-mcp
GitHub: Vorota-ai/shodan-mcp
将Shodan搜索引擎集成到AI IDE中的MCP服务器,提供20个被动侦察工具用于CVE查询、设备搜索和DNS分析。
Stars: 18 | Forks: 4
# Shodan MCP Server -- Claude、Cursor 和 VS Code 的 AI 驱动互联网情报工具
**shodan-mcp** 是一个 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) 服务器,为 Claude、Cursor 和 GitHub Copilot 等 AI 代理提供直接访问 [Shodan](https://www.shodan.io/) 的能力——这是全球最大的互联网连接设备搜索引擎。由 [Vorota AI](https://github.com/vorotaai) 开发。
20 个工具用于被动侦察、漏洞情报、DNS 分析和设备搜索——全部可在您的 IDE 中完成。不会向任何目标发送数据包。
[](https://github.com/vorotaai/shodan-mcp/blob/main/LICENSE)
[](https://github.com/vorotaai/shodan-mcp)
[](https://modelcontextprotocol.io/)
[](https://github.com/vorotaai/shodan-mcp)
[](https://github.com/vorotaai/shodan-mcp#installation)
## 快速开始
```
docker build -t shodan-mcp https://github.com/vorotaai/shodan-mcp.git
```
添加到您的 MCP 客户端(Claude Desktop、Cursor、VS Code 等):
```
{
"mcpServers": {
"shodan-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SHODAN_API_KEY", "shodan-mcp"],
"env": {
"SHODAN_API_KEY": "your-api-key-here"
}
}
}
}
```
4 个工具**无需 API 密钥即可立即使用**——CVE 查询、CVE 搜索、CPE 搜索和 InternetDB。在 [account.shodan.io]( 获取 Shodan API 密钥以解锁全部 20 个工具。
## 可用工具
### 免费工具(无需 API 密钥)
| 工具 | 描述 |
|------|-------------|
| `shodan-cve-lookup` | 查询任何 CVE——CVSS v3 分数、EPSS 利用预测、参考信息、受影响的 CPE |
| `shodan-search-cves` | 使用过滤器搜索 CVE——CISA KEV 目录、EPSS 排序、日期范围 |
| `shodan-search-cpes` | 按产品名称搜索 CPE 标识符(例如 "apache"、"nginx")|
| `shodan-internetdb-lookup` | 快速免费的 IP 情报——开放端口、漏洞、主机名、CPE、标签 |
### 侦察工具(需要 API 密钥)
| 工具 | 描述 |
|------|-------------|
| `shodan-ip-lookup` | 完整 IP 侦察——端口、服务、banner、地理位置、漏洞、ISP/组织、ASN |
| `shodan-search` | 使用强大的查询语法搜索 Shodan 的数十亿设备数据库 |
| `shodan-search-count` | 计算搜索结果,不消耗查询配额 |
| `shodan-dns-resolve` | 将主机名解析为 IP 地址 |
| `shodan-dns-reverse` | IP 地址的反向 DNS 查询 |
| `shodan-domain-info` | 域名侦察——子域名、DNS 记录、标签 |
| `shodan-honeypot-score` | 检测 IP 是否为蜜罐(0.0 = 真实,1.0 = 蜜罐)|
### 实用工具(需要 API 密钥)
| 工具 | 描述 |
|------|-------------|
| `shodan-api-info` | 检查 API 密钥使用情况——计划类型、剩余配额 |
| `shodan-my-ip` | 获取 Shodan 看到的您的外部 IP 地址 |
| `shodan-account-profile` | 账户会员资格、配额、显示名称 |
| `shodan-list-facets` | 列出可用于查询分解的搜索维度 |
| `shodan-list-filters` | 列出可用的搜索过滤器 |
| `shodan-parse-query` | 分析和调试搜索查询 |
| `shodan-list-ports` | 列出 Shodan 爬虫扫描的端口号 |
| `shodan-list-protocols` | 列出按需扫描的协议 |
| `shodan-http-headers` | 显示您的客户端发送的 HTTP 头 |
## 功能特点
- **20 个工具**,涵盖 IP 侦察、设备搜索、CVE/CPE 情报、DNS、域名分析和蜜罐检测
- **4 个免费工具**,零配置即可使用——无需 API 密钥,无需注册
- **被动侦察**——所有查询都访问 Shodan 的预索引数据库,不会向任何目标发送数据包
- **结构化 Pydantic 输出**——每个工具都返回类型化模型,而非原始 JSON
- **输入验证**——IP 地址、域名、CVE ID 和查询在 API 调用前都会经过验证
- **API 密钥保护**——密钥不会在错误消息或日志中暴露
- **Docker 优先**——单命令构建和运行
- **支持所有 MCP 客户端**——Claude Desktop、Claude Code、Cursor、VS Code、Windsurf、Cline
## 示例提示
连接后,在您的 AI 客户端中使用自然语言:
- "我的外部 IP 地址是什么?"
- "CVE-2021-44228 的详细信息是什么?"
- "搜索与 Apache HTTP Server 相关的 CVE,按 EPSS 分数排序"
- "查找 nginx 的 CPE 标识符"
- "对我的服务器 IP 进行快速 InternetDB 查询"
- "我的公司域名存在哪些 DNS 记录?"
- "将主机名 myapp.example.com 解析为 IP 地址"
- "Shodan 中有哪些可用的搜索过滤器?"
- "检查我的 Shodan API 计划和剩余查询配额"
## 安装
### Docker(推荐)
```
docker build -t shodan-mcp https://github.com/vorotaai/shodan-mcp.git
```
### 使用 uv
```
git clone https://github.com/vorotaai/shodan-mcp.git
cd shodan-mcp
uv sync --all-groups
shodan-mcp
```
### 使用 pip
```
git clone https://github.com/vorotaai/shodan-mcp.git
cd shodan-mcp
pip install .
shodan-mcp
```
## 与 MCP 客户端配合使用
shodan-mcp 支持所有主流 MCP 客户端:**Claude Desktop**、**Claude Code**、**Cursor**、**VS Code Copilot**、**Windsurf** 和 **Cline**。
### Claude Desktop
添加到 `claude_desktop_config.json`:
```
{
"mcpServers": {
"shodan-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SHODAN_API_KEY", "shodan-mcp"],
"env": {
"SHODAN_API_KEY": "your-api-key-here"
}
}
}
}
```
### Claude Code
```
claude mcp add shodan-mcp -e SHODAN_API_KEY=your-api-key-here -- docker run --rm -i -e SHODAN_API_KEY shodan-mcp
```
### Cursor
添加到 `.cursor/mcp.json`:
```
{
"mcpServers": {
"shodan-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SHODAN_API_KEY", "shodan-mcp"],
"env": {
"SHODAN_API_KEY": "your-api-key-here"
}
}
}
}
```
### VS Code / VS Code Insiders
添加到 `.vscode/mcp.json`:
```
{
"servers": {
"shodan-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SHODAN_API_KEY", "shodan-mcp"],
"env": {
"SHODAN_API_KEY": "your-api-key-here"
}
}
}
}
```
### Windsurf / Cline
使用与 Claude Desktop 相同的配置。请参阅您客户端的文档以了解配置文件位置。
## 推荐工作流程
1. **免费快速扫描**——使用 `shodan-internetdb-lookup` 获取即时 IP 情报(无需密钥)
2. **漏洞研究**——使用 `shodan-cve-lookup` 和 `shodan-search-cves` 研究 CVE(免费)
3. **深度侦察**——使用 `shodan-ip-lookup` 获取完整主机详情(需要 API 密钥)
4. **发现暴露的主机**——使用 `shodan-search` 和 `shodan-search-count` 查找和量化目标
5. **DNS 情报**——使用 `shodan-dns-resolve`、`shodan-dns-reverse` 和 `shodan-domain-info`
6. **过滤蜜罐**——使用 `shodan-honeypot-score` 识别欺骗性主机
## 配置
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `SHODAN_API_KEY` | (无)| Shodan API 密钥。16 个工具需要此密钥,4 个免费工具不需要。在 [account.shodan.io](https://account.shodan.io) 获取。|
| `FASTMCP_LOG_LEVEL` | `WARNING` | 日志级别(DEBUG、INFO、WARNING、ERROR)|
## 安全
**需要授权。** 虽然 Shodan 查询是被动的,您仍然必须确保:
- 您有明确授权调查任何目标
- 您遵守所有适用法律和组织政策
- 您仅将此工具用于合法的安全研究、授权评估或防御行动
### 安全措施
- **输入验证**——IP、域名、CVE ID、主机名和查询在 API 调用前都会经过验证
- **注入防护**——禁止字符(`;`、`|`、`&`、`$`、` ``` 等)会被阻止
- **无 shell 执行**——所有 HTTP 请求使用 `httpx` 和结构化参数
- **API 密钥保护**——密钥通过环境变量传递,并从错误消息中剥离
- **被动设计**——不会向任何目标发送数据包
## 常见问题
### 我需要 Shodan API 密钥吗?
不需要也能开始使用。4 个工具无需密钥即可立即使用:`shodan-cve-lookup`、`shodan-search-cves`、`shodan-search-cpes` `shodan-internetdb-lookup`。免费 Shodan API 密钥可解锁其余 16 个工具——在 [account.shodan.io](https://account.shodan.io) 获取。
### 支持哪些 MCP 客户端?
Claude Desktop、Claude Code、Cursor、VS Code (GitHub Copilot)、Windsurf 和 Cline——任何支持 MCP stdio 传输的客户端。
### 它安全吗?
是的。所有查询都是被动的(不向目标发送数据包),输入经过验证,API 密钥不会在错误消息中暴露。
### 这与 Shodan 网站有何不同?
shodan-mcp 将 Shodan 直接集成到您的 AI 工作流程中。您的 AI 代理查询 Shodan、解释结果、关联发现并提供建议——全部在 IDE 的单个对话中完成。
## 许可证
[Apache License 2.0](https://github.com/vorotaai/shodan-mcp/blob/main/LICENSE) -- Copyright (c) Vorota AI
标签:AI安全工具, Claude, CPE, Cursor, CVE, CVE检测, DNS分析, Docker, ESC4, GitHub, IDE插件, MCP, Model Context Protocol, OSINT, Python, VS Code, XSS, 互联网情报, 威胁情报, 安全工具库, 安全防御评估, 实时处理, 密码管理, 开发者工具, 情报收集, 数字签名, 无后门, 漏洞情报, 漏洞研究, 网络安全, 被动侦察, 设备搜索, 请求拦截, 运行时操纵, 逆向工具, 隐私保护