Shopee MCP Server

Shopee MCP Server

Enables AI agents to automate product listing on Shopee via the Shopee Open Platform API, including OAuth2 authentication, product creation, image upload, and category lookup, with a mock mode for testing.

Category
Visit Server

README

🤖 Hermes-Agent-Shopee (Notion to BigSeller Excel Auto Sync Bot)

Hệ thống tự động hóa đồng bộ sản phẩm từ Notion Database sang BigSeller Excel bằng AI thế hệ mới, tích hợp Telegram Bot cảnh báo thời gian thực và cơ chế hoạt động bền bỉ (resiliency) cấp chuyên nghiệp.


🧭 Luồng Làm Việc Của Hệ Thống (Workflow)

Hệ thống hoạt động theo mô hình khép kín tự động hóa giữa Notion, Google Drive, AI API, BigSeller Excel và Telegram:

graph TD
    A[Nhân viên Content] -- Chuẩn bị mô tả & ảnh --> B[Notion Database]
    B -- Tích chọn 'Bài viết' = True --> C{Bot Quét Ngầm Notion}
    C -- 2 phút/lần: Phát hiện bài mới --> D[Cảnh báo Telegram Quản lý]
    
    E[Quản lý gửi lệnh /sync] --> F[Notion Sync Module]
    F -- Đọc dữ liệu sản phẩm --> G[Google Drive Image Converter]
    G -- Lấy Direct Link Ảnh --> H[AI Generator: OpenAI/Gemini]
    H -- Viết bài chuẩn SEO theo Insight --> I[Tách biến thể & Tạo Excel BigSeller]
    I -- Tải lên Telegram & Trả file --> J[Người Quản lý tải về]
    J -- Cập nhật Notion: Trạng thái đăng shopee = True --> K[Ghi log Nội dung đăng dạng chunk]
    J -- Tự động xóa file Excel tạm cục bộ --> L[Dọn dẹp đĩa cứng]

Chi tiết các bước xử lý:

  1. Quét ngầm & Cảnh báo: Luồng quét ngầm định kỳ chạy mỗi 2 phút. Nếu có sản phẩm mới (có tên, ô Bài viết đã tích, ô Trạng thái đăng shopee chưa tích), bot sẽ gửi thông báo: "Shopee MCP Server xin thông báo: CÓ SẢN PHẨM MỚI CHỜ ĐĂNG SHOPEE!" tới Quản lý.
  2. Kích hoạt đồng bộ: Quản lý gửi tin nhắn /sync qua Telegram. Bot tiến hành tải dữ liệu Notion của các sản phẩm thỏa mãn điều kiện.
  3. Xử lý hình ảnh: Link thư mục Google Drive của sản phẩm được phân tích tự động, chuyển đổi toàn bộ ảnh bên trong thành link download trực tiếp (Direct Link) tương thích với Shopee CDN.
  4. Sinh bài viết bằng AI: Đối với mỗi dòng Insight trong cột Insight Library, AI (tự động nhận diện Gemini hoặc OpenAI) sẽ sinh một phiên bản tiêu đề và mô tả sản phẩm chuẩn SEO marketing chuyên nghiệp, bám sát insight khách hàng và tự động dọn dẹp các từ khóa bị Shopee VN cấm (đặc trị, dứt điểm, tốt nhất...).
  5. Xuất bản Excel: Tách phân loại giá từ cột Biến thể & giá, tạo SKU phụ tương ứng, để trống cột SKU sản phẩm (SKU cha) theo tiêu chuẩn BigSeller và xuất file Excel.
  6. Báo cáo & Dọn dẹp: Gửi file Excel qua Telegram, cập nhật cột Nội dung đăng và tích chọn Trạng thái đăng shopee = True trên Notion. Đồng thời xóa file Excel tạm trong thư mục output/ để bảo vệ tài nguyên máy chủ.

