Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 2 min read

Replacing a $1,200/yr Wheel Fitment API with a Static JSON File and an MCP Server

Last quarter I helped refactor a Shopify-backed wheel store that was paying roughly $1,200/year for a hosted vehicle fitment API. Every time a shopper selected Year -> Make -> Model in the header dropdown, the storefront

Last quarter I helped refactor a Shopify-backed wheel store that was paying roughly $1,200/year for a hosted vehicle fitment API. Every time a shopper selected Year -> Make -> Model in the header dropdown, the storefront fired three sequential HTTP requests through a proxy worker to fetch bolt patterns, center bores, and offset ranges.

Half the time, latency spiked past 600ms. Worse, whenever the third-party vendor changed rate limits or had a hiccup, the store's primary filter died.

Waitβ€”why were we calling a remote REST API over the wire for mechanical specs that never change once a car leaves the factory?

The Static Index Approach

Instead of proxying live queries, we moved the entire lookup table into a single minified JSON file served from Cloudflare's edge cache (Cache-Control: public, max-age=86400).

There are roughly 12,000–13,000 canonical passenger-car Year-Make-Model profiles from 1992 to 2026 once you strip out duplicate marketing trims (LE, SE, XLE, Touring all sharing the exact same hub). Minified and gzipped, that entire dataset is smaller than a single hero JPEG on most eCommerce homepages.

While benchmarking schemas and QA rules for this migration, I studied a client-side fitment toolkit and 12,902-vehicle dataset that follows the exact same zero-backend pattern. Its interactive calculatorsβ€”SVG offset/tire comparison, backspacing conversion, and cross-brand wheel interchangeβ€”run 100% in the browser without hitting an origin database.

Deterministic Math via MCP (Instead of Letting LLMs Guess)

The second place fitment data kept breaking was inside internal support scripts and AI coding assistants. If you ask an LLM "What is the center bore and lug seat type for a 2024 Tesla Model 3, and how much poke do I get going from 18x8.5 +40 to 19x9.5 +35?", it will cheerfully hallucinate a 66.1mm bore instead of 64.1mm, or forget the SAE +1.0" flange width when converting offset to backspacing.

That is where a lightweight Model Context Protocol (MCP) server pays off. The open-source wheelfitmentdb-mcp package exposes deterministic calculators over stdio (npx -y wheelfitmentdb-mcp):

{
  "mcpServers": {
    "wheelfitmentdb": {
      "command": "npx",
      "args": ["-y", "wheelfitmentdb-mcp"],
      "env": {
        "WHEELFITMENTDB_DATA_PATH": "/path/to/wheelfitmentdb_v2.6.json"
      }
    }
  }
}

Out of the box it runs four pure-math tools (calculate_wheel_offset_comparison, convert_offset_backspacing, convert_bolt_pattern_pcd, calculate_hub_centric_ring) plus a 50-car preview lookup. Point WHEELFITMENTDB_DATA_PATH at a local JSON file and your agent queries all 12,902 vehicles offline in microseconds.

Where This Pattern Breaks Down

Static JSON isn't a silver bullet:

  • Sub-trim brake packages: Canonical YMM rows intentionally collapse trim bloat. If your store sells 17-inch winter steelies for cars that optionally ship with Brembo big-brake kits, you still need a separate trim/brake-clearance exception table.
  • Ultra-niche regional catalogs: If 40% of your traffic drives domestic-only Japanese kei trucks or commercial medium-duty chassis, a passenger-car dataset won't cover them.
  • Cold-cache mobile loads: If you dump a multi-megabyte unminified JSON into your main JS bundle, you will wreck your LCP. Always lazy-load the minified index on dropdown focus or keep it inside a Cloudflare Worker.

For 90% of automotive eCommerce sites, though, paying recurring API rent for static 1992–2026 specs is an engineering habit worth breaking.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.