Maple Cart MCP

Maple Cart MCP

Enables e-commerce shopping assistant capabilities including product search, cart management, payment processing, and order fulfillment via MCP tools.

Category
访问服务器

README

Maple Cart MCP - E-Commerce Shopping Assistant

A comprehensive Model Context Protocol (MCP) server that provides a complete e-commerce solution with product search, shopping cart management, secure payment processing, and order fulfillment.

🎯 Features

  • 🔍 Product Search: Search Google Shopping (Canada) for products using SerpAPI
  • 🛒 Shopping Cart Management: Add, view, remove, and clear cart items with mandatory pricing validation
  • 💳 Secure Payment Processing: Complete Stripe integration with payment intents and hosted checkout
  • 📦 Order Management: Order status tracking and webhook automation
  • 🔒 Payment Security: Strict payment enforcement - orders only created after successful payment

🚀 Quick Start

Prerequisites

  • Node.js 18+ (ES Modules required)
  • API Keys: SerpAPI (product search) + Stripe (payments)
  • MCP Client: ChatGPT MCP App Connector , Claude Desktop, VS Code with MCP extension, or custom client

Installation

  1. Clone and Install

    git clone <repository-url>
    cd maple-cart-mcp
    npm install
    
  2. Environment Configuration

    # Create environment file
    cp .env.example .env
    
    # Required environment variables:
    SERPAPI_KEY=your_serpapi_key_here
    STRIPE_SECRET_KEY=sk_test_or_live_your_stripe_key
    STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
    
    # Optional configuration:
    NODE_ENV=development
    PORT=3000
    
  3. Start the Server

    # For MCP integration (recommended)
    npm run start:stdio
    
    # For HTTP testing and development
    npm start
    
    # Development mode with auto-restart
    npm run dev
    

MCP Client Integration

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "maple-cart": {
      "command": "node",
      "args": ["server.js", "--stdio"],
      "cwd": "/path/to/maple-cart-mcp"
    }
  }
}

🛠️ MCP Tools Reference

Core Shopping Tools

search_products

Search for products on Google Shopping (Canada)

{
  query: string;           // Search query (e.g., "iPhone 15")
  intent?: string;         // Shopping intent/purpose
  budget?: number;         // Budget limit
}

cart_add

Add products to cart with mandatory pricing validation

{
  query?: string;          // Search for lowest-priced product
  product?: {              // OR add specific product
    title: string;
    price: string;         // REQUIRED - must include price
    description?: string;
    thumbnail?: string;
    quantity?: number;
  };
  sessionId?: string;      // Optional session ID
}

cart_view

View current cart contents

{
  sessionId?: string;      // Optional session ID
}

cart_remove

Remove specific item from cart

{
  index: number;           // Item index to remove
  sessionId?: string;      // Optional session ID
}

cart_clear

Clear all items from cart

{
  sessionId?: string;      // Optional session ID
}

Enhanced Checkout Tools

checkout_create_payment_intent

Initialize payment and create pending order

{
  sessionId?: string;      // Optional session ID
  shipping?: string;       // Shipping preference
}

checkout_create_payment_url

Generate hosted Stripe checkout URL

{
  sessionId?: string;      // Optional session ID
  returnUrl?: string;      // Success return URL
  cancelUrl?: string;      // Cancel return URL
  shipping?: string;       // Shipping preference
}

checkout_order_status

Monitor order and payment status

{
  sessionId?: string;          // Optional session ID
  paymentIntentId?: string;    // Optional payment intent ID
}

checkout_complete_flow

Complete one-step checkout process

{
  sessionId?: string;      // Optional session ID
  shipping?: string;       // Shipping preference
  returnUrl?: string;      // Success return URL
  cancelUrl?: string;      // Cancel return URL
}

Order Management Tools

orders_view

View all confirmed orders

{
  sessionId?: string;      // Optional session ID
}

validate_payment_enforcement

Verify payment security and system integrity

{} // No parameters required

🛠️ Setup

  1. Install Dependencies

    npm install
    
  2. Environment Setup

    cp .env.example .env
    # Edit .env with your API keys:
    # SERPAPI_KEY=your_serpapi_key
    # STRIPE_SECRET_KEY=your_stripe_secret_key  
    # STRIPE_WEBHOOK_SECRET=your_webhook_secret
    
  3. Run Server

    # For MCP integration (stdio)
    node server.js --stdio
    
    # For HTTP testing
    node server.js
    

