{
  "x402Version": 2,
  "service": "dom-harvest",
  "title": "DOM Harvest & Table Grid Edge API",
  "version": "1.0.0",
  "mcpEndpoint": "https://dom-harvest.apikeg.com/mcp",
  "freeDiscovery": [
    "https://dom-harvest.apikeg.com/llms.txt",
    "https://dom-harvest.apikeg.com/llms-full.txt",
    "https://dom-harvest.apikeg.com/openapi.json",
    "https://dom-harvest.apikeg.com/.well-known/mcp.json",
    "https://dom-harvest.apikeg.com/.well-known/api-catalog"
  ],
  "resources": [
    {
      "name": "harvest_page_structures",
      "title": "Auto-Harvest Tables, Repeating Cards & Metadata",
      "url": "https://dom-harvest.apikeg.com/v1/harvest-page-structures",
      "method": "POST",
      "description": "Zero-selector structural HTML harvester: extracts canonical/OpenGraph/Twitter metadata, Schema.org JSON-LD, normalized 2D tables (resolving multi-header rowspan/colspan merges + cell links), and repeating sibling card collections across 100-500 items without truncation. Why call instead of DIY: Compresses 250KB+ noisy DOMs by >90% tokens without dropping items 21-500 or misaligning colspan/rowspan financial columns; runs deterministically in <20ms at $0.002. Pricing: $0.002 USD per HTML page structure harvest (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:8453",
          "amount": "2000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.002",
            "unitDescription": "per HTML page structure harvest",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "web-scraping",
            "data-extraction",
            "context-compression",
            "developer-tools"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "baseUrl": "https://shop.example.com/catalog",
                "includeMatrix": true,
                "minCollectionItems": 3,
                "html": "<html><head><title>Catalog</title></head><body><table><thead><tr><th rowspan='2'>Region</th><th colspan='2'>Q1 2026</th></tr><tr><th>Revenue</th><th>Growth</th></tr></thead><tbody><tr><td>NA</td><td>$1,200,000</td><td>18%</td></tr></tbody></table></body></html>"
              }
            },
            "output": {
              "type": "json",
              "summary": "Returns metadata, jsonLd, normalized tables with 'Q1 2026 / Revenue' typed numeric rows, repeatingCollections, and token-reduction metrics."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "html": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4000000,
                  "description": "Raw HTML page or fragment to tokenize and harvest into structured JSON."
                },
                "baseUrl": {
                  "type": "string",
                  "maxLength": 2048,
                  "description": "Optional origin/page URL used to resolve relative href, src, canonical, and OpenGraph URLs."
                },
                "includeMatrix": {
                  "type": "boolean",
                  "default": true,
                  "description": "Include the resolved 2D string matrix alongside typed row records on each extracted table."
                },
                "minCollectionItems": {
                  "type": "integer",
                  "default": 3,
                  "minimum": 2,
                  "maximum": 50,
                  "description": "Minimum repeating sibling cards required to emit an auto-detected repeatingCollection."
                }
              },
              "required": [
                "html"
              ],
              "additionalProperties": false
            },
            "outputSchema": {
              "type": "object",
              "required": [
                "ok",
                "data",
                "_meta"
              ],
              "properties": {
                "ok": {
                  "type": "boolean",
                  "const": true
                },
                "data": {
                  "type": "object",
                  "description": "Deterministic structured tool result payload."
                },
                "_meta": {
                  "type": "object",
                  "required": [
                    "requestId",
                    "durationMs",
                    "chargedUsd",
                    "dryRun"
                  ],
                  "properties": {
                    "requestId": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number"
                    },
                    "chargedUsd": {
                      "type": "string"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "name": "extract_by_schema",
      "title": "Extract Records by Declarative CSS Schema",
      "url": "https://dom-harvest.apikeg.com/v1/extract-by-schema",
      "method": "POST",
      "description": "Deterministic CSS-selector record extractor supporting descendant/child/attribute/group selectors, relative URL resolution against baseUrl, numeric currency/comma coercion, boolean flags, inner HTML serialization, and multi-value arrays. Why call instead of DIY: Eliminates brittle ad-hoc cheerio/regex glue code and runs identically at the Cloudflare edge in <10ms for $0.001. Pricing: $0.001 USD per declarative CSS-schema extraction (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.",
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:8453",
          "amount": "1000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x000000000000000000000000000000000000dEaD",
          "maxTimeoutSeconds": 60,
          "extra": {
            "priceUsd": "0.001",
            "unitDescription": "per declarative CSS-schema extraction",
            "dryRunQueryParam": "?dry_run=true"
          }
        }
      ],
      "extensions": {
        "bazaar": {
          "discoverable": true,
          "category": [
            "web-scraping",
            "data-extraction",
            "context-compression",
            "developer-tools"
          ],
          "info": {
            "input": {
              "type": "http",
              "method": "POST",
              "bodyType": "json",
              "example": {
                "baseUrl": "https://store.example.com/deals/",
                "itemSelector": "article.product-card",
                "fields": {
                  "sku": {
                    "selector": ":scope",
                    "attribute": "data-sku",
                    "type": "string"
                  },
                  "title": {
                    "selector": "h3.title",
                    "type": "string"
                  },
                  "url": {
                    "selector": "a.card-link",
                    "attribute": "href",
                    "type": "url"
                  },
                  "price": {
                    "selector": ".price-current",
                    "type": "number"
                  },
                  "inStock": {
                    "selector": ".badge-in-stock",
                    "type": "boolean"
                  },
                  "tags": {
                    "selector": "ul.tags > li",
                    "type": "string",
                    "multiple": true
                  }
                },
                "html": "<div class='grid'><article class='product-card' data-sku='SKU-9'><a class='card-link' href='../p/sku-9'><h3 class='title'>Pro Dock</h3></a><span class='price-current'>$189.99</span><span class='badge-in-stock'>In Stock</span><ul class='tags'><li>USB4</li><li>100W PD</li></ul></article></div>"
              }
            },
            "output": {
              "type": "json",
              "summary": "Returns 1 typed item with url='https://store.example.com/p/sku-9', price=189.99, inStock=true, tags=['USB4', '100W PD']."
            }
          },
          "schema": {
            "inputSchema": {
              "type": "object",
              "properties": {
                "html": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4000000,
                  "description": "Raw HTML page or fragment."
                },
                "baseUrl": {
                  "type": "string",
                  "maxLength": 2048,
                  "description": "Optional page URL used to resolve relative URLs when field type is 'url'."
                },
                "itemSelector": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512,
                  "description": "CSS selector matching each repeating record element (or 'body' / 'html' for single-object page extraction)."
                },
                "fields": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "selector": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 512,
                        "description": "CSS selector evaluated within each matched item element (use ':scope' to target the item element itself)."
                      },
                      "attribute": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "description": "Optional HTML attribute name to read (e.g. 'href', 'src', 'data-price'). Omit to extract text or inner HTML."
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "string",
                          "number",
                          "url",
                          "boolean",
                          "html"
                        ],
                        "default": "string",
                        "description": "Coercion type: 'string', 'number' (strips currency/commas), 'url' (resolves against baseUrl), 'boolean', or 'html'."
                      },
                      "multiple": {
                        "type": "boolean",
                        "default": false,
                        "description": "When true, extracts an array across all matching elements inside each item instead of the first match."
                      }
                    },
                    "required": [
                      "selector"
                    ],
                    "additionalProperties": false,
                    "description": "Declarative extraction rule for a single field."
                  },
                  "description": "Map of output property names to declarative CSS selector + type coercion rules."
                }
              },
              "required": [
                "html",
                "itemSelector",
                "fields"
              ],
              "additionalProperties": false
            },
            "outputSchema": {
              "type": "object",
              "required": [
                "ok",
                "data",
                "_meta"
              ],
              "properties": {
                "ok": {
                  "type": "boolean",
                  "const": true
                },
                "data": {
                  "type": "object",
                  "description": "Deterministic structured tool result payload."
                },
                "_meta": {
                  "type": "object",
                  "required": [
                    "requestId",
                    "durationMs",
                    "chargedUsd",
                    "dryRun"
                  ],
                  "properties": {
                    "requestId": {
                      "type": "string"
                    },
                    "durationMs": {
                      "type": "number"
                    },
                    "chargedUsd": {
                      "type": "string"
                    },
                    "dryRun": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  ]
}