The "Stripe for AI Agents" - A multi-tenant SaaS that connects AI Agents to Shopify Merchants via UCP (Universal Commerce Protocol) and MCP (Model Context Protocol).
- Node.js 18+
- A Shopify Partner account
- A Neon database (PostgreSQL)
- Vercel account (for deployment)
cd universal-agent-gateway
npm installcp .env.example .envEdit .env with your credentials:
SHOPIFY_API_KEY- From Shopify Partners DashboardSHOPIFY_API_SECRET- From Shopify Partners DashboardDATABASE_URL- From Neon DashboardSHOPIFY_APP_URL- Your Vercel deployment URL
npx prisma generate
npx prisma db pushnpm run devThis will start the Shopify CLI development server with hot-reloading.
/universal-agent-gateway
├── prisma/
│ └── schema.prisma # Database schema (Session, MerchantProfile, Interactions)
├── app/
│ ├── db.server.ts # Neon PostgreSQL connection
│ ├── shopify.server.ts # Auth & webhook registration
│ ├── routes/
│ │ ├── app._index.tsx # Merchant Dashboard (Revenue Stats + Toggle)
│ │ ├── app.settings.tsx # Configuration (Brand Voice, Returns)
│ │ ├── app.playground.tsx # AI Chat Test Interface
│ │ ├── api.mcp.$shopId.ts # MCP Server (The "Brain")
│ │ ├── api.proxy.ucp.tsx # UCP Profile Endpoint
│ │ └── webhooks.tsx # Order attribution tracking
│ └── utils/
│ └── agent-logic.ts # Shopify GraphQL operations
├── extensions/
│ └── agent-discovery/ # Theme extension (injects <link> tag)
└── shopify.app.toml # Shopify app configuration
- Create a new app in your Partners Dashboard
- Set the App URL to your Vercel domain
- Configure the App Proxy:
- Subpath prefix:
apps - Subpath:
agent - Proxy URL:
https://your-vercel-app.com/api/proxy
- Subpath prefix:
- Set Allowed Redirection URLs:
https://your-app.vercel.app/auth/callbackhttps://your-app.vercel.app/auth/shopify/callback
vercelSet these environment variables in Vercel:
SHOPIFY_API_KEYSHOPIFY_API_SECRETSCOPESDATABASE_URLSHOPIFY_APP_URL
When an AI agent crawls a merchant's store, it finds the UCP profile at:
https://merchant-store.myshopify.com/apps/agent/.well-known/ucp
This profile describes the store's capabilities and MCP endpoint.
AI agents connect to the MCP endpoint to:
- Search products
- Get product details
- Create checkout links
- Query store policies
When a checkout is created, we inject custom attributes:
{
"_source": "universal_agent_gateway",
"_interaction_id": "uuid-here"
}When the order is placed, webhooks update our database to track the conversion.
GET /apps/agent/.well-known/ucp
Returns the Universal Commerce Protocol profile.
POST /api/mcp/:shopId
Handles MCP tool calls (JSON-RPC 2.0).
Available tools:
search_products- Search the product catalogget_product- Get product detailscreate_checkout- Create instant checkout linkget_store_info- Get store policies
POST /webhooks
Handles ORDERS_CREATE for conversion tracking.
curl https://your-dev-store.myshopify.com/apps/agent/.well-known/ucpcurl -X POST https://your-app.vercel.app/api/mcp/your-dev-store.myshopify.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'The dashboard shows:
- Total AI Revenue - Attributed sales from AI agents
- Conversations - Total agent interactions
- Conversion Rate - Checkout → Purchase ratio
- Missed Opportunities - Searches that returned no results
- All Shopify requests are authenticated via OAuth
- Access tokens are stored encrypted in Neon
- App Proxy requests are verified using HMAC
- Webhooks are validated using Shopify's signature
MIT
Built with ❤️ for the AI commerce future.