Skip to main content
Glama

Deploy with Vercel


アーキテクチャ

flowchart LR
    subgraph EXT [ Their AI client ]
        direction TB
        BA[Buyer agent<br/><i>Claude · ChatGPT · Gemini</i>]
    end

    subgraph PARLEY [ Your Parley deployment ]
        direction TB
        WK[".well-known/<br/>agent-commerce.json"]
        MCP["MCP endpoint<br/><b>/api/mcp</b>"]
        TOOLS["9 tools<br/><i>search · stock · order<br/>mandate · audit</i>"]
        SELLER["Seller agent<br/><i>persona + limits</i>"]
        DASH["Dashboard<br/><b>/dashboard</b>"]
        PG[("Postgres<br/>audit_log · mandates")]
    end

    subgraph STORE [ Your existing store ]
        direction TB
        API1["GET  search"]
        API2["GET  product"]
        API3["POST order"]
    end

    RZP[["Razorpay<br/>payment link"]]
    U([Customer])

    U --> BA
    BA <-->|"discovers"| WK
    BA <-->|"JSON-RPC"| MCP
    MCP --> TOOLS
    TOOLS <--> SELLER
    TOOLS -->|"read"| API1
    TOOLS -->|"read"| API2
    TOOLS -->|"write"| API3
    TOOLS -->|"log every decision"| PG
    TOOLS -->|"needs approval"| RZP
    PG --> DASH

    classDef ext fill:#1e293b,stroke:#475569,color:#e2e8f0
    classDef core fill:#0f2942,stroke:#2563eb,color:#dbeafe
    classDef store fill:#0f2e1f,stroke:#16a34a,color:#dcfce7
    classDef pay fill:#2e1f0f,stroke:#d97706,color:#fed7aa
    class BA ext
    class WK,MCP,TOOLS,SELLER,DASH,PG core
    class API1,API2,API3 store
    class RZP pay

Parleyはデータベースに書き込みを行いません。 すべての注文はお客様自身のAPIを通じて処理されます。

Related MCP server: Mercora

購入の流れ

sequenceDiagram
    autonumber
    actor C as Customer
    participant B as Buyer agent
    participant P as Parley
    participant S as Your store
    participant R as Razorpay

    C->>B: "Buy a navy tee under ₹1500"
    B->>P: search_products
    P->>S: GET search
    S-->>P: catalog
    P-->>B: normalized products

    B->>P: check_stock
    P->>S: GET product (live, never cached)
    S-->>P: stock: 8

    B->>P: create_order_and_pay
    Note over P: discount clamped in code

    P->>S: POST order
    alt Out of stock
        S-->>P: 409 out_of_stock
        P-->>B: blocked · nothing charged
    else Store is down
        S-->>P: 5xx
        P-->>B: unavailable · try again
    else Accepted
        S-->>P: order_id

        alt Mandate covers the amount
            P->>P: charge against cap
            P-->>B: completed · no human needed
        else No mandate
            P->>R: create payment link
            R-->>P: link
            P-->>B: awaiting approval
            B-->>C: pay here →
        end
    end

    P->>P: write audit_log row

始める前に

Parleyはストアを運営するものではありません。既存のストアと通信するものです。

現在オンラインでビジネスを行っているほぼすべての企業にはウェブサイトがあり、その背後には実際のAPIがあります — 自社サイトが商品一覧の表示、在庫確認、注文処理に使用しているのと同じエンドポイントです。Parleyはそれらに接続します。これが唯一の必須要件です。

必要なHTTPエンドポイントは3つです:

エンドポイント

必要な機能

例

商品検索

カタログを返し、エージェントが商品を見つけられるようにする

GET /api/products

商品詳細の取得

リアルタイム在庫を含む単一商品を返す

GET /api/products/:id

注文の作成

在庫を確保し、注文IDを返す

POST /api/orders

もう1つ任意のものがあります:注文ステータスエンドポイントです。未設定のままにすると、Parleyは注文APIを再利用します。

フィールド名とJSONの構造はお任せします — コードではなく設定でマッピングするため、既存のエンドポイントをParleyに合わせて書き直す必要はありません。

これらのAPIがまだない場合、Parleyは接続先がありません。 ウェブサイトをスクレイピングすることも、データベースを直接読み取ることもありません。まず3つのエンドポイントを公開してから、以下の手順に戻ってください。

クイックスタート

1 · クローン

git clone https://github.com/Mudavath-Giri-Naik/Parley.git
cd Parley
npm install

Node 20+ が必要です

