一个模型上下文协议(MCP)服务器,通过WHOIS和RIPE数据库查询为大型语言模型提供网络信息查找工具。
whois_query - 查询WHOIS服务器以获取域名、IP地址和ASN信息expand_as_set - 递归扩展AS-SET为具体的ASN列表validate_route_object - 检查IRR路由对象是否存在contact_card - 获取滥用、管理员和技术联系人信息此MCP服务器支持所有五个区域互联网注册机构(RIR),具有不同的工具可用性:
| 工具 | RIPE NCC | ARIN | APNIC | AfriNIC | LACNIC |
|---|---|---|---|---|---|
| WHOIS查询 | ✅ | ✅ | ✅ | ✅ | ✅ |
| AS-SET扩展 | ✅ | ✅ | ➖ | ➖ | ➖ |
| 路由验证 | ✅ | ✅ | ➖ | ➖ | ➖ |
| 联系卡 | ✅ | ✅ | ✅ | ✅ | ✅ |
图例:
{rir}_whois_query 并解析输出代替)RIR覆盖范围:
此MCP服务器支持两种传输模式:
在您的Claude Desktop配置文件中添加:
位置:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json配置:
{
"mcpServers": {
"whois-mcp": {
"command": "/path/to/bin/uvx",
"args": ["--from", "git+https://github.com/dadepo/whois-mcp.git", "whois-mcp"]
}
}
}
使用CLI添加MCP服务器:
claude mcp add --transport stdio whois-mcp -- uvx --from git+https://github.com/dadepo/whois-mcp.git whois-mcp
# 验证是否已添加
claude mcp list
# 启动Claude Code
claude
对于基于Web的MCP客户端或远程访问:
启动服务器:
uvx --from git+https://github.com/dadepo/whois-mcp.git whois-mcp-server
# 自定义主机/端口
HTTP_HOST=0.0.0.0 HTTP_PORT=9000 uvx --from git+https://github.com/dadepo/whois-mcp.git whois-mcp-server
服务器默认将在 http://127.0.0.1:8000/mcp 上可用。
添加到Claude Code(HTTP):
claude mcp add --transport http whois-mcp-http http://127.0.0.1:8000/mcp
添加到Claude Desktop(HTTP):
{
"mcpServers": {
"whois-mcp-http": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
“谁拥有8.8.8.8?”
→ 使用whois_query检索注册详情
“AS-HETZNER中的ASNs有哪些?”
→ 使用expand_as_set列出成员ASNs
“是否有由AS61417发起的185.1.1.0/24路由对象?”
→ 使用validate_route_object检查IRR数据库
“我应该联系谁关于来自AS15169的滥用问题?”
→ 使用contact_card检索联系详情
环境变量(可选):
# 启用/禁用RIR支持(所有默认为true)
SUPPORT_RIPE=true # RIPE NCC(欧洲/中东/中亚)
SUPPORT_ARIN=true # ARIN(北美)
SUPPORT_APNIC=true # APNIC(亚太地区)
SUPPORT_AFRINIC=true # AfriNIC(非洲)
SUPPORT_LACNIC=true # LACNIC(拉丁美洲及加勒比海地区)
# 通用配置
HTTP_TIMEOUT_SECONDS=10
WHOIS_CONNECT_TIMEOUT_SECONDS=5
WHOIS_READ_TIMEOUT_SECONDS=5
CACHE_TTL_SECONDS=60
CACHE_MAX_ITEMS=512
# 自定义User-Agent字符串
USER_AGENT="whois-mcp/1.0"
# HTTP服务器配置(仅用于whois-mcp-server命令)
HTTP_HOST=127.0.0.1
HTTP_PORT=8000
每个RIR都可以单独启用或禁用使用环境变量。所有RIR端点都是硬编码以确保可靠性:
whois.ripe.net, https://rest.db.ripe.netwhois.arin.net, https://whois.arin.net/restwhois.apnic.net, https://rdap.apnic.netwhois.afrinic.net, https://rdap.afrinic.net/rdapwhois.lacnic.net, https://rdap.lacnic.net/rdap设置任何 SUPPORT_{RIR}=false 来禁用特定的RIR。工具前面会加上RIR名称(例如,ripe_whois_query,arin_whois_query,apnic_contact_card)。
# 克隆仓库
git clone https://github.com/dadepo/whois-mcp.git
cd whois-mcp
# 安装依赖
uv sync
# 在标准输入输出模式下运行
uv run whois-mcp
# 运行HTTP服务器模式
uv run whois-mcp-server
# 运行测试
uv run pytest
本项目根据MIT许可证发布 - 查看LICENSE文件了解详情。