Skip to main content

Drop-in negotiate.v1 backend for any storefront. Ships the chat agent, discovery files, and rate limiting; you bring the catalog.

Project description

pier39-merchant-server

Drop-in negotiate.v1 backend for any storefront. You bring a catalog.json. The library brings the chat agent, the discovery files, and the rate limiting. Six lines and your store is negotiable by any AI shopper that speaks the protocol.

Install

pip install pier39-merchant-server

You also need pier39-merchant skill installed somewhere the library can find it:

git clone https://github.com/sanjana-pier39/pier39-skills
mkdir -p ~/.claude/skills
cp -R pier39-skills/plugins/pier39/skills/pier39-merchant ~/.claude/skills/

(The library auto-discovers the skill at ~/.claude/skills/pier39-merchant/. Override with PIER39_MERCHANT_SKILL_PATH env var or pass skill_path= directly.)

Use

Six lines, including the import:

from pier39_merchant_server import serve

serve(catalog_path="catalog.json", host="0.0.0.0", port=8000)

That gives you, on http://0.0.0.0:8000:

Path Method Purpose
/negotiate.json + /.well-known/negotiate.json GET negotiate.v1 protocol descriptor
/llms.txt GET AI-readable site index
/api/store/catalog GET Public product catalog (hidden fields stripped)
/api/store/chat/start?product_id=<id> GET Open chat session
/api/store/chat/<sid>/say?message=<urlencoded> GET Send shopper turn
/api/store/chat/<sid> GET Read running history
/api/store/chat/start POST Same as GET, for browser widgets
/api/store/chat/<sid>/message POST Same as GET, for browser widgets
/api/health GET Liveness check

All public, all CORS-permissive (Access-Control-Allow-Origin: *).

Catalog format

A catalog.json looks like this — see examples/tiny_store/catalog.json for a working minimal example:

{
  "store": {
    "name": "Your Store",
    "city": "City, ST",
    "rep_name": "Casey",
    "tagline": "...",
    "policy_default": "Free shipping. 30-day return. ..."
  },
  "products": [
    {
      "id": "widget-pro",
      "kind": "widget",
      "name": "Widget Pro",
      "subtitle": "Short product line",
      "description": "Long description (model, accessories, etc.)",
      "year_made": 2024,
      "condition": "Brand new",
      "list_price": 199,

      "floor": 165,
      "levers": [
        "Free expedited shipping (~$15 retail value)",
        "Bonus accessory kit ($29 retail)",
        "Extended warranty (12 → 24 months)"
      ],
      "inventory_note": "..."
    }
  ]
}

The floor, levers, and inventory_note fields are hidden — they appear only in the merchant agent's private system prompt, never in any GET response. The library's /api/store/catalog endpoint strips them automatically.

Deeper control

If you need to customize, instantiate MerchantApp directly:

from pier39_merchant_server import MerchantApp

app = MerchantApp(
    catalog_path="catalog.json",
    skill_path="/custom/path/to/pier39-merchant",
    model="claude-opus-4-6",                    # default: claude-sonnet-4-6
    max_chat_starts_per_hour_per_ip=20,         # default: 8
    max_messages_per_chat=50,                   # default: 30
    max_message_length=3000,                    # default: 2000
    session_idle_ttl_seconds=7200,              # default: 3600 (1h)
)
app.run(host="0.0.0.0", port=8000)

You can also pull app.make_handler_class() and mount it under your own ThreadingHTTPServer / nginx / wsgi setup if you have an existing stack.

Required env vars

  • ANTHROPIC_API_KEY — for the merchant chat agent
  • PIER39_MERCHANT_SKILL_PATH (optional) — override skill auto-discovery

What you get for free

Any AI shopper agent that speaks negotiate.v1 can now negotiate at your store with no further coordination. The Pier39 MCP connector is one such shopper — install it in Claude Desktop and you can immediately negotiate at any negotiate.v1 storefront.

See also

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pier39_merchant_server-0.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pier39_merchant_server-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pier39_merchant_server-0.1.0.tar.gz.

File metadata

  • Download URL: pier39_merchant_server-0.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pier39_merchant_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74490630222394ebd98d327171f93bcccfda16aaaedf5c52cd29a35ef14180b4
MD5 97c5ca640228cbcbd0a2e69778cb27f6
BLAKE2b-256 eca0ec04a7b546a1801aaba73b95c826dce7be5833bad1dd034213926bf574bf

See more details on using hashes here.

File details

Details for the file pier39_merchant_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pier39_merchant_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68468c895f212b6ceba0b02e198fb36e625fc4d8a05ba790c6032d464577abab
MD5 44eb8602945e22174855ff8301225f21
BLAKE2b-256 bdcfb09ece18aa89bcb4e60fb06bb10fc16b54a5e605d7a49a35d49f8a843bc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page