Skip to main content
Glama
badchars

osint-mcp-server

by badchars

wayback_snapshots

Retrieve historical snapshots of web pages from the Wayback Machine to analyze URL changes, view archived content, and track website evolution over time.

Instructions

Get Wayback Machine snapshot history for a specific URL. Returns timestamps, status codes, and direct archive links. Shows first/last seen dates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to get snapshot history for
limitNoMaximum snapshots to return (default: 100)

Implementation Reference

  • The logic for fetching wayback snapshots from the Wayback Machine API.
    export async function waybackSnapshots(url: string, limit = 100): Promise<WaybackSnapshotsResult> {
      await limiter.acquire();
    
      const params = new URLSearchParams({
        url,
        output: "json",
        fl: "timestamp,original,statuscode,mimetype",
        limit: String(limit),
      });
    
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
    
      try {
        const res = await fetch(`https://web.archive.org/cdx/search/cdx?${params}`, { signal: controller.signal });
        if (!res.ok) throw new Error(`Wayback CDX returned ${res.status}`);
    
        const data: string[][] = await res.json();
        const rows = data.slice(1);
    
        const snapshots: WaybackSnapshot[] = rows.map((row) => ({
          timestamp: row[0] ?? "",
          url: row[1] ?? "",
          statusCode: row[2] ?? "",
          mimeType: row[3] ?? "",
          archiveUrl: `https://web.archive.org/web/${row[0]}/${row[1]}`,
        }));
    
        const firstSeen = snapshots.length > 0 ? snapshots[0].timestamp : undefined;
        const lastSeen = snapshots.length > 0 ? snapshots[snapshots.length - 1].timestamp : undefined;
    
        return { url, totalSnapshots: snapshots.length, firstSeen, lastSeen, snapshots };
      } finally {
        clearTimeout(timeout);
      }
    }
  • Data types for the wayback snapshot results.
    interface WaybackSnapshot {
      timestamp: string;
      url: string;
      statusCode: string;
      mimeType: string;
      archiveUrl: string;
    }
    
    interface WaybackSnapshotsResult {
      url: string;
      totalSnapshots: number;
      firstSeen?: string;
      lastSeen?: string;
      snapshots: WaybackSnapshot[];
    }
  • Tool registration and definition for wayback_snapshots.
    const waybackSnapshotsTool: ToolDef = {
      name: "wayback_snapshots",
      description: "Get Wayback Machine snapshot history for a specific URL. Returns timestamps, status codes, and direct archive links. Shows first/last seen dates.",
      schema: {
        url: z.string().describe("URL to get snapshot history for"),
        limit: z.number().optional().describe("Maximum snapshots to return (default: 100)"),
      },
      execute: async (args) =>
        json(await waybackSnapshots(args.url as string, args.limit as number | undefined)),
    };

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