2 · 設定

cp .env.example .env.local

次の4つを設定します:

MERCHANT_NAME="Your Store"
MERCHANT_SEARCH_API=https://yourstore.com/api/products
MERCHANT_STOCK_API=https://yourstore.com/api/products
MERCHANT_ORDER_API=https://yourstore.com/api/orders

次に、APIに合わせて PRICE_UNIT を設定します:

APIが₹1,499の商品に対して 1499 を返す場合

PRICE_UNIT=major

APIが₹1,499の商品に対して 149900 を返す場合

PRICE_UNIT=minor

→ その他はすべて:docs/CONFIGURATION.md

3 · データベースを追加

任意のPostgres。無料の Supabase または Neon で動作します。

supabase/0001_shared_schema.sql を実行します — テーブル、parley_app ロール、行レベル分離ポリシーが作成されます。検証クエリのすべての行がPASSと表示される必要があります。

PARLEY_DB_URL=postgresql://parley_app:pass@host:5432/db?sslmode=require

スーパーユーザーではなく parley_app として接続してください。スーパーユーザーは行レベルセキュリティをバイパスするため、分離レイヤーが静かに無効化されます。

Supabaseでは、プーラー接続文字列を使用してください(Project Settings → Database → Connection pooling)。直接の db.<ref>.supabase.co ホストはIPv6専用であり、ほとんどのIPv4ネットワークでは解決されません。

4 · 支払いキーを追加

Razorpayダッシュボード → Settings → API Keys から取得します。

RAZORPAY_KEY_ID=rzp_test_xxxxx
RAZORPAY_KEY_SECRET=xxxxx

5 · ローカルで実行

npm run dev

http://localhost:3000 を開いて確認します:

  • 「Configuration incomplete」警告がないこと

  • 機能カードが緑色で表示されること

  • 価格が実際のカタログと一致すること

npm run test:regression

6 · デプロイ

npx vercel --prod

⚠️ すべての変数をVercel → Settings → Environment Variablesで再入力し、再デプロイしてください。.env.local はアップロードされません。

7 · MCPリンクをコピー

デプロイしたURLを開きます。MCPエンドポイントの横にある Copy をクリックします。

https://your-project.vercel.app/api/mcp

8 · Claudeに接続

Settings → Connectors → Add custom connector → URLを貼り付け → Add。

Claudeコネクタードキュメント · ChatGPTの場合は、OpenAIのMCPドキュメント を参照 — ここでは未テストです

9 · テスト

チャットに貼り付けます:

Show me what's in stock right now, with prices.
Then check live availability for one of them.

次に /dashboard を開きます — すべての呼び出しがその推論とともに表示されます。


組み込み機能

🔒 割引上限

プロンプトではなくコードで強制されます

💳 支出上限

顧客が承認した上限内でのみ無人購入を許可します

📦 リアルタイム在庫

キャッシュされず、すべての約束の前に確認されます

📝 完全な監査証跡

すべての決定が平易な言葉の推論とともに記録されます

🔌 任意のAPI形式

フィールド名はコードではなく設定でマッピングされます

🤝 交渉

オプション、ClaudeまたはGemini経由

コマンド

npm run dev                 # local dev server
npm run build               # production build
npm run test:regression     # end-to-end suite against a live deployment
npm run check:template      # verify no merchant values leaked into source
npm run typecheck           # tsc --noEmit

プロジェクト構成

app/
  api/mcp/route.ts          MCP endpoint
  dashboard/                audit trail UI
  page.tsx                  status page + copyable MCP link
lib/
  config.ts                 all env vars, validated once
  merchantApi.ts            field mapping, envelopes, refusals
  tools/                    one file per tool
  sellerAgent.ts            negotiation
scripts/
  regression.mjs            end-to-end tests

ドキュメント

  • 設定 — すべての環境変数、注文API契約

  • 制限事項 — 既知のギャップ、デプロイ前に必読

ライセンス

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI agents to autonomously browse inventory, negotiate terms, manage carts, and execute secure payments on Shopify stores using standardized protocols. It provides a bridge for LLMs to handle the entire commerce lifecycle from discovery to order tracking through a verifiable mandate chain.
    5
    2
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to browse product catalogs and make purchases through a policy engine that enforces spending limits, requires human approval for certain amounts, and logs all actions to an audit trail.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI shopping agents to search products, check stock, apply promotions, manage cart sessions, and create cryptographically signed checkout sessions on e-commerce storefronts, while giving merchants analytics into agent intent and catalog demand gaps.
    MIT