Skip to main content
Glama
affiliate-marketplace-mcp

affiliate-marketplace-mcp

by tody-agent

🌐 Affiliate Marketplace Connector (affiliate-marketplace-connector)

Python Version License: MIT Tests Status MCP Server Platform Video Engine

Affiliate Marketplace Connector (CLI: afflite, MCP: affiliate-marketplace-mcp) is an orchestration hub and dedicated Model Context Protocol (MCP Server) for the multi-platform affiliate marketing ecosystem (Affiliate E-Commerce Intelligence) (Shopee & TikTok Shop).

The system enables AI Agents (Antigravity, Claude Code, Cursor, Codex, OpenClaw) to fully automate the workflow:

  1. Search for Win products & cluster prices across platforms.

  2. Assess store reputation & health (Merchant Health Score).

  3. Deep-extract PDP specs & classify SKUs via the "Select options" drawer.

  4. Curate 10+ high-quality seed reviews with video/photos to drive conversion (Seed Social Proof).

  5. Generate 45s video scripts & visual prompts per Google Flow (Veo 3.1) standards.

  6. Package directly into VideoFactory project folders (AIEV / HyperFrames) with a real-time Web Preview interface.

πŸ“– See the Comprehensive Playbook: MMO Batch Automation Playbook & 5 Real-World JTBDs


🎯 5 JTBD Maps (Jobs-To-Be-Done) & 100x Automation MMO Mindset

The system is designed around 5 core problems (Jobs-To-Be-Done) for affiliate marketers and large-scale MMO operators:

JTBD

Situation & Motivation

Expected Outcome

Execution Command (afflite)

1. Hunt for Win Products

Need to find hot products with high sales volume in the fast-conversion price range (150k - 500k).

Filter out the top 5-10 products with Affiliate Win Score > 9.0 within 3 seconds.

afflite search all "<keyword>"

2. Vet Stores

Avoid stores with slow shipping, counterfeit goods, or high cancellation rates that wipe out commissions.

Only partner with stores having Seller Health Score > 85/100 and an on-time delivery rate >98%.

afflite seller [shopee|tiktok] "<shop>"

3. Extract Pain Points & Reviews

Need to write scripts that hit psychological triggers without having a sample product in hand.

Automatically deep-dive into 10-15 real reviews with video/photos, tagging pain points and reasons customers praise the product.

afflite product "<url>"

4. Mass-Produce 45s Videos

Need to cover 20-50 videos/day across a channel matrix without spending on actors or production crews.

Generate 6-scene CRO scripts with Veo 3.1 prompts and package into a VideoFactory AIEV folder.

afflite make-video "<product_id>"

5. 24/7 Multi-Agent Operations

Want the system to run autonomously in the background and scale without headcount limits.

AI Agents automatically coordinate via 9 MCP JSON-RPC 2.0 tools.

affiliate-marketplace-mcp


Related MCP server: tiktok-viral-factory

πŸ— System Architecture

graph TD
    subgraph AI Clients & Agents
        AG[Google Antigravity] 
        CC[Claude Code / Desktop]
        CR[Cursor IDE / Codex]
        VF_API[VideoFactory Web Router]
    end

    subgraph MCP Server & Orchestration Layer
        MCP[affiliate-marketplace-mcp<br/>JSON-RPC 2.0 Stdio]
        CLI[afflite CLI Orchestrator]
    end

    subgraph Core Intelligence Engines
        ShopeeEngine[Shopee Research Suite]
        TikTokEngine[TikTok Shop Suite]
    end

    subgraph Data Processing & Scorer
        SearchCluster[Search & Price Clustering]
        SellerAuditor[Merchant Health & Trust Scorer]
        PDPExtractor[Deep PDP & SKU Options Extractor]
        ReviewCurator[Seed Review & Media Curator]
    end

    subgraph Storage & Export Pipeline
        DB[(SQLite Database<br/>products.db)]
        PromptGen[AI Video Storyboard & Veo 3.1 Engine]
        VFBridge[VideoFactory AIEV Bridge]
    end

    AG -->|MCP Tools/Call| MCP
    CC -->|MCP Tools/Call| MCP
    CR -->|MCP Tools/Call| MCP
    VF_API -->|Direct Call| CLI

    MCP --> ShopeeEngine
    MCP --> TikTokEngine
    CLI --> ShopeeEngine
    CLI --> TikTokEngine

    ShopeeEngine --> SearchCluster & SellerAuditor & PDPExtractor
    TikTokEngine --> SearchCluster & SellerAuditor & PDPExtractor

    SearchCluster & SellerAuditor & PDPExtractor & ReviewCurator --> DB
    DB --> PromptGen & VFBridge
    VFBridge -->|Generate Folder| VFBundles["VideoFactory Projects (/video-projects/<slug>)<br/>β€’ meta.json β€’ index.html β€’ assets/hero.jpg β€’ transcript_tts.txt"]

