ShopBot AI MCP Server

ShopBot AI MCP Server

AI customer support MCP server with order status lookup and RAG-powered knowledge base search for e-commerce stores.

Category
Visit Server

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

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
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
Qdrant Server

Qdrant Server

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

Official
Featured