Skip to main content
Glama
ashwani-yadav83602

MCP Customer Support AI

MCP Customer Support AI

A production-oriented Model Context Protocol (MCP) project built with Node.js, TypeScript, MongoDB, and an LLM.

This project demonstrates how an AI application can interact with external systems through MCP tools in a structured, secure, and scalable way.

The project is being developed incrementally, from a basic MCP server and tool to a production-style AI-powered customer support system.


๐Ÿš€ Project Overview

The goal of this project is to build an AI-powered customer support assistant that can understand user requests and use MCP tools to perform real-world operations.

Example

A user can ask:

"Check my latest order and create a support ticket if it is delayed."

The AI can determine that it needs to:

  1. Find the customer.

  2. Retrieve the customer's orders.

  3. Identify the delayed order.

  4. Create a support ticket.

The AI does not directly access the database.

Instead, it interacts with the application through MCP tools.

                         User
                           โ”‚
                           โ–ผ
                      AI / LLM
                           โ”‚
                           โ–ผ
                      MCP Client
                           โ”‚
                           โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ MCP Server  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ            โ–ผ            โ–ผ
       Customer Tool   Order Tool   Ticket Tool
              โ”‚            โ”‚            โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ–ผ
                       Services
                           โ”‚
                           โ–ผ
                        MongoDB

๐ŸŽฏ Project Objectives

This project demonstrates:

  • MCP server development

  • MCP tool creation

  • MCP client communication

  • AI tool calling

  • TypeScript architecture

  • MongoDB integration

  • Service-layer architecture

  • Input validation

  • Error handling

  • Authentication and authorization

  • Logging and monitoring

  • Audit logging

  • Production-oriented MCP architecture

  • AI agent workflows


๐Ÿ› ๏ธ Tech Stack

Backend

  • Node.js

  • TypeScript

  • MCP SDK

  • Zod

  • MongoDB

  • Mongoose

AI

  • LLM integration

  • Tool calling

  • AI Agent workflow

Development

  • MCP Inspector

  • Git

  • GitHub

  • npm

Planned Production Infrastructure

  • Docker

  • Redis

  • Authentication

  • Rate limiting

  • Logging

  • Monitoring

  • CI/CD


๐Ÿ“ Project Structure

mcp-customer-support/
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ index.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ tools/
โ”‚   โ”‚   โ”œโ”€โ”€ customer.tools.ts
โ”‚   โ”‚   โ”œโ”€โ”€ order.tools.ts
โ”‚   โ”‚   โ””โ”€โ”€ ticket.tools.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ customer.service.ts
โ”‚   โ”‚   โ”œโ”€โ”€ order.service.ts
โ”‚   โ”‚   โ””โ”€โ”€ ticket.service.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ customer.model.ts
โ”‚   โ”‚   โ”œโ”€โ”€ order.model.ts
โ”‚   โ”‚   โ””โ”€โ”€ ticket.model.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ db/
โ”‚   โ”‚   โ””โ”€โ”€ database.ts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ””โ”€โ”€ auth.ts
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ logger.ts
โ”‚       โ””โ”€โ”€ errors.ts
โ”‚
โ”œโ”€โ”€ tests/
โ”‚
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ README.md

๐Ÿ—๏ธ Development Phases

The project is intentionally divided into phases so each phase introduces an important MCP or production concept.


Phase 1 โ€” MCP Server Foundation

Objective

Create a basic MCP server and expose the first tool.

Implemented

  • Node.js project

  • TypeScript configuration

  • MCP SDK

  • MCP server

  • STDIO transport

  • Zod input validation

  • First MCP tool

  • MCP Inspector integration

First Tool

find_customer

Input:

{
  "email": "ashwani@example.com"
}

Output:

{
  "id": "customer_123",
  "name": "Ashwani Yadav",
  "email": "ashwani@example.com"
}

Architecture

MCP Inspector
      โ”‚
      โ–ผ
MCP Client
      โ”‚
      โ”‚ STDIO
      โ–ผ
MCP Server
      โ”‚
      โ–ผ
find_customer()
      โ”‚
      โ–ผ
Dummy Data

Status

Completed โœ…


Phase 2 โ€” Multiple MCP Tools

Objective

Create multiple tools representing real customer-support operations.

Tools

find_customer
get_customer_orders
create_support_ticket

Example

find_customer