✨ Tính Năng Nổi Bật

  • Tự động hóa hoàn toàn: Chuyển đổi dữ liệu thô từ Notion thành file Excel BigSeller sẵn sàng import lên sàn Shopee.
  • AI Copywriter Đa Năng: Hỗ trợ tự động nhận diện cả OpenAI API Key (sk-...) và Gemini API Key (AIzaSy...) để tối ưu hóa chi phí và hiệu năng.
  • Resilience & Auto-Reconnect (Chống treo cấp độ dịch vụ):
    • Socket Timeout: Cấu hình mặc định 30 giây tránh treo socket mạng khi truyền tải dữ liệu lớn.
    • Notion API Retry: Bọc toàn bộ các cuộc gọi API Notion bằng thuật toán thử lại tự động (Exponential Backoff) nếu gặp lỗi quá tải hoặc rớt mạng tạm thời.
    • Bot Watchdog: Theo dõi và hồi sinh tự động thread quét Notion ngầm nếu luồng này bị crash đột ngột.
    • Infinity Polling: Giúp bot Telegram liên tục kết nối lại khi internet không ổn định.

📋 Cấu Trúc Bảng Notion (Database Schema)

Để bot hoạt động chính xác, bảng Notion của bạn cần cấu hình tối thiểu các cột sau:

Tên Cột Notion Kiểu Dữ Liệu Vai Trò
Tên sản phẩm Title (Mặc định) Tên gốc của sản phẩm cần xử lý
Bài viết Checkbox Content tích chọn khi chuẩn bị xong hình ảnh/mô tả thô
Trạng thái đăng shopee Checkbox Bot tích chọn True sau khi đã xuất Excel thành công
Insight Library Relation hoặc Rich text Chứa các insight đối tượng mục tiêu để AI viết bài chuẩn xác
Biến thể & giá Rich text Định dạng giá đơn lẻ (90.000) hoặc biến thể (Hộp 30v: 90.000 | Hộp 60v: 170.000)
Media sản phẩm URL Đường link thư mục Google Drive chứa hình ảnh sản phẩm
Nội dung đăng Rich text Bot tự động ghi đè bản tóm tắt bài viết AI sinh ra (giới hạn < 2000 kí tự/chunk)

🛠️ Yêu Cầu Hệ Thống & Cài Đặt

1. Yêu cầu hệ thống:

  • Python 3.10 trở lên.
  • Cài đặt thư viện dependencies:
    pip install -r requirements.txt
    

2. Thiết lập Biến môi trường (.env):

Tạo file .env tại thư mục gốc của dự án và cấu hình đầy đủ các biến sau:

# Notion Credentials
NOTION_TOKEN=secret_your_notion_token_here
NOTION_DATABASE_ID=your_notion_database_page_id_here

# Telegram Bot Credentials
TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ
MANAGER_CHAT_ID=6295080195  # Chat ID nhận cảnh báo sản phẩm mới

# AI API Credentials (Hỗ trợ OpenAI sk- hoặc Gemini AIzaSy)
GEMINI_API_KEY=your_openai_or_gemini_api_key_here

3. Khởi chạy hệ thống:

Sử dụng script khởi chạy nhanh trên Windows (sử dụng đường dẫn tương đối):

# Chạy file batch
start_bot.bat

# Hoặc khởi chạy trực tiếp bằng python
python -m src.telegram_bot

📦 Kiến Trúc Thư Mục Dự Án

shopee-mcp-server/
├── src/
│   ├── __init__.py
│   ├── config.py             # Quản lý cấu hình & đọc biến môi trường
│   ├── telegram_bot.py       # Bot Telegram chính, điều hướng & chạy quét ngầm
│   ├── notion_sync.py        # Module xử lý dữ liệu và đồng bộ Notion
│   ├── ai_generator.py       # Kết nối OpenAI / Gemini sinh content chuẩn SEO
│   ├── convert_zicum.py      # Module cào ảnh Google Drive sang direct link
│   └── notion_to_bigseller.py# Hàm phụ trợ xuất file excel cấu trúc BigSeller
├── import_template_VN.xlsx   # File template mẫu gốc của BigSeller
├── requirements.txt          # Các thư viện phụ thuộc
├── start_bot.bat             # File script chạy nhanh trên Windows
└── README.md                 # Tài liệu hướng dẫn sử dụng

🛡️ Bản Quyền & Giấy Phép

Dự án được phát triển nhằm phục vụ tự động hóa quy trình quản lý của hệ thống Hermes Agent. Nghiêm cấm chia sẻ file cấu hình .env chứa API Token nhạy cảm lên các kho lưu trữ công cộng.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured