Skip to main content
Glama
Pkaran26

ecommerce-mcp-chat-server

by Pkaran26

Ecommerce MCP Chat Server Demo with Local LLM

A complete demonstration of connecting a local Large Language Model (LLM) to a NestJS database backend using the Model Context Protocol (MCP). This project allows an AI agent to autonomously execute tools to query a MySQL database in real-time during a chat session.

🚀 Features

  • NestJS Backend: A modular architecture managing Users, Products, and Orders.

  • Database Integration: Sequelize ORM connected to a local MySQL database.

  • MCP Server: Exposes database queries natively to AI agents using @nestjs-mcp/server.

  • Local AI Agent: A Node.js CLI chat interface powered by the Vercel AI SDK and Ollama (llama3.1:8b).

  • Agentic Tool Calling: The LLM autonomously decides when to query the database to answer user questions accurately.

Related MCP server: mcp-db-server

đź“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v24+)

  • MySQL (Running locally on port 3306)

  • Ollama (Running locally with the llama3.1:8b model pulled)

Note: To pull the required model, run ollama pull llama3.1:8b in your terminal.

🛠️ Installation & Setup

  1. Clone the repository and install dependencies:

    npm install
  2. Database Setup: Ensure your local MySQL server is running. Create an empty database named mcp_demo.

    CREATE DATABASE my_db;

(Update the database credentials in src/app.module.ts and src/seed.ts if your MySQL username is not root or if you have a password).

  1. Seed the Database: Generate dummy data (50 users, 50 products, and 50 orders) to test the AI's querying capabilities.

    npx ts-node src/seed.ts

đź’» Running the Application

This project requires two terminal windows to run simultaneously—one for the NestJS MCP Server, and one for the AI Chat Client.

Terminal 1: Start the NestJS MCP Server Start the backend server so it can expose the database tools via the MCP Streamable HTTP transport.

npm run start

(The server runs on http://localhost:3000 with MCP available at /mcp)

Terminal 2: Start the AI Chat Client Start the interactive command-line interface. The client will connect to the NestJS server, discover the tools, and allow you to chat with the local LLM.

npx ts-node src/chat.ts

đź’¬ Usage Examples

Once the chat client is running, try asking the agent questions that require database knowledge:

"What products do we have available?"

"Can you give me the details for user ID 5?"

"How many orders are in the system?"

"Check the price of product ID 12 and tell me if it's more than $500."

The LLM will pause, call the appropriate NestJS tool, read the database results, and formulate a natural language response.

đź“‚ Project Structure

src/user/, src/product/, src/order/ - NestJS modules containing Controllers, Services, Models, and MCP Resolvers.

src/chat.ts - The Vercel AI SDK client implementing the conversational loop.

src/seed.ts - Database seeding script.

A
license - permissive license
-
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    Enables AI agents to query MongoDB databases and project management REST APIs through a universal MCP interface, providing read-time access to workspace data.
  • F
    license
    -
    quality
    C
    maintenance
    An MCP server that exposes relational databases (PostgreSQL/MySQL) to AI agents with natural language to SQL query support.
    18
  • F
    license
    -
    quality
    D
    maintenance
    NestJS-based MCP server for MySQL with session-level database selection and SQL safety controls. Enables executing SQL queries, listing databases, and connecting MySQL users with configurable safe modes.

View all related MCP servers

Related MCP Connectors

  • Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pkaran26/ecommerce-mcp-chat-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server