ShopBot AI MCP Server
AI customer support MCP server with order status lookup and RAG-powered knowledge base search for e-commerce stores.
README
ShopBot AI ā MCP-Powered Customer Support Agent
A domain-specific AI customer support agent for e-commerce, built with Python and Flask. ShopBot connects a large language model directly to a live MySQL database and a RAG knowledge base via a custom MCP server ā giving it real-time access to order data and product information without hallucinating.
š¢ Live Demo: https://shopbot-ai-os4z.onrender.com
ā ļø Note: The app is hosted on Render's free tier and may take 30ā60 seconds to load on first visit (cold start). Please be patient. If the bot does not reply to your message, the Gemini API free quota (20 requests/day) has been reached and will reset the following day.
The Problem It Solves
Problem: E-commerce stores receive hundreds of repetitive support requests ā "Where is my order?", "What is your return policy?", "Do you have this in stock?" ā that consume staff time and slow down response times.
Solution: ShopBot gives businesses a deployable AI support agent that connects directly to their order database and knowledge base. Customers get instant, accurate answers without a human in the loop.
Result: Demonstrates how small e-commerce businesses can reduce support workload, eliminate repetitive queries, and provide 24/7 accurate order information ā with a fully custom stack they own and control.
What It Does
ShopBot handles two types of customer queries intelligently:
- Order tracking ā looks up real order status, tracking numbers, and shipping dates from a live MySQL database
- Product & policy questions ā searches a RAG knowledge base covering FAQs, return policy, shipping info, and product catalog
The LLM classifies each incoming message and routes it to the right tool automatically. If neither tool is needed, it answers directly.
Architecture
Browser ā Flask API ā Gemini 2.5 Flash (classifier)
ā
MCP Server
āāā Tool 1: check_order_status ā MySQL Database
āāā Tool 2: search_knowledge_base ā FAISS Vector Store (RAG)
MCP Tools
| Tool | Description |
|---|---|
check_order_status |
Queries MySQL for order status, tracking number, and shipping date by order ID or customer email |
search_knowledge_base |
Performs semantic search over the FAISS vector store to answer product, policy, and FAQ questions |
Tech Stack
| Layer | Technology |
|---|---|
| LLM | Gemini 2.5 Flash (google-genai SDK) |
| MCP Server | FastMCP (stdio transport) |
| RAG Pipeline | LangChain + FAISS + gemini-embedding-001 |
| Backend | Flask (async orchestration) |
| Database | MySQL |
| Frontend | HTML / CSS / JavaScript |
| Deployment | Render.com |
Project Structure
shopbot-ai/
āāā rag.py ā RAG pipeline (FAISS index loader)
āāā mcp/shopbot_server.py ā MCP server with 2 tools
āāā flask_app/
ā āāā app.py ā Flask API + MCP client + Gemini calls
ā āāā templates/index.html ā Chat UI
āāā knowledge_base/ ā faq.txt, return_policy.txt, shipping_info.txt, products.txt
āāā faiss_db/ ā FAISS vector index
āāā Procfile ā Render deployment config
Local Setup
Prerequisites
- Python 3.10+
- MySQL running locally
- Google API key (Gemini)
Installation
git clone https://github.com/hayamot0/shopbot-ai.git
cd shopbot-ai
pip install -r requirements.txt
Environment Variables
Create a .env file in the root directory:
GOOGLE_API_KEY=your_google_api_key_here
DB_HOST=localhost
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=shopbot
Database Setup
CREATE DATABASE shopbot;
CREATE TABLE customers (
customer_id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100),
email VARCHAR(100),
phone VARCHAR(20)
);
CREATE TABLE orders (
order_id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
product VARCHAR(100),
status VARCHAR(50),
order_date DATE,
tracking_number VARCHAR(50),
FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
);
Run
python flask_app/app.py
Visit http://localhost:5000
Key Design Decisions
- stdio transport over SSE ā chosen for simplicity and portfolio demonstration; SSE would be used for production multi-client deployments
- Gemini over OpenAI ā used due to regional payment gateway limitations; the architecture is LLM-agnostic and can be swapped to any provider
- FAISS over hosted vector DB ā local vector store keeps the project self-contained with zero additional infrastructure cost
- Async event loop isolation ā each Flask request spawns its own event loop to avoid conflicts between Flask's sync context and the async MCP client
Use Cases This Architecture Covers
This project serves as a reference implementation for:
- AI customer support agents for e-commerce businesses
- Domain-specific MCP servers with database tool integration
- RAG pipelines for product and policy knowledge bases
- Flask + async MCP client orchestration patterns
License
MIT License ā see LICENSE file for details.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.