� Usage Examples

Complete Shopping Flow

// 1. Search for products
search_products({ 
  query: "iPhone 15 128GB", 
  intent: "personal use",
  budget: 1200 
});

// 2. Add lowest-priced product to cart (automatic pricing)
cart_add({ query: "iPhone 15 128GB" });

// OR: Add specific product with manual pricing
cart_add({ 
  product: {
    title: "iPhone 15 128GB - Blue",
    price: "$999.99",
    description: "Latest iPhone model with 128GB storage"
  }
});

// 3. Review cart
cart_view();

// 4. Complete checkout in one step
checkout_complete_flow({
  shipping: "express",
  returnUrl: "https://mystore.com/success",
  cancelUrl: "https://mystore.com/cancel"
});

// 5. Monitor order status
checkout_order_status({ paymentIntentId: "pi_1234..." });

Step-by-Step Checkout

// Step 1: Create payment intent
checkout_create_payment_intent({ shipping: "standard" });

// Step 2: Generate payment URL
checkout_create_payment_url({
  returnUrl: "https://mystore.com/success",
  cancelUrl: "https://mystore.com/cancel"
});

// Step 3: Customer completes payment via URL
// Step 4: Check payment and order status
checkout_order_status({ paymentIntentId: "pi_1234..." });

// Step 5: View confirmed orders
orders_view();

Cart Management

// Add multiple products
cart_add({ query: "wireless headphones" });
cart_add({ query: "phone case iPhone 15" });

// Remove specific item (by index)
cart_remove({ index: 0 });

// Clear entire cart
cart_clear();

// View cart anytime
cart_view();

� Project Architecture

maple-cart-mcp/
├── server.js                    # Main MCP server with all tools and HTTP endpoints
├── package.json                 # Dependencies and scripts
├── mcp.json                    # MCP configuration
├── .env.example                # Environment template
├── 
├── src/                        # Core modules
│   ├── cart.js                 # Shopping cart management (in-memory store)
│   ├── order.js                # Order lifecycle and status tracking
│   ├── payment.js              # Stripe payment processing integration
│   ├── search.js               # Product search via SerpAPI/Google Shopping
│   └── webhook.js              # Stripe webhook handling for order automation
├── 
├── README.md                   # This documentation

🧪 Testing & Development

Available Scripts

# Start MCP server (stdio mode)
npm run start:stdio

# Start HTTP server (development/testing)
npm start

# Development mode with auto-restart
npm run dev

# Production mode
npm run prod

# Validate JavaScript syntax
npm run validate

# Debug with MCP Inspector
npm run inspect

## � Configuration

### Required API Keys

| Service | Purpose | Format | Where to Get |
|---------|---------|--------|-------------|
| **SerpAPI** | Product search on Google Shopping | `your_serpapi_key_here` | [serpapi.com](https://serpapi.com) |
| **Stripe Secret** | Payment processing | `sk_test_...` or `sk_live_...` | [Stripe Dashboard](https://dashboard.stripe.com/apikeys) |
| **Stripe Webhook** | Order automation | `whsec_...` | [Stripe Webhooks](https://dashboard.stripe.com/webhooks) |

### Environment Variables
```bash
# Required
SERPAPI_KEY=your_serpapi_key_here
STRIPE_SECRET_KEY=sk_test_51ABC...
STRIPE_WEBHOOK_SECRET=whsec_123...

# Optional
NODE_ENV=development          # development | production
PORT=4000                    # HTTP server port
CORS_ORIGIN=*               # CORS allowed origins
RATE_LIMIT_WINDOW=900000    # Rate limit window (15 min)
RATE_LIMIT_MAX=100          # Max requests per window

Stripe Webhook Configuration

  1. Create Webhook Endpoint in Stripe Dashboard
  2. Endpoint URL: https://yourdomain.com/webhook
  3. Listen to Events:
    • payment_intent.succeeded
    • payment_intent.payment_failed
  4. Copy Webhook Secret to STRIPE_WEBHOOK_SECRET

Maple Cart MCP - Bringing AI-powered e-commerce to Model Context Protocol 🍁🛒

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选