Skip to main content
Glama
badchars

osint-mcp-server

by badchars

crtsh_search

Search Certificate Transparency logs to discover subdomains and certificate details for any domain.

Instructions

Search Certificate Transparency logs via crt.sh. Returns unique subdomains and certificate details (issuer, validity, SANs).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to search CT logs for
exclude_expiredNoExclude expired certificates (default: false)

Implementation Reference

  • The main handler function that queries crt.sh Certificate Transparency logs, deduplicates subdomains, and returns certificates with caching and rate limiting.
    export async function crtshSearch(domain: string, excludeExpired = false): Promise<CrtshResult> {
      const cacheKey = `${domain}:${excludeExpired}`;
      const cached = cache.get(cacheKey);
      if (cached) return cached;
    
      await limiter.acquire();
    
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
    
      try {
        const url = `https://crt.sh/?q=%25.${encodeURIComponent(domain)}&output=json`;
        const res = await fetch(url, { signal: controller.signal });
        if (!res.ok) throw new Error(`crt.sh returned ${res.status}`);
    
        const data: any[] = await res.json();
        const now = Date.now();
    
        // Deduplicate subdomains
        const subdomainSet = new Set<string>();
        const certificates: CrtshCert[] = [];
    
        for (const entry of data) {
          const nameValue: string = entry.name_value ?? "";
          const notAfter = entry.not_after ? new Date(entry.not_after).getTime() : Infinity;
    
          if (excludeExpired && notAfter < now) continue;
    
          // name_value can contain multiple domains separated by \n
          const names = nameValue.split("\n").map((n: string) => n.trim().toLowerCase()).filter(Boolean);
          for (const name of names) {
            if (!name.startsWith("*")) subdomainSet.add(name);
            else subdomainSet.add(name); // Keep wildcards too
          }
    
          certificates.push({
            issuer: entry.issuer_name ?? "",
            commonName: entry.common_name ?? "",
            nameValue,
            notBefore: entry.not_before ?? "",
            notAfter: entry.not_after ?? "",
            id: entry.id ?? 0,
          });
        }
    
        // Sort subdomains and limit certificates shown
        const uniqueSubdomains = [...subdomainSet].sort();
    
        const result: CrtshResult = {
          domain,
          totalCerts: data.length,
          uniqueSubdomains,
          certificates: certificates.slice(0, 50), // Limit to avoid huge responses
        };
    
        cache.set(cacheKey, result);
        return result;
      } finally {
        clearTimeout(timeout);
      }
    }
  • Type definitions for CrtshCert (certificate data) and CrtshResult (output structure with domain, totalCerts, uniqueSubdomains, certificates).
    interface CrtshCert {
      issuer: string;
      commonName: string;
      nameValue: string;
      notBefore: string;
      notAfter: string;
      id: number;
    }
    
    interface CrtshResult {
      domain: string;
      totalCerts: number;
      uniqueSubdomains: string[];
      certificates: CrtshCert[];
    }
  • Tool registration with name 'crtsh_search', description, Zod schema (domain required, exclude_expired optional), and execute handler that calls crtshSearch.
    const crtshSearchTool: ToolDef = {
      name: "crtsh_search",
      description: "Search Certificate Transparency logs via crt.sh. Returns unique subdomains and certificate details (issuer, validity, SANs).",
      schema: {
        domain: z.string().describe("Domain to search CT logs for"),
        exclude_expired: z.boolean().optional().describe("Exclude expired certificates (default: false)"),
      },
      execute: async (args) =>
        json(await crtshSearch(args.domain as string, args.exclude_expired as boolean | undefined)),
    };
  • Tool added to the master tools array for registration in the protocol layer.
    crtshSearchTool,
  • Usage of crtshSearch as a subdomain source inside the domainRecon meta-tool, called alongside other OSINT sources.
      crtshSearch(domain),
      hackertargetHostsearch(domain),
      dnsEmailSecurity(domain),
    ]);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It states the tool reads CT logs and returns unique subdomains, but omits critical behaviors: rate limits, pagination, handling of wildcard domains, or whether it queries the crt.sh API directly. The description does not disclose if expired certificates are excluded by default or other notable traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that conveys the core purpose. It is front-loaded and wastes no words, but could be improved with bullet points or more structured detail about return fields.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and two parameters, the description provides a basic understanding of return values (subdomains + certificate details) but lacks detail on output structure, pagination, or usage context like 'returns JSON array'. It is minimally viable but leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and both parameters have adequate descriptions. The description adds context about return types (subdomains, SANs) but does not further clarify parameter semantics beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as searching Certificate Transparency logs via crt.sh and specifies the return data (subdomains, certificate details). It is specific and actionable, though it does not explicitly distinguish from sibling tools like st_subdomains or censys_certificates.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidelines are provided. The description does not mention when to use this tool versus alternatives (e.g., st_dns_history for historical DNS, shodan_dns_resolve for IP resolution), nor does it specify prerequisites or contexts like 'use for passive reconnaissance'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.