WHOIS查询服务

一个基于Model Context Protocol (MCP)的WHOIS域名查询服务器,支持877+顶级域名和169个国家代码顶级域名的解析,提供全面的域名注册信息查询功能。

  • by simplebytes-com
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 simplebytes-com/whois-mcp

使用说明

WHOIS MCP服务器

使用适当的WHOIS协议(TCP端口43)提供全面WHOIS域查找的模型上下文协议(MCP)服务器。直接查询权威的WHOIS服务器,支持877多个顶级域名,解析169个国家代码顶级域名。

特性

  • 本地WHOIS协议:将TCP端口43直接连接到权威的WHOIS服务器
  • 支持877+个顶级域名:所有主要顶级域名的WHOIS服务器综合词典
  • 169个ccTLD解析器:国家代码TLD(.gg、.pl、.jp、.kr、.ru、.de、.it等)的格式特定解析
  • 自动更新:使用内置工具从IANA刷新WHOIS服务器词典
  • 全面解析:提取注册商、日期、名称服务器、状态、DNSSEC、联系人
  • 轻量级:单个文件可执行,依赖性最小
  • 易于集成:适用于Claude Desktop和任何兼容MCP的客户端

安装

npm install whois-mcp

或者直接与npx一起使用:

npx whois-mcp

用法

选项1:本地安装(建议用于Claude Desktop)

添加到您的Claude Desktop配置文件中:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "whois": {
      "command": "npx",
      "args": ["-y", "whois-mcp"]
    }
  }
}

重新启动Claude Desktop,您将在中看到WHOIS工具🔌 菜单。

选项2:托管版本

此服务器也可作为托管服务在 mcp.domaindetails.com 用于基于HTTP的集成。

可用工具

whois_lookup

使用正确的WHOIS协议(端口43)查找域注册信息。

参数:

  • domain (字符串,必填):要查找的域名(例如google.com、theo.gg、mineo.pl)
  • include_raw (布尔值,可选):包括原始WHOIS响应数据(默认值:false)

请求示例:

{
  "domain": "theo.gg",
  "include_raw": false
}

示例响应:

{
  "domain": "theo.gg",
  "found": true,
  "method": "whois",
  "server": "whois.gg",
  "timestamp": "2025-10-30T11:11:32.936Z",
  "registrar": "NameCheap, Inc (https://www.namecheap.com)",
  "registrant": "Redacted for privacy",
  "creationDate": "2021-01-14T00:00:00Z",
  "expirationDate": "2026-01-14T00:00:00Z",
  "nameservers": [
    "dns1.registrar-servers.com",
    "dns2.registrar-servers.com"
  ],
  "status": [
    "Active",
    "Transfer Prohibited by Registrar"
  ],
  "parsed": {
    "domainName": "theo.gg",
    "registrar": "NameCheap, Inc (https://www.namecheap.com)",
    "creationDate": "2021-01-14T00:00:00Z",
    "expirationDate": "2026-01-14T00:00:00Z",
    "nameservers": ["dns1.registrar-servers.com", "dns2.registrar-servers.com"],
    "registrant": "Redacted for privacy",
    "status": ["Active", "Transfer Prohibited by Registrar"],
    "dnssec": null,
    "lastModified": null
  }
}

list_supported_tlds

列出所有可查询WHOIS服务器的顶级域名。

参数:

  • limit (number,可选):要返回的最大TLD数(默认值:全部)

示例响应:

{
  "totalCount": 877,
  "returnedCount": 10,
  "tlds": [
    "aaa",
    "aarp",
    "abarth",
    "abb",
    "abbott",
    "abbvie",
    "abc",
    "able",
    "abogado",
    "abudhabi"
  ],
  "timestamp": "2025-10-30T11:11:32.936Z"
}

refresh_whois_servers

通过从IANA获取最新的TLD列表来刷新WHOIS服务器词典。定期运行此程序,以确保服务器列表与新TLD保持同步。

示例响应:

{
  "success": true,
  "message": "WHOIS server dictionary refreshed successfully",
  "previousCount": 877,
  "currentCount": 880,
  "added": 3,
  "timestamp": "2025-10-30T11:11:32.936Z",
  "output": "Sync complete! Updated whois_dict.json"
}

WHOIS数据

服务器通过TCP端口43查询权威的WHOIS服务器,并解析响应以提取:

  • 域名:规范域名
  • 注册员:域名注册商/注册机构信息
  • 注册日期:创建、到期和最后修改日期
  • 注册人:域名所有者信息(如果可用,可能会出于隐私考虑进行编辑)
  • 管理员联系人:行政联系人(如有)
  • 技术联系人:技术联系人(如有)
  • 域名服务器:域的DNS名称服务器
  • 状态:域状态代码(活动、禁止传输等)
  • 域名系统安全扩展:DNSSEC签名状态