⚑ 9 Native MCP Tools (tools/list)

When connecting to the affiliate-marketplace-mcp MCP server, AI Agents get direct access to 9 tools:

Tool Name

Function

Key Parameters

search_affiliate_products

Search for potential products simultaneously on Shopee & TikTok Shop, expand keywords, and score Win.

query (str), platform (all | shopee | tiktok)

audit_seller

Audit store credibility (Mall/Official), on-time delivery rate, cancellation rate, discount codes.

shop (str), platform (shopee | tiktok)

extract_product_intelligence

Extract detailed specs, 5 SKUs from the Select options drawer, and 10+ reviews with video/photo attachments.

url (str)

get_seed_reviews

Extract seed reviews classified by Pain Points & Objections to serve as social proof.

product_id (str), has_media_only (bool), limit (int)

create_videofactory_project

Create a complete VideoFactory (AIEV) project folder with standard meta.json, index.html, and a 6-scene CRO script.

product_id (str), voice_engine (VieNeu-TTS | Gemini)

generate_video_storyboard

Generate 45s AI video scripts (PAS/AIDA) with ultra-detailed image description prompts for Veo 3.1.

product_id (str)

query_marketplace_database

Query the SQLite products.db data store directly (products, variants, stores, video projects).

query_type (products | variants | reviews | shops | video_projects), limit (int)

marketplace_doctor

Comprehensively diagnose system health: SQLite database, VideoFactory engine, Chrome automation session, MCP configs.

{} (none)

marketplace_repair

Automatically repair SQLite tables, fix VideoFactory folder permissions, and sync MCP configs for AI clients.

{} (none)


πŸ“¦ Installation Guide

1. Install Source Code & CLI

# Clone repository tα»« GitHub
git clone https://github.com/tody-agent/affiliate-marketplace-connector.git
cd affiliate-marketplace-connector

# CΓ i Δ‘αΊ·t dαΊ‘ng package phΓ‘t triển (Editable Mode)
pip install -e .

After installation, the system registers the following console commands in your Terminal:

  • afflite: All-in-one CLI for multi-platform affiliate management & VideoFactory.

  • affiliate-marketplace-mcp: MCP JSON-RPC 2.0 server over Stdio.

  • shopee-cli: Dedicated CLI for Shopee Research & Cross-Audit.

  • shopee-research: Shopee scanning and extraction toolkit.

  • tiktok-research: TikTok Shop scanning and extraction toolkit.


2. Configure Environment Variables (Optional)

The system automatically uses relative paths within the source directory. To customize, you can set:

# Đường dαΊ«n file SQLite lΖ°u trα»― dα»― liệu
export AFFLITE_DB_PATH="/path/to/your/data/products.db"

# ThΖ° mα»₯c xuαΊ₯t dα»± Γ‘n VideoFactory (AIEV)
export VIDEOFACTORY_PROJECTS_DIR="/path/to/your/VideoFactory/video-projects"

3. Register the MCP Server for AI Assistants

A. For Google Antigravity CLI

Add to Antigravity's MCP config file (~/.gemini/antigravity-cli/mcp_config.json):

{
  "mcpServers": {
    "affiliate-marketplace": {
      "command": "affiliate-marketplace-mcp"
    }
  }
}

