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),
    ]);
Behavior3/5

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

No annotations are provided, so the description should disclose behavioral traits. It states the return content but does not mention rate limits, pagination, authentication, or other behavioral aspects. Basic behavioral coverage.

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

Conciseness5/5

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

Two sentences, front-loaded with action and source. Every sentence adds value. No extraneous text.

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

Completeness4/5

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

With a simple two-parameter tool and no output schema, the description adequately covers purpose and return details. Lacks mention of potential large result sets or pagination, but is otherwise complete.

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% for both parameters, so the schema already documents them. The description does not add additional meaning beyond what the schema provides.

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

Purpose5/5

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

The description clearly states the tool searches Certificate Transparency logs via crt.sh and returns unique subdomains and certificate details. This distinguishes it from sibling tools like censys_certificates (different source) and vt_subdomains (different focus).

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

Usage Guidelines3/5

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

The description implies usage for getting subdomains and certificate details from CT logs, but provides no explicit guidance on when to use this tool versus alternative sibling tools like st_subdomains or vt_subdomains.

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

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/badchars/osint-mcp-server'

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