ecomcp / docs /QUICKSTART_REFINED.md
vinhnx90's picture
feat: Add HuggingFace Spaces deployment documentation and refactor Modal deployment script path.
3bf9e7e

A newer version of the Gradio SDK is available: 6.14.0

Upgrade

EcoMCP Quick Start

Get EcoMCP running in 5 minutes.

Step 1: Install (1 minute)

# Install minimal dependencies
pip install gradio httpx python-dotenv

# (Optional) Install OpenAI for better integration
pip install openai

Step 2: Set API Key (1 minute)

export OPENAI_API_KEY="sk-your-openai-key-here"

Get your key: https://platform.openai.com/api-keys

Step 3: Run the Server (2 minutes)

Option A: With Beautiful UI (Recommended)

python ecomcp_ui_refined.py

Then visit: http://localhost:7860

Option B: Standalone Server

python ecomcp_server_refined.py

(Use with external clients)

Step 4: Try It Out (1 minute)

Using the Web UI

  1. Click the " Analyze Product" tab
  2. Enter "Premium Wireless Headphones"
  3. Select "electronics" category
  4. Click " Analyze"
  5. See instant AI-powered analysis

Using Python Code

import subprocess
import json

# Start server
process = subprocess.Popen(
    ["python", "ecomcp_server_refined.py"],
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    text=True
)

# Create request
request = {
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
        "name": "analyze_product",
        "arguments": {
            "name": "Wireless Headphones",
            "category": "electronics"
        }
    },
    "id": 1
}

# Send request
process.stdin.write(json.dumps(request) + "\n")
process.stdin.flush()

# Get response
response = json.loads(process.stdout.readline())
print(response["result"]["analysis"])

What Can You Do?

1. Analyze Products

Understand market positioning, target audiences, and opportunities

2. Analyze Reviews

Extract sentiment, identify strengths/weaknesses, get improvements

3. Generate Listings

Create conversion-optimized product copy in different styles

4. Get Pricing Strategy

Intelligent pricing with psychology, discounts, bundles

5. Analyze Competitors

Find market opportunities and differentiation strategies


Deployment Options

Local

python ecomcp_ui_refined.py

Perfect for: Development, testing, demos

Modal (Serverless)

pip install modal
modal token new
modal secret create openai-api-key --value sk-...
modal deploy scripts/deploy_modal.py

Perfect for: Production, auto-scaling, zero infrastructure

Docker

docker build -t ecomcp .
docker run -e OPENAI_API_KEY=sk-... -p 7860:7860 ecomcp

Perfect for: Container orchestration, Kubernetes


Performance

  • Cached responses: <10ms
  • First request: 2-5 seconds
  • Cache hit rate: 57.8%
  • API savings: 58%

Troubleshooting

Q: "ModuleNotFoundError"
A: Install missing package: pip install <module_name>

Q: "API key not configured"
A: Set it: export OPENAI_API_KEY="sk-..."

Q: "Connection refused"
A: Ensure server is running: python ecomcp_server_refined.py

Q: Slow first response
A: Normal - OpenAI API takes 2-5s. Subsequent requests use cache.


Next Steps

  • Read full docs: README_REFINED.md
  • Check examples: Visit http://localhost:7860
  • Deploy to production: Follow scripts/deploy_modal.py
  • Run tests: pytest test_core.py -v

Files

File Purpose
ecomcp_server_refined.py MCP server (250 lines)
ecomcp_ui_refined.py Gradio UI (300 lines)
scripts/deploy_modal.py Modal deployment (200 lines)
README_REFINED.md Full documentation
requirements_min.txt Minimal dependencies

You're ready!

Start with: python ecomcp_ui_refined.py