B. For Claude Desktop App

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "affiliate-marketplace": {
      "command": "affiliate-marketplace-mcp"
    }
  }
}

C. For Cursor IDE

Add to ~/.cursor/mcp.json or the Cursor Settings > MCP section:

{
  "mcpServers": {
    "affiliate-marketplace": {
      "command": "affiliate-marketplace-mcp"
    }
  }
}

πŸ’» CLI Usage Guide (afflite)

1. Search for Potential Products (search)

# QuΓ©t cαΊ£ 2 sΓ n Shopee & TikTok Shop
afflite search all "chuα»™t cΓ΄ng thΓ‘i học"

# QuΓ©t riΓͺng Shopee
afflite search shopee "bΓ n phΓ­m cΖ‘ khΓ΄ng dΓ’y"

# QuΓ©t riΓͺng TikTok Shop
afflite search tiktok "Δ‘Γ¨n rgb mini quay video"

2. Audit Store Credibility (seller)

# ThαΊ©m Δ‘α»‹nh gian hΓ ng Shopee Mall
afflite seller shopee "Ugreen Official Mall"

# ThαΊ©m Δ‘α»‹nh gian hΓ ng TikTok Shop
afflite seller tiktok "Photoolex Official Store"

3. Extract Product & Variant SKUs (product)

# Tα»± Δ‘α»™ng nhαΊ­n diện Shopee hay TikTok Shop tα»« link hoαΊ·c ID
afflite product "https://shopee.vn/product-url"
afflite product "https://www.tiktok.com/view/product/1729463065317050819"

4. Run the Full Automated Pipeline (pipeline)

# Tα»± Δ‘α»™ng bung tα»« khΓ³a -> Lọc top sαΊ£n phαΊ©m -> ThαΊ©m Δ‘α»‹nh Shop -> BΓ³c tΓ‘ch SKU & Reviews -> LΖ°u DB
afflite pipeline all "phα»₯ kiện setup gΓ³c lΓ m việc"

5. Generate Video Scripts & Integrate VideoFactory (make-video)

# XuαΊ₯t kα»‹ch bαΊ£n 6 cαΊ£nh vΓ  prompt Veo 3.1 ra mΓ n hΓ¬nh terminal
afflite video-prompt "shopee_ugreen_mouse_44426785177"

# TαΊ‘o trọn gΓ³i thΖ° mα»₯c dα»± Γ‘n VideoFactory (AIEV)
afflite make-video "tiktok_prod_1729463065317050819"

# Liệt kΓͺ danh sΓ‘ch tαΊ₯t cαΊ£ cΓ‘c dα»± Γ‘n VideoFactory Δ‘Γ£ sinh
afflite video-projects

6. Reports & Data Export (report / export)

# Xem bΓ‘o cΓ‘o tα»•ng hợp cΓ‘c sαΊ£n phαΊ©m vΓ  biαΊΏn thể trong SQLite
afflite report

# XuαΊ₯t dα»― liệu kα»‹ch bαΊ£n dαΊ‘ng Markdown hoαΊ·c JSON
afflite export "shopee_ugreen_mouse_44426785177" --format md

🐍 Using via Python Code (Programmatic API)

from afflite import (
    run_shopee_search,
    run_shopee_seller,
    run_shopee_product,
    run_tiktok_search,
    run_tiktok_seller,
    run_tiktok_product,
    generate_video_prompt_package,
    get_connection
)
from afflite.video_factory_bridge import create_videofactory_project

# 1. Tìm kiếm sản phẩm TikTok Shop
tiktok_results = run_tiktok_search("Δ‘Γ¨n rgb mini nam chΓ’m")
print(f"TΓ¬m thαΊ₯y {tiktok_results['total_found']} sαΊ£n phαΊ©m tiềm nΔƒng.")

# 2. BΓ³c tΓ‘ch sαΊ£n phαΊ©m & reviews
prod_data = run_tiktok_product("https://www.tiktok.com/view/product/1729463065317050819")
print(f"Đã lΖ°u sαΊ£n phαΊ©m: {prod_data['product_name']} (Điểm Win: {prod_data['win_potential_score']}/10)")

