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 엔드포인트가 필요합니다:

엔드포인트

해야 하는 일

예시

상품 검색

카탈로그를 반환하여 에이전트가 상품을 찾을 수 있게 함

GET /api/products

단일 상품 조회

실시간 재고가 포함된 단일 상품을 반환

GET /api/products/:id

주문 생성

재고를 예약하고 주문 ID를 반환

POST /api/orders

하나 더 선택 사항이 있습니다: 주문 상태 엔드포인트입니다. 설정하지 않으면 Parley는 주문 API를 재사용합니다.

필드 이름과 JSON 형태는 자유롭게 정할 수 있습니다 — 코드가 아닌 설정에서 매핑하므로 기존 엔드포인트를 Parley에 맞게 다시 작성할 필요가 없습니다.

이 API가 아직 없다면 Parley가 연결할 대상이 없습니다. Parley는 웹사이트를 스크래핑하지 않으며 데이터베이스를 직접 읽지 않습니다. 먼저 세 개의 엔드포인트를 노출한 후 아래 단계로 돌아오세요.

빠른 시작

1 · 클론

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

Node 20+ 필요

2 · 설정

cp .env.example .env.local

다음 네 가지를 설정하세요:

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

그런 다음 PRICE_UNIT을 API에 맞게 설정하세요:

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에서는 pooler 연결 문자열을 사용하세요 (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