Skip to main content
Glama
firesh

SSL Monitor MCP Server

by firesh

get_domain_info

Retrieve domain registration details including expiration date and remaining validity period through WHOIS/RDAP lookup for security monitoring.

Instructions

Get domain registration, expiration, and daysUntilExpiry using WHOIS/RDAP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesThe top-level domain to check (e.g., sslmon.dev)

Implementation Reference

  • Core handler function implementing the tool logic: queries RDAP for domain info, falls back to WHOIS parsing, 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)
    Tool registration including input schema validation and thin error-handling wrapper that delegates to getDomainInfo method.
      "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,
          };
        }
      }
    );
  • TypeScript interface defining the structure of domain information output used by the handler.
    interface DomainInfo {
      domain: string;
      registrationDate?: string;
      expirationDate?: string;
      registrar?: string;
      registrant?: string;
      status?: string;
      daysUntilExpiry?: number;
    }
  • Helper function to query the appropriate RDAP server for domain registration information.
    async queryRDAP(domain: string): Promise<DomainInfo | null> {
      const tld = domain.split('.').pop()?.toLowerCase();
      if (!tld) {
        throw new Error('Invalid domain format');
      }
    
      // Get RDAP bootstrap data to find the right RDAP server
      let rdapServer = await this.getRDAPServer(tld);
      if (!rdapServer) {
        return null;
      }
      if (!rdapServer.endsWith('/')) {
        rdapServer = rdapServer+'/';
      }
    
      const url = `${rdapServer}domain/${domain}`;
      console.log(`Querying RDAP server: ${url}`);
      const response = await this.httpRequest(url);
      const data = JSON.parse(response);
    
      return this.parseRDAPData(data, domain);
    }
  • Fallback helper function to query WHOIS server for domain information.
    async queryWhois(domain: string): Promise<DomainInfo> {
      const tld = domain.split('.').pop()?.toLowerCase();
      if (!tld) {
        throw new Error('Invalid domain format');
      }
    
      // Get whois server for the TLD
      const whoisServer = await this.getWhoisServer(tld);
      if (!whoisServer) {
        throw new Error(`No whois server found for TLD: ${tld}`);
      }
    
      const whoisData = await this.performWhoisQuery(domain, whoisServer);
      return this.parseWhoisData(whoisData, domain);
    }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/firesh/sslmon-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server