Skip to main content

A WHOIS MCP server for domain availability checking

Project description

WHOIS MCP Server

PyPI version Python 3.8+ License: MIT

一个基于 Python 和模型上下文协议(MCP)实现的 WHOIS 查询服务器。提供 MCP 工具来查询域名的 WHOIS 信息。

功能特点

  • 🌐 域名 WHOIS 信息查询
  • 🔧 基于 FastMCP 框架
  • 📡 支持 Chinaz API 接口
  • 🛡️ 内置输入验证和错误处理
  • 🚀 支持多种传输协议(stdio/sse)

快速开始

安装

pip install whois-mcp-server

使用

命令行方式

# 启动 MCP 服务器
whois-mcp-server

Python 代码方式

from whois_mcp.__main__ import whois_query

# 查询域名 WHOIS 信息
result = whois_query("example.com")
print(result)

MCP 工具文档

whois_query

查询指定域名的 WHOIS 信息。

参数

  • domain (str): 要查询的域名,如 "example.com"

返回格式

{
  "code": 0,
  "message": "success",
  "data": {
    // WHOIS 查询结果
  }
}

使用示例

from whois_mcp.__main__ import whois_query

# 查询 qq.com 的 WHOIS 信息
result = whois_query("qq.com")
if result["code"] == 0:
    print("查询成功:", result["data"])
else:
    print("查询失败:", result["message"])

环境配置

API Key 设置

设置 Chinaz API Key 环境变量:

export TAVILY_API_KEY="your_api_key_here"

或在 Windows 中:

set TAVILY_API_KEY=your_api_key_here

MCP 服务器配置

在 Claude Desktop 中配置

修改您的 claude-desktop-config.json 文件:

{
  "mcpServers": {
    "whoismcp": {
      "command": "whois-mcp-server"
    }
  }
}

使用 uvx 运行

{
  "mcpServers": {
    "whoismcp": {
      "command": "uvx",
      "args": ["whois-mcp-server"]
    }
  }
}

开发

从源码安装

git clone https://github.com/your-username/whois-mcp-server.git
cd whois-mcp-server
pip install -e .

运行测试

pytest tests/

代码格式化

black whois_mcp/
flake8 whois_mcp/

项目结构

whois-mcp-server/
├── whois_mcp/
│   ├── __init__.py
│   └── __main__.py
├── tests/
│   ├── __init__.py
│   └── test_whois.py
├── pyproject.toml
├── MANIFEST.in
├── LICENSE
└── README.md

依赖项

  • Python 3.8+
  • requests>=2.25.0
  • mcp>=1.0.0
  • fastmcp>=0.1.0

许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

贡献

欢迎提交 Pull Requests 和 Issues!

在提交代码前,请确保:

  1. 代码符合 PEP 8 规范
  2. 添加适当的测试用例
  3. 更新相关文档

支持

如有问题,请通过 GitHub Issues 提交。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whois_mcp_server-0.1.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whois_mcp_server-0.1.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file whois_mcp_server-0.1.3.tar.gz.

File metadata

  • Download URL: whois_mcp_server-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for whois_mcp_server-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bb66f46875b3f0f44710c762294f2e211a29f5d8c4afb2c47012d82a33e1c5d2
MD5 3e14fe06f9325f2518a967ef58e123f1
BLAKE2b-256 6abf5146ad89a1fcb0416f5721202c5a55e1c5ee77d05c9ad713d09a44b7d65c

See more details on using hashes here.

File details

Details for the file whois_mcp_server-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for whois_mcp_server-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4cdacf122f13784392382e11a34d8988c0c270c1a762efd83378ee6425884f
MD5 1abc13752df99b555924e04229274593
BLAKE2b-256 c838b372bd3338d350b6b1983692e96eaa48df9850b2d1bf37a6fd01d5ee823c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page