API & MCP
Everything a person can do on Bulk Buy Brain, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://bulkbuybrain.usefulweb.site/api/v1/calculate– run Bulk Buy BrainGET https://bulkbuybrain.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Bulk Buy Brain
Compare a small pack with a bulk pack using how fast you actually use the product, its shelf life, storage cost and the interest your money could earn. The tool computes the effective cost per unit you actually use, your saving or loss, and the largest bulk size worth buying.
| Field | Type | Default | Description |
|---|---|---|---|
currency | text | "EUR" | Currency. Shown in results only; no conversion is performed. |
unitLabel | text | "units" | Unit |
smallPrice (required) | number | 3 | Small pack price |
smallQuantity (required) | number | 1 | Small pack quantity |
bulkPrice (required) | number | 20 | Bulk pack price |
bulkQuantity (required) | number | 10 | Bulk pack quantity |
consumptionPerWeek (required) | number | 1 | You use per week |
shelfLifeWeeks | number | — | Shelf life once bought. Leave empty for non-perishables. |
storageCostPerWeek | number | 0 | Storage cost of the bulk pack. Optional: freezer energy, rented space… |
interestRatePercent | number | 3 | Interest your cash could earn |
Example request
Toilet paper: 8 rolls vs 48 rolls
curl -X POST https://bulkbuybrain.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"currency":"EUR","unitLabel":"rolls","smallPrice":3.49,"smallQuantity":8,"bulkPrice":17.99,"bulkQuantity":48,"consumptionPerWeek":3,"storageCostPerWeek":0,"interestRatePercent":3}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://bulkbuybrain.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
bulk_buy_brain - Local stdio connector:
node src/mcp-stdio.ts --tool=bulk-buy-brain
{
"mcpServers": {
"bulk-buy-brain": { "type": "http", "url": "https://bulkbuybrain.usefulweb.site/mcp" }
}
}