whois_lookup
Retrieve domain registration details including owner, contact information, and expiration dates to investigate website ownership and history.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to lookup WHOIS information |
Implementation Reference
- src/tools/whois.ts:14-46 (handler)The getWhois method in RdapApiClient fetches and parses WHOIS/RDAP data for a domain.
async getWhois(domain: string): Promise<WhoisResult> { try { const data = await this.fetch<any>(domain, { method: "GET", }); // RDAP response format varies significantly between registrars // This is a basic mapping, focusing on common fields const registrar = data.entities?.find((e: any) => e.roles?.includes("registrar"))?.vcardArray?.[1]?.find((v: any) => v[0] === "fn")?.[3]; const events = data.events || []; const registrationDate = events.find((e: any) => e.eventAction === "registration")?.eventDate; const expirationDate = events.find((e: any) => e.eventAction === "expiration")?.eventDate; const nameServers = data.nameservers?.map((ns: any) => ns.ldhName) || []; return WhoisResultSchema.parse({ domain, registrar: registrar || "Unknown", registrationDate, expirationDate, nameServers, status: data.status, raw: data, }); } catch (error) { if (error instanceof McpError) throw error; throw new McpError( ErrorCode.InternalError, `RDAP WHOIS error: ${(error as Error).message}` ); } } - src/index.ts:111-120 (registration)Registration of the 'whois_lookup' MCP tool in index.ts, which calls the getWhois method of the whoisClient.
server.tool( "whois_lookup", { domain: z.string().describe("Domain name to lookup WHOIS information") }, async ({ domain }) => { const result = await whoisClient.getWhois(domain); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } );