get_domain_info
Retrieve domain registration, expiration, and registrant details via WHOIS lookup to monitor domain status and ensure website security.
Instructions
Get domain registration and expiration information using WHOIS lookup. Returns registrant information when available.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | The top-level domain to check (e.g., sslmon.dev) |
Implementation Reference
- src/index.ts:100-139 (handler)Core handler function that implements the tool logic: queries RDAP for domain info, falls back to WHOIS if RDAP fails, and returns formatted JSON response.private async getDomainInfo(domain: string): Promise<any> { try { // First try RDAP protocol const rdapInfo = await this.queryRDAP(domain); if (rdapInfo) { return { content: [ { type: "text", text: JSON.stringify(rdapInfo, null, 2), }, ], }; } } catch (rdapError) { console.error(`RDAP query failed for ${domain}:`, rdapError); } try { // Fallback to whois protocol const whoisInfo = await this.queryWhois(domain); return { content: [ { type: "text", text: JSON.stringify(whoisInfo, null, 2), }, ], }; } catch (whoisError) { return { content: [ { type: "text", text: `Domain info lookup failed for ${domain}: ${whoisError instanceof Error ? whoisError.message : String(whoisError)}`, }, ], }; } }
- src/index.ts:57-75 (registration)Registers the get_domain_info tool with the MCP server, providing title, description, input schema (domain: string), and a thin async handler that calls getDomainInfo with error handling."get_domain_info", { title: "Get domain info", description: "Get domain registration, expiration, and daysUntilExpiry using WHOIS/RDAP.", inputSchema: { domain: z.string().describe("The top-level domain to check (e.g., sslmon.dev)"), }, }, async ({ domain }) => { try { return await this.getDomainInfo(domain); } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true, }; } } );
- src/index.ts:14-22 (schema)TypeScript interface defining the structure of the DomainInfo object returned by the tool.interface DomainInfo { domain: string; registrationDate?: string; expirationDate?: string; registrar?: string; registrant?: string; status?: string; daysUntilExpiry?: number; }