MPP Bazaar ๐ŸŒฏ

March 19, 2026 ยท View on GitHub

A food truck ordering API where AI agents browse, build a cart, and pay dynamic totals using the Machine Payments Protocol.

Why This Matters

x402 only supports static pricing โ€” every request costs the same. Real commerce needs dynamic, computed totals: combo discounts, bulk pricing, tax calculations. MPP Bazaar demonstrates this with a fun food truck API.

Agent: "I want 2 Quantum Burritos + Stack Overflow Fries + Sudo Soda"
Server: "That's \$33.00 - \$4.50 combo discount + \$2.53 tax = \$31.03"
Agent: *pays exactly \$31.03 via Tempo*
Server: "Order ORD-1001 confirmed!"

Quick Start

npm install
npm run dev
# Open http://localhost:8787 for the UI

Test with mppx CLI

# Create a testnet wallet
npx mppx account create

# Place an order (agent-style)
npx mppx http://localhost:8787/api/order \
  -X POST \
  -d '{"items":[{"id":"quantum-burrito","qty":1},{"id":"stack-fries","qty":1},{"id":"sudo-soda","qty":1}]}'

Deploy

npx wrangler deploy

API

MethodPathAuthDescription
GET/api/menuNoneFull menu with prices
POST/api/previewNonePrice breakdown without payment
POST/api/orderMPPPlace order, pay dynamic total
GET/api/orders/recentNoneLast 10 orders

Pricing Engine

The server computes every total dynamically:

  • Combo discount (15%): Order a Main + Side + Drink together
  • Bulk discount (10%): Any item with qty >= 3
  • SF Tax (8.875%): Applied after discounts

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Agent/CLI  โ”‚โ”€โ”€โ”€โ”€>โ”‚  Hono API    โ”‚โ”€โ”€โ”€โ”€>โ”‚  Pricing    โ”‚
โ”‚  (mppx)     โ”‚<โ”€โ”€โ”€โ”€โ”‚  + MPP/Tempo โ”‚<โ”€โ”€โ”€โ”€โ”‚  Engine     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Frontend   โ”‚
                    โ”‚  (vanilla)  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Stack

  • Runtime: Cloudflare Workers
  • Framework: Hono
  • Payments: mppx + Tempo (pathUSD)
  • Frontend: Vanilla HTML/CSS/JS (no frameworks)
ItemPriceCategory
Quantum Burrito$12.50Main
Neural Noodles$10.00Main
Binary Burger$14.00Main
Pixel Pizza Slice$6.00Main
Algo Tacos (3-pack)$11.00Main
Hash Browns$4.50Side
Stack Overflow Fries$5.00Side
Recursive Onion Rings$6.50Side
Sudo Soda$3.00Drink
Kernel Kombucha$5.50Drink
Null Pointer Espresso$4.00Drink
Cookie Cache$3.50Dessert

License

MIT