ecommerce-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ecommerce-mcpShow me the top 5 low-stock products"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 E-Commerce MCP Dashboard & Server
AI-Powered Analytics Dashboard + MCP Server สำหรับ E-commerce ของคุณ
ช่วยให้ AI สามารถ:
📊 ดูข้อมูล - สินค้า, คำสั่งซื้อ, คูปอง
🎮 สั่งงาน - เปลี่ยนราคา, อัพเดท stock, สร้างคูปอง
📈 วิเคราะห์ - ยอดขาย, กำไร, รายงาน
🔔 แจ้งเตือน - Stock ต่ำ, Order รออยู่
✅ ตรวจสอบการติดตั้ง
✅ Flask Server ทำงานที่ http://localhost:5000
✅ MCP Server พร้อมใช้ (โครงสร้าง JSON-RPC)
✅ Database เชื่อมต่อ: /Users/bookk/Documents/FULL_BACKUP_20260503_0050/data/shop_main.sqlite
✅ API Endpoints 20+ endpoints พร้อมใช้งาน
Related MCP server: E-commerce MCP Server
🌐 วิธีใช้งาน
บนคอมพิวเตอร์:
1. รัน Flask Server (Dashboard + REST API):
cd /Users/bookntp/Desktop/ecommerce-mcp
python3 app.py
# เปิด http://localhost:50002. เข้า Dashboard:
# Option A: ผ่าน Browser โดยตรง
http://localhost:8000/dashboard.html
# Option B: เปิด HTTP Server (ใหม่)
python3 -m http.server 8000
# แล้วเปิด http://localhost:8000/dashboard.htmlบนมือถือ (เดือก Network เดียว):
1. ดูว่า IP ของคอม: 192.168.X.X
2. เปิด Browser มือถือ: http://192.168.X.X:8000/dashboard.html🤖 ใช้งานกับ AI (MCP Server)
วิธี 1: Claude Desktop (ทำเลย!)
หา config file ของ Claude Desktop:
Mac: ~/Library/Application\ Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.jsonเปิด file และเพิ่มส่วนนี้:
{ "mcpServers": { "ecommerce": { "command": "python3", "args": ["/Users/bookntp/Desktop/ecommerce-mcp/mcp_server.py"] } } }รีสตาร์ท Claude Desktop
ตอนนี้สามารถใช้ MCP Tools ได้แล้ว!
ตัวอย่างการใช้งาน:
ผม (AI): "ช่วยดูสินค้าที่ stock ต่ำสุด 5 ชิ้น"
↓
Claude → เรียก tool: product_low_stock(threshold=5)
↓
MCP Server → Query database
↓
ผม: "พบ 3 สินค้า..."📊 ฟีเจอร์ Dashboard
KPI Cards:
💰 ยอดรวม - ยอดขายทั้งหมด
📦 คำสั่งซื้อ - จำนวนรวม
📈 กำไรสุทธิ - ผลประกอบการ
🚨 Stock ต่ำ - สินค้าต้องจัดเก็บ
รายละเอียด:
🚨 สินค้า Stock ต่ำ
📋 คำสั่งซื้อล่าสุด
⭐ ลูกค้า Top 5
🏷️ คูปองใช้ได้
🔌 API Endpoints
Read Operations (GET)
Endpoint | คำอธิบาย |
| Dashboard สรุปทั้งหมด |
| ดึงสินค้า |
| สินค้า stock ต่ำ |
| สถิติสินค้า |
| ดึงคำสั่งซื้อ |
| สถิติคำสั่งซื้อ |
| ดึงคูปอง |
| ผลใช้คูปอง |
| วิเคราะห์ยอดขาย |
| คำนวณกำไร |
| ดึงผู้ใช้ |
| ลูกค้า Top N |
| ดึงเตือน |
| รายงานขาย |
| รายงานสินค้า |
Write Operations (POST/PUT/DELETE)
Method | Endpoint | คำอธิบาย |
|
| เปลี่ยนราคา |
|
| อัพเดท Stock |
|
| ลบสินค้า |
|
| สร้างคูปอง |
|
| ลบคูปองหมดอายุ |
|
| ปิดใช้คูปอง |
|
| เปลี่ยนสถานะ Order |
|
| เปลี่ยนสถานะชำระเงิน |
|
| Backup Database |
|
| ล้าง Log เก่า |
🎮 MCP Tools
Product Tools:
product_update_price- เปลี่ยนราคาสินค้าproduct_update_stock- อัพเดท Stockproduct_delete- ลบสินค้าproduct_low_stock- ดูสินค้า Stock ต่ำ
Coupon Tools:
coupon_create- สร้างคูปองใหม่coupon_cleanup_expired- ลบคูปองหมดอายุcoupon_disable- ปิดใช้คูปอง
Order Tools:
order_update_status- เปลี่ยนสถานะ (pending/processing/shipped/delivered/cancelled)order_update_payment- เปลี่ยนสถานะชำระเงิน (unpaid/paid/refunded)
Reporting Tools:
report_sales- สรุปยอดขาย (รองรับวันที่)report_products- รายงานกำไรสินค้า
Alert Tools:
get_alerts- ดึงเตือนระบบ (Low Stock, Unpaid Orders, Expired Coupons)
Maintenance Tools:
backup_database- Backup Databasecleanup_old_logs- ล้าง Log เก่า
🛠️ ตัวอย่าง API Usage
ดึงสินค้า Stock ต่ำ:
curl http://localhost:5000/api/products/low-stock?threshold=5เปลี่ยนราคาสินค้า:
curl -X PUT http://localhost:5000/api/products/1/price \
-H "Content-Type: application/json" \
-d '{"price": 2500}'สร้างคูปองใหม่:
curl -X POST http://localhost:5000/api/coupons \
-H "Content-Type: application/json" \
-d '{
"code": "SUMMER20",
"name": "Summer Sale",
"discount_type": "PERCENTAGE",
"discount_value": 20,
"min_order": 1000,
"expiry_days": 30
}'อัพเดท Order Status:
curl -X PUT http://localhost:5000/api/orders/5/status \
-H "Content-Type: application/json" \
-d '{"status": "shipped"}'ดึงยอดขาย:
curl http://localhost:5000/api/sales/analyticsดึง Alert ระบบ:
curl http://localhost:5000/api/alerts🔄 Auto-Refresh
Dashboard จะ auto-refresh ทุก 30 วินาที เพื่อดึงข้อมูลล่าสุด
📂 Project Structure
ecommerce-mcp/
├── app.py ← Flask API Server
├── mcp_server.py ← MCP Server (สำหรับ Claude/AI)
├── database.py ← Database Connection & Queries
├── dashboard.html ← Dashboard UI
├── claude_desktop_config.json ← Config สำหรับ Claude Desktop
├── requirements.txt ← Dependencies
└── README.md ← นี่คือไฟล์นี้🚀 การรัน (อย่างละเอียด)
Step 1: รัน Flask Server
cd /Users/bookntp/Desktop/ecommerce-mcp
python3 app.py
# Output:
# * Running on http://127.0.0.1:5000
# * Running on http://192.168.0.20:5000Step 2: เข้า Dashboard (ในเทอร์มินอล/TTY ใหม่)
cd /Users/bookntp/Desktop/ecommerce-mcp
python3 -m http.server 8000
# แล้วเปิด: http://localhost:8000/dashboard.htmlStep 3: ตั้งค่า Claude Desktop (Optional)
ทำตามขั้นตอน "วิธี 1: Claude Desktop" ด้านบน
รีสตาร์ท Claude Desktop
ตอนนี้สามารถใช้ MCP Tools ได้!
⚠️ ข้อควรรู้
🔒 ไม่มี Authentication - สำหรับ Dev/Testing เท่านั้น
📡 CORS เปิด - สามารถเข้าจาก Domain ใดๆ
🗄️ SQLite ใช้ Read-Only (Dashboard) - ไม่ Edit ข้อมูล (ปลอดภัย)
✏️ Write Operations - ผ่าน API/MCP Toolsเท่านั้น
📝 Auto Backup - เมื่อใช้ tool
backup_database
🔧 Troubleshooting
Port 5000 ถูกใช้งาน:
# หาว่าใครใช้
lsof -i :5000
# ปิด process
kill -9 <PID>Dashboard ไม่โหลด:
ตรวจสอบ Flask Server กำลังรัน
ตรวจสอบ CORS ไม่ block
ดู Browser Console สำหรับ errors
MCP Tools ไม่ทำงาน:
ตรวจสอบ config file ของ Claude Desktop
ตรวจสอบ path สมบูรณ์
รีสตาร์ท Claude Desktop
📝 Notes
Database อัพเดทแบบ Real-time
Dashboard cache บน Browser แต่ refresh ทุก 30 วินาที
มี Error handling สำหรับเมื่อ API ไม่ตอบสนอง
MCP Server เปิด JSON-RPC protocol สำหรับ AI tools
💡 ไอเดียสำหรับอนาคต
🔐 Add Authentication (JWT/API Keys)
📨 Email Notifications
📞 Telegram Bot Integration
📊 Advanced Analytics & Charts
🔄 Real-time Sync ด้วย WebSocket
🗄️ Multi-database Support
สร้างโดย: Copilot (GitHub)
เวอร์ชัน: 2.0.0 (MCP Upgrade)
สุดท้ายอัพเดท: 2026-05-03
Status: ✅ Ready for Production (Dev Mode)
This server cannot be deployed
Maintenance
Related MCP Connectors
Manage your NanoCart store from any AI agent: products, orders, coupons, subscribers, reports.
Run storefronts, listings, orders, content, fulfillment, and analytics through AI.
Manage your Savanto store from your AI: catalog, content, prompts, and analytics, by chat.
An AI agent that runs your online business: products, orders, customers, email, and sites.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with WooCommerce stores through the REST API. Supports product search, order management, and e-commerce operations through natural language commands.-
- FlicenseNot gradedqualityDmaintenanceEnables management of e-commerce operations including products, customers, and orders with full CRUD capabilities, plus data analysis features like sales summaries, top products/customers reports, and inventory tracking.-
- FlicenseNot gradedqualityDmaintenanceEnables interaction with WooCommerce stores through the WordPress REST API, supporting comprehensive management of products, orders, customers, shipping, taxes, discounts, and store configuration.-
- FlicenseNot gradedqualityFmaintenanceEnables AI assistants to query and interact with Shopify store data via the Storefront API, including products, collections, carts, and customer information.9-