Shopify Agentic MCP Gateway
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.
README
<div align="center">
Shopify Agentic MCP Gateway
The first tri-protocol commerce gateway for autonomous AI agents on Shopify.
Let AI agents browse, negotiate, cart, pay, and track orders -- fully autonomously.
</div>
Why This Exists
AI agents are learning to shop. But today, there is no standard way for an agent to discover a merchant's capabilities, negotiate terms, build a cart, authorize payment, and complete a purchase -- all without a human clicking buttons.
Shopify Agentic MCP Gateway solves this by implementing three emerging protocols in a single, deployable gateway:
| Protocol | Role | What It Does |
|---|---|---|
| UCP (Universal Commerce Protocol) | Discovery + Capabilities | Agents discover your store at /.well-known/ucp, negotiate capabilities, and interact via a standard shopping service API |
| AP2 (Agent Payment Protocol) | Authorization + Security | Three-mandate signature chain (Intent, Cart, Payment) ensures agents can only spend what the user authorized |
| MCP (Model Context Protocol) | Agent Interface | Five tool registrations that Claude, GPT, and other LLM agents call directly via stdio or HTTP transport |
Features
- 5 MCP Tools --
scout_inventory,manage_cart,negotiate_terms,execute_checkout,track_order - UCP Profile Discovery --
/.well-known/ucpendpoint with capability negotiation and transport advertisement - AP2 Mandate Chain -- Cryptographic ES256 signature chain (Intent -> Cart -> Payment) with full verification
- Guardrails -- AI hallucination guard validates prices, inventory, mandate amounts, and checkout state transitions
- Fee Collection -- Automatic platform fee calculation (configurable rate) with ledger tracking
- Checkout State Machine -- Three-state machine (
incomplete->requires_escalation->ready_for_complete) with auto-detection - Dual Runtime -- Runs locally as stdio MCP server for Claude Desktop, or deploys to AWS Lambda with API Gateway
- DynamoDB-Ready -- In-memory stores with annotated DynamoDB migration paths for mandates, sessions, and ledger
Quick Start
Prerequisites
- Node.js >= 22.0.0
- A Shopify store with Storefront API access
- (Optional) AWS account for Lambda deployment
1. Install
git clone https://github.com/kuro-tomo/shopify-agentic-mcp.git
cd shopify-agentic-mcp
npm install
2. Configure
cp .env.example .env
Edit .env with your Shopify credentials:
SHOPIFY_STORE_DOMAIN=your-store.myshopify.com
SHOPIFY_STOREFRONT_TOKEN=your_storefront_token
SHOPIFY_ACCESS_TOKEN=your_access_token
SHOPIFY_API_KEY=your_api_key
SHOPIFY_API_SECRET=your_api_secret
3. Build and Run
npm run build
npm start
The MCP server starts in stdio mode, ready for Claude Desktop or any MCP client.
4. Connect to Claude Desktop
Add this to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"shopify-agentic": {
"command": "node",
"args": ["/absolute/path/to/shopify-agentic-mcp/dist/index.js"],
"env": {
"SHOPIFY_STORE_DOMAIN": "your-store.myshopify.com",
"SHOPIFY_STOREFRONT_TOKEN": "your_token"
}
}
}
}
Now ask Claude: "Search for wireless headphones under $50 and add the best one to my cart."
Architecture
+------------------+
| AI Agent |
| (Claude / GPT) |
+--------+---------+
|
MCP (stdio / HTTP)
|
+--------v---------+
| MCP Server |
| 5 Tool Handlers |
+--------+---------+
|
+--------------------+--------------------+
| | |
+--------v-------+ +--------v--------+ +---------v--------+
| UCP Layer | | AP2 Layer | | Middleware |
| - Profile | | - Signer | | - Guardrail |
| - Negotiate | | - Verifier | | - Fee Collector |
| - Checkout SM | | - Mandate Store | | - Rate Limiter |
| - Discovery | | | | - Auth |
+--------+--------+ +-----------------+ +------------------+
|
+--------v--------+
| Shopify APIs |
| - Storefront GQL |
| - Admin REST |
+------------------+
Tool Reference
| Tool | Description | Key Parameters |
|---|---|---|
scout_inventory |
Search the Shopify catalog for products | query (string), category?, price_min?, price_max?, limit? |
manage_cart |
Create, modify, or retrieve a shopping cart | action (create/add/remove/get), cart_id?, variant_id?, quantity? |
negotiate_terms |
Negotiate capabilities, discounts, and shipping between agent and merchant | cart_id (string), agent_profile_url (string), discount_code? |
execute_checkout |
Complete a purchase with AP2 mandate chain verification | checkout_id, intent_mandate, cart_mandate, payment_mandate |
track_order |
Retrieve order status and fulfillment tracking | order_id (string) |
All prices are in minor units (cents). A $29.99 product has price: 2999.
Environment Variables
| Variable | Required | Description |
|---|---|---|
SHOPIFY_STORE_DOMAIN |
Yes | Your Shopify store domain (e.g., store.myshopify.com) |
SHOPIFY_STOREFRONT_TOKEN |
Yes | Storefront API access token |
SHOPIFY_ACCESS_TOKEN |
Yes | Admin API access token |
SHOPIFY_API_KEY |
Yes | Shopify app API key |
SHOPIFY_API_SECRET |
Yes | Shopify app API secret |
AP2_SIGNING_PRIVATE_KEY |
Yes | ES256 private key in JWK format for mandate signing |
AP2_VERIFICATION_PUBLIC_KEY |
No | ES256 public key in JWK format (defaults to deriving from private key) |
GATEWAY_BASE_URL |
No | Public gateway URL (default: http://localhost:3000) |
FEE_RATE |
No | Platform fee rate as decimal (default: 0.005 = 0.5%) |
FEE_WALLET_ADDRESS |
No | Wallet address for fee collection |
LOG_LEVEL |
No | Logging level (default: info) |
Deployment
AWS Lambda (Serverless)
npm run build
npm run deploy
This deploys via the Serverless Framework with:
- Runtime: Node.js 22.x on ARM64 (Graviton2)
- Routes:
/.well-known/ucp(GET),/ucp/v1/*(ANY),/mcp(POST),/a2a(POST) - DynamoDB: Three tables auto-provisioned (mandates, ledger, sessions) with PAY_PER_REQUEST billing
See docs/deployment.md for the full deployment guide.
Documentation
| Document | Description |
|---|---|
| Architecture | System architecture, component responsibilities, data flow |
| UCP Integration | Profile discovery, capability negotiation, checkout state machine |
| AP2 Mandates | Mandate types, signature chain, verification process |
| Deployment Guide | AWS Lambda setup, CloudFront, monitoring |
| Developer Kit | Pricing, support, what's included |
Examples
examples/claude-desktop.json-- Claude Desktop MCP configurationexamples/autonomous-purchase.ts-- Full autonomous purchase flowexamples/mandate-flow.ts-- AP2 mandate generation and verification
License
MIT License. See LICENSE for details.
<div align="center">
Built for the agentic commerce era.
Documentation | Examples | Issues
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。