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.
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:
- Find the customer.
- Retrieve the customer's orders.
- Identify the delayed order.
- 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-123is delayed. I've created support ticketTICKET-456for 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.
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.