# 3. TαΊ‘o thΖ° mα»₯c dα»± Γ‘n VideoFactory
vf_project = create_videofactory_project(prod_data["product_id"])
print(f"Đã tẑo VideoFactory Project tẑi: {vf_project['project_path']}")
print(f"Xem preview tαΊ‘i: {vf_project['web_ui_url']}")

πŸ—„ SQLite Database Structure (products.db)

The system manages relational data following 3NF normalization standards:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        products         β”‚       β”‚          shops          β”‚
│─────────────────────────│       │─────────────────────────│
β”‚ id (PK)                 β”‚       β”‚ shop_id (PK)            β”‚
β”‚ platform (Shopee/TikTok)│◄──┐   β”‚ shop_name, username     β”‚
β”‚ shop_id (FK) ───────────┼───┼──►│ rating_star, followers  β”‚
β”‚ product_name, brand     β”‚   β”‚   β”‚ response_rate, score    β”‚
β”‚ sale_price_min, max     β”‚   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ total_sold, rating_scoreβ”‚   β”‚                β”‚
β”‚ win_potential_score     β”‚   β”‚                β–Ό
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚                β”‚   β”‚      shop_vouchers      β”‚
             β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β–Ίβ”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚
             β”‚                β”‚   β”‚ voucher_code, discount  β”‚
             β–Ό                β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    product_variants     β”‚   β”‚   β”‚     search_sessions     β”‚
│─────────────────────────│   β”‚   │─────────────────────────│
β”‚ sku_name, color, price  β”‚   β”‚   β”‚ id (PK), seed_idea      β”‚
β”‚ connectivity, status    β”‚   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚                β”‚
             β”‚                β”‚                β–Ό
             β–Ό                β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚     search_results      β”‚
β”‚     product_reviews     β”‚   β”‚   │─────────────────────────│
│─────────────────────────│   β”‚   β”‚ keyword, price_tier     β”‚
β”‚ username, rating        β”‚   β”‚   β”‚ affiliate_win_score     β”‚
β”‚ review_text, media_type β”‚   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ pain_point_tag, score   β”‚   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
             β”‚                β”‚
             β–Ό                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  ai_marketing_insights  β”‚   β”‚
│─────────────────────────│   β”‚
β”‚ target_audience, USP    β”‚   β”‚
β”‚ hook_drama, PAS, AIDA   β”‚   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
             β”‚                β”‚
             β–Ό                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚      product_media      β”‚   β”‚
│─────────────────────────│   β”‚
β”‚ source_url, local_path  β”‚β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

❓ FAQ β€” Frequently Asked Questions

Q1: What mechanism does the affiliate-marketplace-mcp MCP server run on?

The server uses the Model Context Protocol (MCP) standard over Stdio (JSON-RPC 2.0). When AI Assistants (Antigravity, Claude, Cursor) launch, the server automatically establishes a connection via standard input/output without opening any auxiliary network ports, ensuring security and millisecond-level response times.

Q2: How does the SKU variant extraction mechanism in TikTok Shop's "Select options" work?

TikTok Shop PDPs hide variants behind the interactive "Select options" drawer. The system activates a Chrome Automation session to open the drawer, decodes the price structure by each classification (Combo, Color, Power Source), and fully extracts floor/ceiling prices into the product_variants table.

Q3: What does the generated VideoFactory (AIEV) project folder include?

When running afflite make-video <product_id>, the project folder is automatically generated at /Volumes/Agency/VideoFactory/video-projects/<slug> and includes:

  • meta.json: Standard VideoFactory JSON format with 6 CRO scenes (Hook, Problem, Reveal, USP, Social Proof, CTA).

  • hyperframes.json & index.html: HTML5/CSS3 HyperFrames motion graphics structure at 1080x1920 30fps.

  • assets/hero.jpg: Sharp original product image.

  • assets/transcript_tts.txt: Vietnamese voice-over transcript with per-second timestamps for use with VieNeu-TTS / OmniVoice.

Q4: How do I change the SQLite products.db file when running on another machine?

Simply set the environment variable:

