Skip to main content
Glama
price-history

price-history

by pipeworx-io
README.md
# @pipeworx/price-history

Pipeworx's own recorded history of data that only exists as history if somebody records it: GPU rental prices and Apple App Store top charts, kept as one row per change from the day recording began.

Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 2024+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

## Tools

- `price_history_feeds()` — the recorded feeds, each with its publisher, what is compared, cadence, `first_observed` (the date its history begins) and `data_as_of`.
- `price_history_latest(feed, group?, query?, limit?)` — current value of every entity in a feed, with the date each value has held since.
- `price_history_entity(feed, entity_id, limit?)` — every recorded change for one entity, oldest first, including when it entered or left the listing.
- `price_history_movers(feed, from, to?, group?, limit?)` — what moved between two dates: entities whose compared value changed (largest move first), entities that appeared, entities that left.

Every response carries `history_begins` and a `coverage_note`. History starts the day the feed's recorder first ran; nothing earlier is held and nothing is backfilled, so an absence before that date means nothing.

## Feeds (first two)

**gpu-rental** — `$/hr`, daily.
- Microsoft Azure, public retail price list: Linux pay-as-you-go ND- and NC-series GPU VMs, East US and West Europe.
- Amazon Web Services, EC2 on-demand list prices (us-east-1) for the p5, p4d, p4de, p3, g6e, g6 and g5 families, read through a public price relay.
- RunPod, GPU cloud: lowest on-demand price per GPU type.
- Vast.ai marketplace: cheapest and median rentable single-GPU offer per model (H200, H100 SXM and PCIE, A100 SXM4 and PCIE, L40S, RTX 5090, RTX 4090, RTX 3090). Marketplace figures are the cheapest listing, not a posted rate.

**appstore-charts** — chart rank, daily. Apple, App Store top free and top paid app charts, top 50, for six storefronts: US, GB, DE, JP, BR, IN (the largest English, European, Asian and Latin American markets, kept to six so the row count stays small). Apple's feed carries two app charts and no category split, so there are no category charts. A row is written when an app changes rank, enters or leaves a chart.

## How history is recorded

A recorder (`scripts/snapshot-store/record.mjs`) polls each source once a day and compares every entity with its latest stored value. It inserts a row only when the value changed, or the entity appeared or left a complete fetch. An unchanged entity writes nothing. There is no per-entity last-seen column: a run log holds one row per feed run, and an entity is considered still listed at a time T if its latest observation at or before T is a value (not a removal) and a successful run exists at or after T. A group whose fetch failed is never marked as removed, and a fetch returning under half of a group's prior entities is treated as broken, not as a market collapse.

Adding a feed is one config object plus a fetcher in `scripts/snapshot-store/feeds.mjs`. The tables (`snapshot_feeds`, `snapshot_observations`, `snapshot_runs`, function `snapshot_as_of`) do not change.

## Budget (fleet #4701)

Store: tables in the existing Supabase Postgres (migration 289). No new Cloudflare binding, no D1/KV/DO/R2 use, no per-row billing. Worst case, every one of ~600 App Store entities and ~160 GPU entities changes every day: ~760 rows/day, ~280k rows/year, ~250 bytes each, ~70 MB/year against an 8 GB plan. One-time load: $0. Steady state: $0 marginal on the database; one scheduled workflow run a day (~2 minutes of runner time). Measured on 2026-11-20: first run wrote 156 GPU rows and 547 chart rows (one of twelve charts timed out and was left untouched, not marked removed); a second run 90 seconds later wrote 13 GPU rows (RunPod stock listings appearing and leaving, Vast.ai cheapest-offer moves, one Azure SKU) out of 154 entities and 49 chart rows, all from the chart that had timed out, with the 547 unchanged chart entities writing nothing. Steady state is expected well under the worst case. Cheaper alternatives considered: R2 JSONL (no migration, but history and as-of queries need a read-modify-write per feed and a scan per question) and D1 (priced per row written, and needs a new binding on a gateway at 243 of 250). Neither meets the need more cheaply.

## Auth

Keyless. The sources are public and keyless; the recorder identifies itself with an honest User-Agent and reads each source once a day, serially.

## Data sources

- Microsoft, Azure retail price list (virtual machines).
- Amazon Web Services, EC2 on-demand list prices, via a public price relay.
- RunPod, GPU cloud public GPU-type pricing.
- Vast.ai, public marketplace listings.
- Apple, App Store top charts (Apple Marketing Tools).

The figures are the publishers' listed prices and chart positions at the time of each daily read. They are not quotes, and marketplace entries move between reads.

## Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

```json
{
  "mcpServers": {
    "price-history": {
      "url": "https://gateway.pipeworx.io/price-history/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/price-history/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.

Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:

```json
{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}
```

Both URLs reach the same gateway and the same 2024+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/price_history_feeds \
  -H 'Content-Type: application/json' \
  -d '{}'
```

No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/price_history_feeds`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.

## Run it from npm

`@pipeworx/mcp-price-history` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/price-history/mcp` endpoint shown above. It needs network access;
there is no offline mode.

```json
{
  "mcpServers": {
    "price-history": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-price-history"]
    }
  }
}
```

Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.

It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.

## Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:

```
ask_pipeworx({ question: "your question about Price History data" })
```

The gateway picks the right tool and fills the arguments automatically.

## More

- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)

## License

MIT