sha256: 2decc01b588a91aca68dd53095ab5b686824ed49c26406a979eb9958125c50e8
fulcrum: "1.0"
name: wayback_save
description: |
  Capture a URL into the Internet Archive Wayback Machine via the authenticated
  "Save Page Now" (SPN2) endpoint (POST https://web.archive.org/save/{url}).
  Triggers a fresh archival crawl. Use at URL-triage time for link-rot
  prophylaxis and to lock durable, timestamped evidence of a source before it
  changes or disappears.

  Requires an IA S3 credential (IA_S3_AUTH env var) — IA retired anonymous
  saving in 2024 (GET /save/<url> now 404s, unauthenticated POST returns 401).
  The save is asynchronous: a 200 (isError=false) means the crawl was queued.
  Confirm the durable snapshot URL + timestamp with wayback_availability
  (allow ~1-2 min for the capture to register).

schema:
  input:
    type: object
    properties:
      url:
        type: string
        description: The fully-qualified URL to capture (include the scheme)
        examples: ["https://arxiv.org/abs/2401.00001", "https://news.ycombinator.com/item?id=1"]
    required:
      - url
  output:
    type: object
    description: >
      Empty object on a 200 (the path-style SPN2 endpoint accepts the capture
      without a JSON body). isError=false means the crawl was queued; confirm
      the snapshot with wayback_availability.

providers:
  primary:
    service: rest
    cost_per_call: 0
    timeout: 60
    config:
      base_url: https://web.archive.org
      path: /save/{url}
      method: POST
      headers:
        Accept: "application/json"
        User-Agent: "mcp-gateway-knowledge/1.0"

cache:
  strategy: none  # each save is a fresh capture; never cache

auth:
  required: true
  type: api_key
  key: "env:IA_S3_AUTH"
  header: Authorization
  description: >
    Internet Archive locked anonymous Save Page Now in 2024. SPN2 requires an
    S3-style credential. Set IA_S3_AUTH to the literal Authorization value
    "LOW <accesskey>:<secret>". Keys: 1Password "Claude Elite" ->
    "Internet Archive S3 Keys" (username=accesskey, credential=secret).
    Provisioned (export-prefixed) into ~/.claude/secrets.env, the gateway env_file.

metadata:
  category: knowledge
  tags: [wayback, internet-archive, archive, save-page-now, spn2, evidence, link-rot]
  cost_category: free
  execution_time: slow
  read_only: false
  consumes: [url]
  produces: [capture_accepted]
  docs: "https://archive.org/help/wayback_api.php"
  license: "Public API; SPN2 save requires an IA S3 credential"
  rate_limit: "~30/min with IA S3 keys"