支持的顶级域名

服务器包括一个全面的词典(whois_dict.json)WHOIS服务器用于:

  • 通用顶级域名:.com、.net、.org、.info、.biz等。
  • 国家代码TLD:169个ccTLD,带有特定格式的解析器(.gg、.pl、.jp、.kr、.ru、.de、.it、.fr、.uk、.au、.nz、.ca等)
  • 新通用顶级域名.app、.dev、.ai、.io、.me、.ly以及数百种其他格式

解析器功能

附带的WHOIS解析器支持多种响应格式:

  • 标准格式:冒号分隔的键值对
  • .gg/.je 风格:自然语言日期(“2003年4月30日”)
  • .jp样式:方括号格式 [Domain Name] GOOGLE.JP
  • .kr风格:虚线日期 2007. 03. 02.
  • .ru风格:带有IP地址的西里尔字母字段
  • 多线段:状态块、名称服务器列表、联系人块

技术细节

建筑

  • 协议:通过Node.js的本地WHOIS(TCP端口43) net 模块
  • 解析器:基于 whois解析器 拥有169个ccTLD解析器
  • 词典:whois_dict.json,带有877+whois服务器映射
  • 更新脚本:fetch-iana-servers.js同步iana的最新顶级域名
  • 构建:可通过esbuild执行单个文件

归因

此MCP服务器使用来自以下位置的全面WHOIS解析器:

  • 仓库: https://github.com/simplebytes-com/whois-parser
  • 作者:Simple Bytes有限责任公司
  • 许可证:MIT

该解析器支持169个具有特定格式解析逻辑的国家代码顶级域名。

发展

# Clone repository
git clone https://github.com/simplebytes-com/whois-mcp.git
cd whois-mcp

# Install dependencies
npm install

# Build
npm run build

# Test locally
node build/index.js

# Test with specific domains
node test-simple.js

构建过程

构建脚本:

  1. 将源文件与esbuild捆绑在一起
  2. 为CLI执行添加shebang
  3. 将whois_dict.json和fetch-iana-servers.js复制到构建目录
  4. 生成可执行文件

更新WHOIS词典

WHOIS服务器词典可以从IANA更新:

cd src
node fetch-iana-servers.js

这将从以下位置获取最新的TLD列表https://data.iana.org/TLD/tlds-alpha-by-domain.txt并使用当前whois服务器更新whois_dict.json。

例子

示例1:.com域名(google.com)

{
  "domain": "google.com",
  "found": true,
  "server": "whois.verisign-grs.com",
  "registrar": "MarkMonitor Inc.",
  "creationDate": "1997-09-15T04:00:00Z",
  "expirationDate": "2028-09-14T04:00:00Z",
  "nameservers": ["NS1.GOOGLE.COM", "NS2.GOOGLE.COM", "NS3.GOOGLE.COM", "NS4.GOOGLE.COM"],
  "status": ["clientDeleteProhibited", "clientTransferProhibited", "clientUpdateProhibited"],
  "dnssec": "unsigned"
}

示例2:.gg ccTLD(theo.gg)

{
  "domain": "theo.gg",
  "found": true,
  "server": "whois.gg",
  "registrar": "NameCheap, Inc",
  "registrant": "Redacted for privacy",
  "creationDate": "2021-01-14T00:00:00Z",
  "expirationDate": "2026-01-14T00:00:00Z",
  "nameservers": ["dns1.registrar-servers.com", "dns2.registrar-servers.com"],
  "status": ["Active", "Transfer Prohibited by Registrar"]
}

示例3:.pl ccTLD(mineo.pl)

{
  "domain": "mineo.pl",
  "found": true,
  "server": "whois.dns.pl",
  "registrar": "Dynadot LLC",
  "creationDate": "2021.02.18 23:49:54",
  "expirationDate": "2027.02.18 23:49:54",
  "nameservers": ["josephine.ns.cloudflare.com", "kenneth.ns.cloudflare.com"],
  "dnssec": "Unsigned",
  "lastModified": "2024.09.03 13:16:45"
}

故障排除

未找到WHOIS服务器

如果您收到“找不到TLD的WHOIS服务器”,请尝试刷新词典:

Use the refresh_whois_servers tool to update from IANA

连接超时

一些WHOIS服务器有速率限制。请等待几秒钟,然后重试。默认超时为30秒。

解析问题

解析器支持169个ccTLD,但一些注册表使用独特的格式。原始WHOIS数据始终可用 include_raw: true.

许可证

麻省理工学院

相关项目

支持

  • 问题: https://github.com/simplebytes-com/whois-mcp/issues
  • 网站: https://domaindetails.com
  • 电子邮件: support@domaindetails.com