find_customer(email)

get_customer_orders

get_customer_orders(customerId)

create_support_ticket

create_support_ticket(
    customerId,
    orderId,
    issue
)

Expected Architecture

                    MCP Server
                        โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ               โ–ผ               โ–ผ
find_customer()   get_orders()   create_ticket()

Status

Planned ๐Ÿšง


Phase 3 โ€” MongoDB Integration

Objective

Replace dummy data with real persistent data.

Database

MongoDB

Collections

customers
orders
support_tickets

Architecture

MCP Tool
   โ”‚
   โ–ผ
Service Layer
   โ”‚
   โ–ผ
Mongoose
   โ”‚
   โ–ผ
MongoDB

Example

find_customer()
      โ”‚
      โ–ผ
customer.service.ts
      โ”‚
      โ–ผ
Customer Model
      โ”‚
      โ–ผ
MongoDB

Benefits

  • Persistent data

  • Proper database queries

  • Indexing

  • Schema validation

  • Scalable data access

Planned Index

customers.email

This allows customer lookup by email to remain efficient as the dataset grows.

Status

Planned ๐Ÿšง


Phase 4 โ€” Service Layer & Clean Architecture

Objective

Keep MCP tools separate from business logic.

Instead of putting database logic directly inside the MCP tool:

Tool
 โ†“
Service
 โ†“
Database

Example

customer.tools.ts
        โ”‚
        โ–ผ
customer.service.ts
        โ”‚
        โ–ผ
customer.model.ts
        โ”‚
        โ–ผ
MongoDB

Why?

This gives us:

  • Separation of concerns

  • Testability

  • Reusability

  • Maintainability

  • Easier migration to REST/GraphQL/internal services

Status

Planned ๐Ÿšง


Phase 5 โ€” MCP Client

Objective

Build a dedicated MCP client that connects to the MCP server.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MCP Client   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MCP Server   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The client will be able to:

Discover tools

listTools()

Execute tools

callTool()

For example:

callTool(
    "find_customer",
    {
        email: "ashwani@example.com"
    }
)

Status

Planned ๐Ÿšง


Phase 6 โ€” LLM Integration

Objective

Connect an LLM to the MCP client.

The architecture becomes:

User
 โ”‚
 โ–ผ
LLM
 โ”‚
 โ–ผ
MCP Client
 โ”‚
 โ–ผ
MCP Server
 โ”‚
 โ–ผ
Tools
 โ”‚
 โ–ผ
MongoDB

The LLM will decide which tool should be called based on the user's request.

Example

User:

Check my latest order.

AI:

I need the customer's orders.

Tool:

get_customer_orders()

The tool returns the order data.

The AI then generates a natural-language response.

Status

Planned ๐Ÿšง


Phase 7 โ€” AI Agent Workflow

Objective

Allow the LLM to perform multi-step workflows.

Example request:

Check my latest order and create a support
ticket if it is delayed.

The AI workflow:

             User Request
                   โ”‚
                   โ–ผ
                 LLM
                   โ”‚
                   โ–ผ
           find_customer()
                   โ”‚
                   โ–ผ
        get_customer_orders()
                   โ”‚
                   โ–ผ
           Analyze orders
                   โ”‚
                   โ–ผ
        Is order delayed?
              /          \
            Yes           No
             โ”‚             โ”‚
             โ–ผ             โ–ผ
 create_support_ticket   Response
             โ”‚
             โ–ผ
          Response

This demonstrates the difference between simply exposing tools and building an AI agent capable of tool orchestration.

Status

Planned ๐Ÿšง


Phase 8 โ€” Authentication & Authorization

Objective

Secure MCP operations.

Authentication verifies:

Who is the user?

Authorization verifies:

What is the user allowed to do?

Example permissions:

customer.read
order.read
ticket.create
ticket.update
admin.refund

Example:

Customer
 โ”œโ”€โ”€ find_customer       โœ…
 โ”œโ”€โ”€ get_orders          โœ…
 โ”œโ”€โ”€ create_ticket       โœ…
 โ””โ”€โ”€ refund_order        โŒ

Admin
 โ”œโ”€โ”€ find_customer       โœ…
 โ”œโ”€โ”€ get_orders          โœ…
 โ”œโ”€โ”€ create_ticket       โœ…
 โ””โ”€โ”€ refund_order        โœ…

Status

