Developers

There are three ways to plug into Bargy: expose an MCP server, push your catalog over REST, or use Bargy's MCP servers from your own agent.

1 · Connect your MCP server

Register your MCP URL (streamable HTTP) at /merchants. Bargy will:

  1. call initialize and tools/list;
  2. pick your catalog tool (names or descriptions containing list_products, catalog, products, services, search…) and call it with empty or default arguments;
  3. read structuredContent or JSON text, find the first array of objects with name/title, and map id/sku, price (number or {amount,currency}), url, image, description, category and type (service|product);
  4. pick an order tool (place_order, create_order, book, checkout…). When a deal closes, Bargy calls it with whichever of these arguments your schema declares: product_id, quantity, customer_name, customer_email, customer_phone, discount_code, agreed_price, total, notes, reference.

Catalogs are re-indexed every day. You can also advertise your server on your homepage with <link rel="mcp" href="https://…/mcp">, and Bargy will find it from your website URL.

// Minimal catalog tool output Bargy understands
{ "products": [ { "id": "sku-1", "name": "Trail shoe", "price": { "amount": 139, "currency": "USD" },
                  "url": "https://shop.example/p/sku-1", "type": "product" } ] }

2 · Push your catalog & codes (REST)

Find your API key in Dashboard → Settings & connect.

curl -X POST https://bargy.ai/api/me/products \
  -H "Authorization: Bearer bk_YOUR_KEY" -H "content-type: application/json" \
  -d '{"items":[{"sku":"deep-clean","name":"Deep clean (3 bed)","kind":"service","price":289,
                 "url":"https://you.example/book","min_discount":10,"max_discount":25}]}'

curl -X POST https://bargy.ai/api/me/codes \
  -H "Authorization: Bearer bk_YOUR_KEY" -H "content-type: application/json" \
  -d '{"text":"SAVE10,10\nSAVE20,20\nVIP-ONCE-1,25,single"}'

Items are upserted by sku/external_id. A price of null means "on quote", and Bargy negotiates a percentage off your quote.

Webhook fulfillment

With fulfillment set to webhook, Bargy POSTs a deal.created event for each deal:

{ "type": "deal.created",
  "deal": { "id": "deal_…", "quantity": 1, "currency": "USD", "list_price": 289, "unit_price": 231.2,
            "total": 231.2, "discount_pct": 20, "code": "SAVE20", "customer_name": "…", "customer_email": "…", "notes": "…" },
  "item": { "id": "itm_…", "external_id": "deep-clean", "name": "Deep clean (3 bed)", "url": "…" } }

3 · Use Bargy from any agent

Marketplace MCP

Tools: search_deals, get_item, negotiate, accept_deal, get_deal_status. No auth. Includes ChatGPT Apps SDK widget metadata.

Per-merchant generated MCP layer

The same tools, scoped to one merchant (search_catalog instead of search_deals). Directory: /api/merchants.

Negotiation rules

Public REST

GET  /api/search?q=headphones&max_price=250&kind=product
GET  /api/items/:id
POST /api/negotiate   {"item_id":"itm_…","auto":true,"quantity":2,"buy_now":true}
POST /api/negotiate   {"negotiation_id":"neg_…","offer_price":110}
POST /api/deals       {"negotiation_id":"neg_…","customer_name":"…","customer_email":"…"}
GET  /api/deals/:id?t=TOKEN