- 🛍️ MCP - MCP for Commerce Platforms - Universal E-commerce Customer Support Assistant
🛍️ MCP - MCP for Commerce Platforms - Universal E-commerce Customer Support Assistant
title: E-commerce Customer Support MCP emoji: 🛍️ colorFrom: blue colorTo: purple sdk: gradio sdk_version: 5.33.0 app_file: app.py pinned: false license: mit tags: ["mcp", "commerce", "customer support" ]
🛍️ MCP - MCP for Commerce Platforms - Universal E-commerce Customer Support Assistant
One Chat, Every Platform - A platform-agnostic customer support assistant that connects to any e-commerce platform through pluggable strategies, using MCP (Model Context Protocol) server and Gradio for the interface.
🎯 Features
- 📦 Order Management: Track orders, check status, view history
- 🔄 Returns & Refunds: Initiate returns, process refunds seamlessly
- ❌ Cancellations: Quick and easy order cancellations
- 💬 Natural Language: Conversational interface for customer support
- 🔌 Platform Agnostic: Extensible to any e-commerce platform
- 🚀 Auto-Deploy: Continuous deployment to Hugging Face Spaces
🏗️ Architecture
The system uses a Strategy Pattern to abstract different e-commerce platforms:
┌─────────────────────────────────────────────────────────┐
│ Gradio UI Layer │
│ (Customer Support Conversational Interface) │
└─────────────────────────────┬───────────────────────────┘
│
┌─────────────────────────────▼───────────────────────────┐
│ MCP Server Core │
│ (Order Management, NLP Processing, Context Engine) │
└─────────────────────────────┬───────────────────────────┘
│
┌─────────────────────────────▼───────────────────────────┐
│ E-commerce Strategy Interface │
│ (MockData, Shopify, Magento, WooCommerce, etc.) │
└─────────────────────────────────────────────────────────┘
🚀 Quick Start
Prerequisites
- Python 3.10 or higher
- Git
- Virtual environment tool (venv)
Installation
-
Clone the repository
git clone https://github.com/slavpilus/mcp.git cd mcp -
Run the setup script (macOS/Linux)
chmod +x scripts/setup_dev.sh ./scripts/setup_dev.shOr manually:
# Create virtual environment python -m venv venv # Activate virtual environment # On macOS/Linux: source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements-dev.txt # Install pre-commit hooks pre-commit install -
Configure environment variables
cp .env.example .env # Edit .env with your configuration -
Run the application
python app.pyThe application will be available at
http://localhost:7860
🛠️ Development
Project Structure
mcp/
├── .github/workflows/ # CI/CD pipelines
├── mcp_server/ # Core MCP server implementation
│ ├── strategies/ # E-commerce platform strategies
│ ├── models/ # Data models
│ └── utils/ # Utility functions
├── ui/ # Gradio UI components
├── tests/ # Test suite
├── app.py # Main Gradio application
└── requirements.txt # Python dependencies
Development Workflow
-
Activate virtual environment
source venv/bin/activate # macOS/Linux # or venv\Scripts\activate # Windows -
Make your changes
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
-
Run code quality checks
# Format code black . isort . # Run linter ruff check . # Type checking mypy mcp_server ui -
Run tests
# Run all tests with coverage pytest # Run specific test file pytest tests/unit/test_strategies.py # Run with verbose output pytest -v -
Commit changes
git add . git commit -m "feat: your feature description"Pre-commit hooks will automatically run code quality checks.
Code Style
This project uses:
- Black for code formatting (line length: 88)
- isort for import sorting
- Ruff for linting
- MyPy for type checking
All code must pass these checks before merging.
Testing
- Minimum test coverage: 80%
- Write unit tests for all new functionality
- Integration tests for critical workflows
- Use pytest fixtures for test data
Adding a New E-commerce Platform
-
Create a new strategy in
mcp_server/strategies/:from .base import EcommerceStrategy class YourPlatformStrategy(EcommerceStrategy): async def get_order(self, order_id: str) -> Optional[Order]: # Implementation here pass -
Add tests in
tests/unit/test_your_platform_strategy.py -
Update the strategy factory to include your platform
📊 Environment Variables
Create a .env file based on .env.example:
# Application Settings
DEBUG=False
LOG_LEVEL=INFO
# Hugging Face (for deployment)
HF_TOKEN=your_token_here
HF_USERNAME=your_username
HF_SPACE_NAME=your_space_name
# E-commerce Platforms (future)
# SHOPIFY_API_KEY=
# MAGENTO_API_URL=
🚀 Deployment
Automatic Deployment
This project is configured for automatic deployment to Hugging Face Spaces:
- Push to the
mainbranch - GitHub Actions will run tests and quality checks
- If all checks pass, the app deploys to Hugging Face Spaces
Manual Deployment
To deploy manually to Hugging Face Spaces:
# Add Hugging Face remote
git remote add space https://huggingface.co/spaces/SlavPilus/mpc-for-commerce-platforms
# Push to deploy
git push space main
🧪 Running Specific Commands
# Run only unit tests
pytest tests/unit/
# Run with coverage report
pytest --cov=mcp_server --cov=ui --cov-report=html
# Run linting
ruff check . --fix
# Format imports
isort .
# Type checking
mypy mcp_server ui --strict
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Commit Convention
We use conventional commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Test additions/changeschore:Maintenance tasks
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with Gradio
- Uses MCP (Model Context Protocol)
- Deployed on Hugging Face Spaces
📞 Support
For issues and feature requests, please use the GitHub Issues page.
Status: 🚧 Under active development - Phase 1: Core Foundation