Planned ๐Ÿšง


Phase 9 โ€” Error Handling

Objective

Create consistent error handling across tools.

Example:

CustomerNotFoundError
OrderNotFoundError
UnauthorizedError
ValidationError
DatabaseError
ToolExecutionError

MCP tool responses will clearly communicate failures.

Example:

{
  "isError": true,
  "message": "Customer not found"
}

Status

Planned ๐Ÿšง


Phase 10 โ€” Logging & Observability

Objective

Track MCP operations in production.

Each tool execution should provide information such as:

Request ID
User ID
Tool name
Arguments
Execution time
Status
Error
Timestamp

Example:

INFO Tool Execution

tool: get_customer_orders
customerId: customer_123
duration: 85ms
status: success

Monitoring Goals

  • Tool latency

  • Error rate

  • Database latency

  • AI response latency

  • Tool usage frequency

  • Failed tool calls

Status

Planned ๐Ÿšง


Phase 11 โ€” Rate Limiting

Objective

Protect the MCP server from excessive or abusive requests.

Potential strategy:

User
 โ”‚
 โ–ผ
Rate Limiter
 โ”‚
 โ”œโ”€โ”€ Allowed โ”€โ”€โ†’ MCP Tool
 โ”‚
 โ””โ”€โ”€ Blocked โ”€โ”€โ†’ Rate Limit Error

Redis can be introduced for distributed rate limiting.

Example:

100 requests / minute / user

Status

Planned ๐Ÿšง


Phase 12 โ€” Audit Logging

Objective

Record sensitive AI-driven operations.

For example:

User:
customer_123

AI requested:
create_support_ticket

Order:
order_123

Action:
Support ticket created

Timestamp:
2026-08-23T10:30:00Z

This is particularly important when AI agents can perform actions that modify business data.

Status

Planned ๐Ÿšง


Phase 13 โ€” Testing

Unit Tests

Test:

  • Services

  • Validation

  • Business logic

  • Error handling

Integration Tests

Test:

MCP Tool
   โ†“
Service
   โ†“
MongoDB

MCP Tests

Test:

MCP Client
   โ†“
MCP Server
   โ†“
Tool

Example

find_customer
    โ†“
valid email
    โ†“
customer returned

and:

find_customer
    โ†“
invalid email
    โ†“
validation error

Status

Planned ๐Ÿšง


Phase 14 โ€” Dockerization

Objective

Containerize the application.

Docker
โ”‚
โ”œโ”€โ”€ MCP Server
โ”‚
โ”œโ”€โ”€ MongoDB
โ”‚
โ””โ”€โ”€ Redis

Example production architecture:

                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚   AI App    โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                        โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚ MCP Server  โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ–ผ          โ–ผ          โ–ผ
          MongoDB     Redis      Logs

Status

Planned ๐Ÿšง


Phase 15 โ€” CI/CD

Objective

Automate testing and deployment.

Pipeline:

Developer
    โ”‚
    โ–ผ
Git Push
    โ”‚
    โ–ผ
GitHub Actions
    โ”‚
    โ”œโ”€โ”€ Install dependencies
    โ”œโ”€โ”€ Lint
    โ”œโ”€โ”€ Type check
    โ”œโ”€โ”€ Run tests
    โ”œโ”€โ”€ Build
    โ””โ”€โ”€ Deploy

Status

Planned ๐Ÿšง


๐Ÿ” Environment Variables

Never commit .env to GitHub.

Use:

.env

for local development.

Example:

MONGODB_URI=mongodb://localhost:27017/mcp-support
OPENAI_API_KEY=your_api_key
JWT_SECRET=your_secret

Provide:

.env.example

instead:

MONGODB_URI=
OPENAI_API_KEY=
JWT_SECRET=

๐Ÿงช Development

Install dependencies:

npm install

Run development server:

npm run dev

Build:

npm run build

Run production build:

npm start

๐Ÿ” MCP Inspector

The MCP Inspector is used to test the MCP server and inspect available tools during development.

Example:

npx @modelcontextprotocol/inspector npx tsx src/index.ts

The Inspector allows us to:

  • Connect to the MCP server

  • Discover tools

  • Inspect tool schemas

  • Execute tools

  • Inspect responses

  • Debug MCP communication


๐Ÿง  MCP Concepts Demonstrated

This project demonstrates the following MCP concepts:

