Skip to main content
Glama
badchars

osint-mcp-server

by badchars

st_dns_history

Retrieve historical DNS records for domains to analyze past configurations, identify changes, and investigate security events using SecurityTrails data.

Instructions

Get historical DNS records for a domain via SecurityTrails. Shows first/last seen dates, values, and organizations. Requires ST_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to get DNS history for
typeYesDNS record type

Implementation Reference

  • The handler function stDnsHistory in src/securitytrails/index.ts performs the actual API call to SecurityTrails and processes the response.
    export async function stDnsHistory(domain: string, type: string, apiKey: string): Promise<StDnsHistoryResult> {
      const validTypes = ["a", "aaaa", "mx", "ns", "soa", "txt"];
      const t = type.toLowerCase();
      if (!validTypes.includes(t)) throw new Error(`Invalid DNS type: ${type}. Valid: ${validTypes.join(", ")}`);
    
      const data = await stFetch(`/history/${encodeURIComponent(domain)}/dns/${t}`, apiKey);
      const records: StDnsHistoryRecord[] = (data.records ?? []).map((r: any) => ({
        values: (r.values ?? []).map((v: any) => v.ip ?? v.host ?? v.value ?? String(v)),
        type: r.type ?? t,
        firstSeen: r.first_seen ?? "",
        lastSeen: r.last_seen ?? "",
        organizations: r.organizations,
      }));
    
      return { domain, type: t, records, total: records.length };
    }
  • The st_dns_history tool definition and registration logic, including input validation schema and API key handling.
    const stDnsHistoryTool: ToolDef = {
      name: "st_dns_history",
      description: "Get historical DNS records for a domain via SecurityTrails. Shows first/last seen dates, values, and organizations. Requires ST_API_KEY.",
      schema: {
        domain: z.string().describe("Domain to get DNS history for"),
        type: z.enum(["a", "aaaa", "mx", "ns", "soa", "txt"]).describe("DNS record type"),
      },
      execute: async (args, ctx) => {
        const key = requireApiKey(ctx.config.stApiKey, "SecurityTrails", "ST_API_KEY");
        return json(await stDnsHistory(args.domain as string, args.type as string, key));
      },
    };
  • The interfaces defining the input and output structure for the DNS history records.
    interface StDnsHistoryRecord {
      values: string[];
      type: string;
      firstSeen: string;
      lastSeen: string;
      organizations?: string[];
    }
    
    interface StDnsHistoryResult {
      domain: string;
      type: string;
      records: StDnsHistoryRecord[];
      total: number;
    }

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