This example demonstrates how to use Model Context Protocol to build a customer support agent that can access knowledge bases, user history, and support tools to resolve issues efficiently.
The Customer Support Agent uses MCP to structure all the context needed for effective customer support, including:
Knowledge Base Integration
Retrieval-augmented generation with company documentation
Customer Context
Account information, purchase history, and previous support tickets
Support Tools
Tools for creating tickets, checking order status, and processing returns
// Customer Support Agent MCP Context import { MCPContext } from '@modl/mcp'; const supportAgent = new MCPContext({ systemInstruction: "You are a helpful customer support agent for TechGadgets, an electronics retailer.", userGoal: "Help resolve customer issues efficiently and accurately.", customerContext: { name: "Jamie Smith", email: "jamie.smith@example.com", accountCreated: "2023-05-15", recentOrders: [ { orderId: "ORD-12345", date: "2025-04-28", items: ["Smartphone XYZ", "Wireless Earbuds"], status: "Delivered" } ], previousTickets: [ { ticketId: "TKT-789", date: "2025-03-10", issue: "Billing question", resolution: "Explained pro-rated refund policy" } ] }, tools: [ { name: "searchKnowledgeBase", description: "Search the company knowledge base", parameters: { query: "string", category: "string" } }, { name: "getOrderDetails", description: "Get detailed information about an order", parameters: { orderId: "string" } }, { name: "createSupportTicket", description: "Create a new support ticket", parameters: { customerId: "string", issue: "string", priority: "string" } }, { name: "initiateReturn", description: "Start the return process for an item", parameters: { orderId: "string", itemId: "string", reason: "string" } } ], memory: { shortTerm: [], longTerm: { customerPreferences: "Prefers email communication, technical explanations" } } }); export default supportAgent;
Try out the Customer Support Agent with this interactive demo. Ask about order status, returns, or technical issues.
Hello Jamie! Welcome back to TechGadgets support. I see your recent order (ORD-12345) was delivered on April 28th. How can I help you today?
Hi there. I'm having an issue with the wireless earbuds I ordered. They won't connect to my phone.
I'm sorry to hear you're having trouble with your wireless earbuds. Let me help you troubleshoot this issue.
First, let's try a few basic steps:
Have you tried any of these steps already? If so, which ones?
This is a demo interface. The agent is not actually functional.