MCP Server

Provides capabilities to MCP clients.

MCP Client

Connects to MCP servers and invokes their capabilities.

Tools

Executable operations exposed to AI systems.

Examples:

find_customer
get_customer_orders
create_support_ticket

Resources

Read-only contextual data that can be exposed to an MCP client.

Potential future resources:

customer://customer_123
order://order_123

Prompts

Reusable prompt templates/workflows that can be exposed through MCP.

Potential example:

customer_support_resolution

๐Ÿ† Production Architecture

The final architecture is planned to look like:

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚     User      โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚    LLM / AI   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  MCP Client   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚       MCP Server       โ”‚
                    โ”‚                        โ”‚
                    โ”‚ Authentication         โ”‚
                    โ”‚ Authorization          โ”‚
                    โ”‚ Validation             โ”‚
                    โ”‚ Rate Limiting          โ”‚
                    โ”‚ Logging                โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ–ผ                โ–ผ                โ–ผ
        Customer Tool      Order Tool       Ticket Tool
               โ”‚                โ”‚                โ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ–ผ
                         Service Layer
                                โ”‚
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ–ผ               โ–ผ               โ–ผ
             MongoDB          Redis          Logging

๐Ÿ“Œ Current Progress

Phase

Feature

Status

1

MCP Server Foundation

โœ… Completed

2

Multiple MCP Tools

๐Ÿšง Planned

3

MongoDB Integration

๐Ÿšง Planned

4

Service Layer

๐Ÿšง Planned

5

MCP Client

๐Ÿšง Planned

6

LLM Integration

๐Ÿšง Planned

7

AI Agent Workflow

๐Ÿšง Planned

8

Authentication & Authorization

๐Ÿšง Planned

9

Error Handling

๐Ÿšง Planned

10

Logging & Observability

๐Ÿšง Planned

11

Rate Limiting

๐Ÿšง Planned

12

Audit Logging

๐Ÿšง Planned

13

Testing

๐Ÿšง Planned

14

Dockerization

๐Ÿšง Planned

15

CI/CD

๐Ÿšง Planned


๐Ÿ’ก Example Future Conversation

Once all phases are complete, the system should support conversations such as:

User

My latest order hasn't arrived. Can you check it and create a support ticket?

AI

1. Find customer
2. Retrieve orders
3. Identify delayed order
4. Create support ticket
5. Return ticket information

AI Response

Your order ORD-123 is delayed. I've created support ticket TICKET-456 for you.


๐ŸŽ“ Interview Topics Covered

This project can be used to demonstrate knowledge of:

  • Model Context Protocol

  • AI agents

  • LLM tool calling

  • Function calling

  • MCP servers

  • MCP clients

  • Tool discovery

  • Tool execution

  • TypeScript

  • Node.js

  • MongoDB

  • Mongoose

  • Clean architecture

  • Service-layer architecture

  • Authentication

  • Authorization

  • RBAC

  • Rate limiting

  • Redis

  • Logging

  • Observability

  • Docker

  • CI/CD

  • GitHub Actions

  • Testing

  • Scalable backend architecture


๐Ÿ“ˆ Future Improvements

Potential future enhancements include:

  • Multiple MCP servers

  • Payment MCP tools

  • Email MCP tools

  • CRM integration

  • Slack integration

  • GitHub integration

  • Vector database

  • RAG

  • Semantic search

  • Human-in-the-loop approval

  • Tool permission policies

  • Tool execution tracing

  • Distributed MCP deployment

  • Kubernetes deployment


๐Ÿ‘จโ€๐Ÿ’ป Development Philosophy

The project follows these principles:

  • Separation of concerns

  • Strong typing

  • Input validation

  • Secure secret management

  • Testable business logic

  • Observable tool execution

  • Least-privilege tool access

  • Scalable architecture

  • Clear MCP boundaries


๐Ÿ“œ License

This project is intended for learning, experimentation, and demonstrating MCP/AI engineering concepts.

Add an appropriate open-source license before distributing it publicly.

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

  • Connect e-commerce and marketing data to AI assistants via MCP.

  • Free public MCP for AI agents โ€” 193 tools, 44 workflows. No API key.

  • 100+ MCP tools for AI agents: content metadata, trade intelligence, business-expertise analysis.

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/ashwani-yadav83602/First-Customer-MCP-PROJECT'

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