MCP Customer Support AI

MCP Customer Support AI

Enables an AI to perform customer support workflows by looking up customers, retrieving orders, and creating support tickets through MCP tools.

Category
访问服务器

README

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选