export AFFLITE_DB_PATH="/duong_dan_moi/products.db"

All CLI tools and the MCP Server will automatically point to the new path without any code changes.

Q5: What formulas are used to calculate the Affiliate Win Score and Seller Health Score?

  • Affiliate Win Score (0 - 10): Calculated based on 4 weighted factors: Verified sales count (35%), Star rating score (25%), Impulse Buy fast-conversion price range 150k-500k (20%), and Shopee Mall / Official Shop store status (20%).

  • Seller Health Score (0 - 100): Assessed based on: Average star rating (35 pts), On-time delivery rate (25 pts), Low cancellation rate under 1% (20 pts), Chat response speed & follower count (20 pts).

Q6: Is there support for video generation commands for Google Flow (Veo 3.1)?

Yes. The 6-scene scripts in video-prompt and make-video are specially designed with detailed visual prompts (Extreme close-up, 3D panning, 8k photorealistic, lighting setup) that are 100% compatible with Google Flow (gflow CLI Veo 3.1).


πŸ§ͺ Automated Testing (Unit Testing)

Run the test suite with 18 test scenarios:

python3 -m unittest discover tests

Results:

..................
----------------------------------------------------------------------
Ran 18 tests in 4.228s

OK

The project is distributed under the MIT License. Developed and maintained by tody-agent.

Available Tools

9 tools
audit_sellerA

Audit store metrics, fulfillment reliability (on-time dispatch rate, cancellation rate), seller health score (0-100), and vouchers on Shopee or TikTok Shop.

Inputs: shop (required), platform (required).

create_videofactory_projectB

Create a complete ready-to-render VideoFactory (AIEV) project folder at /Volumes/Agency/VideoFactory/video-projects/ with 6 CRO scenes, meta.json, and assets.

Inputs: product_id (required), voice_engine.

extract_product_intelligenceB

Extract full PDP specs, 5 SKU variants from 'Select options' drawer, pricing, and 10+ curated seed reviews with video/photo attachments into SQLite.

Inputs: url (required).

generate_video_storyboardB

Generate a 45s AI video storyboard with 6 structured scenes (Hook, Problem, Hero Reveal, USP, Social Proof, CTA) and Veo 3.1 visual prompts.

Inputs: product_id (required).

get_seed_reviewsA

Retrieve high-converting seed customer reviews from SQLite categorized by pain points, objections, and media attachments for video scripts.

Inputs: product_id (required), limit, has_media_only.

marketplace_doctorB

Diagnose system health across Database, VideoFactory engine, Chrome browser stream, and Multi-Agent MCP client registries.

Inputs: no named parameters.

marketplace_repairA

Automatically heal and repair SQLite tables, VideoFactory directory structures, permissions, and sync MCP configuration files across all clients.

Inputs: no named parameters.

query_marketplace_databaseB

Query local SQLite database /Volumes/Agency/Products/data/products.db to inspect products, variants, shops, or active video projects.

Inputs: limit, query_type.

search_affiliate_productsA

Search winning e-commerce products across Shopee and TikTok Shop Vietnam, expanding keywords and ranking by Affiliate Win Score.

Inputs: query (required), platform.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools target a distinct resource and action, and the descriptions make the search/extract/query pipeline fairly clear. The main ambiguity is between create_videofactory_project and generate_video_storyboard, and extract_product_intelligence vs get_seed_reviews, since both touch seed reviews/scenes.

    Naming Consistency4/5

    Most tools follow a clean snake_case verb_noun pattern (search, audit, extract, get, create, generate, query). marketplace_doctor and marketplace_repair break the pattern by leading with a domain noun instead of a verb, which is a minor consistency miss.

    Tool Count5/5

    Nine tools is within the well-scoped range and each tool earns a place in the product-research-to-video-generation workflow. The set is neither bloated nor too thin.

    Completeness4/5

    The surface covers the core lifecycle: discover product, audit seller, extract product/feedback data, query DB, generate storyboard/project, and diagnose/repair system health. Missing update/delete/publish/export operations are minor gaps since most data flows are one-way into SQLite and VideoFactory.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers