Parley
Enables AI agents to discover, check stock, and purchase products through your existing store APIs, with spend mandates, discount ceilings, and a full audit trail enforced in code.
README
<div align="center">
<img src="assets/banner.svg" alt="Parley — your storefront, negotiating for itself" width="100%">
<h3>Turn your store's existing APIs into an AI seller agent.</h3>
<p> <b>Browse · Negotiate · Buy.</b> Agentic commerce over MCP — with spend mandates, a discount ceiling enforced in code, live stock, and a full audit trail. Self-hosted, on your own Postgres. </p>
<p> <img alt="works with" src="https://img.shields.io/badge/works_with-2B3A52?style=flat-square"> <img alt="Claude" src="https://img.shields.io/badge/Claude-D97757?style=flat-square&logo=anthropic&logoColor=white"> <img alt="ChatGPT" src="https://img.shields.io/badge/ChatGPT-412991?style=flat-square"> <img alt="Gemini" src="https://img.shields.io/badge/Gemini-8E75B2?style=flat-square&logo=googlegemini&logoColor=white"> <img alt="any MCP client" src="https://img.shields.io/badge/any_MCP_client-6EA8FE?style=flat-square&logo=modelcontextprotocol&logoColor=0B0F16"> <br> <img alt="built with" src="https://img.shields.io/badge/built_with-2B3A52?style=flat-square"> <img alt="Next.js 15" src="https://img.shields.io/badge/Next.js_15-0B0F16?style=flat-square&logo=nextdotjs&logoColor=white"> <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white"> <img alt="Postgres" src="https://img.shields.io/badge/Postgres-4169E1?style=flat-square&logo=postgresql&logoColor=white"> <img alt="Razorpay" src="https://img.shields.io/badge/Razorpay-0C2451?style=flat-square&logo=razorpay&logoColor=white"> <img alt="Node 20+" src="https://img.shields.io/badge/Node_%E2%89%A5_20-4ADE80?style=flat-square&logo=nodedotjs&logoColor=white"> <img alt="License MIT" src="https://img.shields.io/badge/MIT-4ADE80?style=flat-square"> </p>
<sub> <a href="#before-you-start">Before you start</a> · <b><a href="#quickstart">Quickstart</a></b> · <a href="#architecture">Architecture</a> · <a href="#how-a-purchase-happens">How a purchase happens</a> · <a href="#whats-built-in">Features</a> · <a href="docs/CONFIGURATION.md">Configuration</a> · <a href="docs/LIMITATIONS.md">Limitations</a> </sub>
</div>
Architecture
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 never writes to your database. Every order goes through your own API.
How a purchase happens
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
Before you start
Parley does not run your store. It talks to the store you already have.
Almost every business online today already has a website, and behind that website are real APIs — the same endpoints your own site calls to list products, check stock and place orders. Parley plugs into those. This is the one hard requirement.
You need three HTTP endpoints:
| Endpoint | What it must do | Example |
|---|---|---|
| Search products | Return your catalog, so the agent can find items | GET /api/products |
| Get one product | Return a single product with its live stock | GET /api/products/:id |
| Create an order | Reserve the stock and return an order id | POST /api/orders |
One more is optional: an order-status endpoint. Leave it unset and Parley reuses your order API.
Field names and JSON shape are up to you — you map them in config, not in code, so no existing endpoint has to be rewritten to fit Parley.
If you do not have these APIs yet, Parley has nothing to connect to. It never scrapes your website and never reads your database directly. Expose the three endpoints first, then come back to the steps below.
Quickstart
1 · Clone
git clone https://github.com/Mudavath-Giri-Naik/Parley.git
cd Parley
npm install
Requires Node 20+
2 · Configure
cp .env.example .env.local
Set these four:
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
Then set PRICE_UNIT to match your API:
Your API returns 1499 for a ₹1,499 item |
PRICE_UNIT=major |
|---|---|
Your API returns 149900 for a ₹1,499 item |
PRICE_UNIT=minor |
→ Everything else: docs/CONFIGURATION.md
3 · Add a database
Any Postgres. Free Supabase or Neon works.
Run supabase/0001_shared_schema.sql against it — it creates the tables, a parley_app role, and the row-level isolation policies. Every row of its verification query must read PASS.
PARLEY_DB_URL=postgresql://parley_app:pass@host:5432/db?sslmode=require
Connect as
parley_app, not as a superuser. A superuser bypasses row-level security, which silently removes the isolation layer.On Supabase, use the pooler connection string (Project Settings → Database → Connection pooling). The direct
db.<ref>.supabase.cohost is IPv6-only and will not resolve on most IPv4 networks.
4 · Add payment keys
From your Razorpay dashboard → Settings → API Keys.
RAZORPAY_KEY_ID=rzp_test_xxxxx
RAZORPAY_KEY_SECRET=xxxxx
5 · Run locally
npm run dev
Open http://localhost:3000 and confirm:
- [ ] No "Configuration incomplete" warning
- [ ] Capability cards show green
- [ ] Prices match your real catalog
npm run test:regression
6 · Deploy
npx vercel --prod
⚠️ Re-enter every variable in Vercel → Settings → Environment Variables, then redeploy.
.env.localis not uploaded.
7 · Copy your MCP link
Open your deployed URL. Click Copy next to the MCP endpoint.
https://your-project.vercel.app/api/mcp
8 · Connect to Claude
Settings → Connectors → Add custom connector → paste the URL → Add.
<sub>Claude connector docs · For ChatGPT, see OpenAI's MCP docs — untested here</sub>
9 · Test it
Paste into the chat:
Show me what's in stock right now, with prices.
Then check live availability for one of them.
Then open /dashboard — every call appears with its reasoning.
What's built in
| 🔒 Discount ceiling | Enforced in code, not by the prompt |
| 💳 Spend mandates | Unattended purchases only within a customer-authorized cap |
| 📦 Live stock | Never cached, checked before every promise |
| 📝 Full audit trail | Every decision logged with plain-language reasoning |
| 🔌 Any API shape | Field names mapped via config, not code |
| 🤝 Negotiation | Optional, via Claude or Gemini |
Commands
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
Project layout
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
Docs
- Configuration — every env var, the order API contract
- Limitations — known gaps, read before deploying
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。