loading…
Search for a command to run...
loading…
Enables AI to view and manage e-commerce data such as products, orders, and coupons, and perform actions like updating prices, stock, and generating sales repor
Enables AI to view and manage e-commerce data such as products, orders, and coupons, and perform actions like updating prices, stock, and generating sales reports.
AI-Powered Analytics Dashboard + MCP Server สำหรับ E-commerce ของคุณ
ช่วยให้ AI สามารถ:
✅ 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 พร้อมใช้งาน
cd /Users/bookntp/Desktop/ecommerce-mcp
python3 app.py
# เปิด http://localhost:5000
# Option A: ผ่าน Browser โดยตรง
http://localhost:8000/dashboard.html
# Option B: เปิด HTTP Server (ใหม่)
python3 -m http.server 8000
# แล้วเปิด http://localhost:8000/dashboard.html
1. ดูว่า IP ของคอม: 192.168.X.X
2. เปิด Browser มือถือ: http://192.168.X.X:8000/dashboard.html
หา 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 สินค้า..."
| Endpoint | คำอธิบาย |
|---|---|
GET /api/dashboard |
Dashboard สรุปทั้งหมด |
GET /api/products |
ดึงสินค้า |
GET /api/products/low-stock |
สินค้า stock ต่ำ |
GET /api/products/stats |
สถิติสินค้า |
GET /api/orders |
ดึงคำสั่งซื้อ |
GET /api/orders/stats |
สถิติคำสั่งซื้อ |
GET /api/coupons |
ดึงคูปอง |
GET /api/coupons/usage |
ผลใช้คูปอง |
GET /api/sales/analytics |
วิเคราะห์ยอดขาย |
GET /api/sales/profit |
คำนวณกำไร |
GET /api/users |
ดึงผู้ใช้ |
GET /api/users/top |
ลูกค้า Top N |
GET /api/alerts |
ดึงเตือน |
GET /api/reports/sales |
รายงานขาย |
GET /api/reports/products |
รายงานสินค้า |
| Method | Endpoint | คำอธิบาย |
|---|---|---|
PUT |
/api/products/<id>/price |
เปลี่ยนราคา |
PUT |
/api/products/<id>/stock |
อัพเดท Stock |
DELETE |
/api/products/<id> |
ลบสินค้า |
POST |
/api/coupons |
สร้างคูปอง |
POST |
/api/coupons/cleanup |
ลบคูปองหมดอายุ |
PUT |
/api/coupons/<id>/disable |
ปิดใช้คูปอง |
PUT |
/api/orders/<id>/status |
เปลี่ยนสถานะ Order |
PUT |
/api/orders/<id>/payment-status |
เปลี่ยนสถานะชำระเงิน |
POST |
/api/maintenance/backup |
Backup Database |
POST |
/api/maintenance/cleanup |
ล้าง Log เก่า |
product_update_price - เปลี่ยนราคาสินค้าproduct_update_stock - อัพเดท Stockproduct_delete - ลบสินค้าproduct_low_stock - ดูสินค้า Stock ต่ำcoupon_create - สร้างคูปองใหม่coupon_cleanup_expired - ลบคูปองหมดอายุcoupon_disable - ปิดใช้คูปองorder_update_status - เปลี่ยนสถานะ (pending/processing/shipped/delivered/cancelled)order_update_payment - เปลี่ยนสถานะชำระเงิน (unpaid/paid/refunded)report_sales - สรุปยอดขาย (รองรับวันที่)report_products - รายงานกำไรสินค้าget_alerts - ดึงเตือนระบบ (Low Stock, Unpaid Orders, Expired Coupons)backup_database - Backup Databasecleanup_old_logs - ล้าง Log เก่า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
}'
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
curl http://localhost:5000/api/alerts
Dashboard จะ auto-refresh ทุก 30 วินาที เพื่อดึงข้อมูลล่าสุด
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 ← นี่คือไฟล์นี้
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:5000
cd /Users/bookntp/Desktop/ecommerce-mcp
python3 -m http.server 8000
# แล้วเปิด: http://localhost:8000/dashboard.html
backup_database# หาว่าใครใช้
lsof -i :5000
# ปิด process
kill -9 <PID>
สร้างโดย: Copilot (GitHub)
เวอร์ชัน: 2.0.0 (MCP Upgrade)
สุดท้ายอัพเดท: 2026-05-03
Status: ✅ Ready for Production (Dev Mode)
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"ecommerce-mcp": {
"command": "npx",
"args": []
}
}
}