Skip to main content
Version: 1.0-beta

Build a Customer Care Agent with MCP

What you'll build​

Architecture: a customer sends chat messages over HTTP to the Agent Chat trigger at /customer-care-agent, which runs CustomerCareAgent with the Default WSO2 Model Provider; the agent calls the ShopEasy MCP server at localhost:8080/mcp through an MCP toolkit, using the searchProducts, getOrderStatus, and submitReturnRequest toolsArchitecture: a customer sends chat messages over HTTP to the Agent Chat trigger at /customer-care-agent, which runs CustomerCareAgent with the Default WSO2 Model Provider; the agent calls the ShopEasy MCP server at localhost:8080/mcp through an MCP toolkit, using the searchProducts, getOrderStatus, and submitReturnRequest tools

A customer care agent that connects to a ShopEasy MCP server and answers product availability, order status, and return questions over a chat API.

This tutorial shows how to build an agent that uses an external MCP server through an MCP toolkit. You don't build the MCP server here; you run a provided sample instead. Your job is to connect the agent to it, write the system prompt, and expose a chat endpoint.

The agent receives customer messages over HTTP, reasons about which tool to call, invokes the MCP server, and returns a natural language answer.

Prerequisites

Step 1: Create and configure the agent​

  1. Open WSO2 Agent Builder and create or open your project.
  2. On the project home page, under Or start from scratch, select Add Agent.
  3. In the Add Agent dialog, under Create New, select Create Agent.
The Add Agent dialog with Create Agent, Create Durable Agent, and Create Agent Definition under Create New, and a Pre-built Agents section with All, Project, and Organization filters and a search boxThe Add Agent dialog with Create Agent, Create Durable Agent, and Create Agent Definition under Create New, and a Pre-built Agents section with All, Project, and Organization filters and a search box
  1. In the Create Agent form, set:
    • Role to Customer Support Agent.
    • Instructions to:
You are a helpful customer support agent for ShopEasy, an online retailer.
Help customers with product availability, order tracking, and return requests.
Always use the available tools to look up accurate information. Never guess.
Keep responses friendly and concise. Include relevant IDs (order ID, return ID) in your responses.
  • Model to Default WSO2 Model Provider.
The Create Agent form with Role set to Customer Support Agent, the ShopEasy instructions in Instructions, and Model set to Default WSO2 Model ProviderThe Create Agent form with Role set to Customer Support Agent, the ShopEasy instructions in Instructions, and Model set to Default WSO2 Model Provider
  1. Leave the fields under Advanced Configurations (Maximum Iterations, Verbose, Tool Loading Strategy, Execute Tool Calls In Parallel, and Agent Credential) at their defaults.
Why leave Maximum Iterations at its default?

INFER_TOOL_COUNT resolves to max(number of tools, 10): at least 10 reasoning-action cycles, or more if the agent has more tools available. Once the MCP toolkit is attached in Step 2, this default already gives the agent enough room to reason, call a tool, and respond, without needing a manual override.

  1. Set Agent Name to CustomerCareAgent.
  2. Select Create Agent.
The lower part of the Create Agent form with Verbose (False), Tool Loading Strategy (NO_FILTER), Execute Tool Calls In Parallel (True), and Agent Credential at their defaults, Agent Name set to CustomerCareAgent, and the Create Agent buttonThe lower part of the Create Agent form with Verbose (False), Tool Loading Strategy (NO_FILTER), Execute Tool Calls In Parallel (True), and Agent Credential at their defaults, Agent Name set to CustomerCareAgent, and the Create Agent button

WSO2 Agent Builder adds the CustomerCareAgent agent under Agents and opens the agent canvas, where the AI Agent node connects to the default WSO2 model provider.

  1. Select Add Trigger to the left of the AI Agent node.
  2. In the Add Trigger dialog, under Chat Channels, select Agent Chat.
  3. Leave Service Path as /customer-care-agent and select Create.

The Agent Chat trigger connects to the AI Agent node, and an AI Agent Services - /customer-care-agent entry point with a chat resource appears under Entry Points. The AI Agent node has a + Add Memory button and an Add Tool button at its bottom-right corner.

The CustomerCareAgent canvas with the /customer-care-agent Agent Chat trigger connected to the AI Agent node, which connects to the Default WSO2 Model Provider and shows Add Memory, Add Trigger, and Add Tool. The sidebar lists AI Agent Services - /customer-care-agent with a chat resource under Entry Points.The CustomerCareAgent canvas with the /customer-care-agent Agent Chat trigger connected to the AI Agent node, which connects to the Default WSO2 Model Provider and shows Add Memory, Add Trigger, and Add Tool. The sidebar lists AI Agent Services - /customer-care-agent with a chat resource under Entry Points.

Step 2: Add the MCP server as a tool​

2.1 Select the tool type​

Select Add Tool at the bottom-right corner of the AI Agent node. The Add Tool panel opens, listing Use Connection, Use Function, Use Agent, Use MCP Server, Use Knowledge Base, and Create Custom Tool. Select Use MCP Server.

The Add Tool panel listing Use Connection, Use Function, Use Agent, Use MCP Server (highlighted), Use Knowledge Base, and Create Custom Tool, each with a short descriptionThe Add Tool panel listing Use Connection, Use Function, Use Agent, Use MCP Server (highlighted), Use Knowledge Base, and Create Custom Tool, each with a short description

2.2 Configure the server URL​

  1. Select Connect Manually. (The other option, WSO2 Agent Manager, lists MCP servers that your organization added to WSO2 Agent Manager.)
  2. Set Server Url to http://localhost:8080/mcp.
  3. Leave Requires Authentication off.
The Add Tool - Use MCP Server panel with Server Url set to http://localhost:8080/mcp, Requires Authentication unchecked, Tools to Include set to All, a collapsed Advanced Configurations section, and Result set to aiMcpbasetoolkitThe Add Tool - Use MCP Server panel with Server Url set to http://localhost:8080/mcp, Requires Authentication unchecked, Tools to Include set to All, a collapsed Advanced Configurations section, and Result set to aiMcpbasetoolkit

The panel also shows Tools to Include (defaults to All) and a collapsed Advanced Configurations section. It holds Info (the MCP client identity sent to the server) and HTTP client options such as timeout, redirects, pooling, caching, compression, circuit breaker, retries, and TLS. Leave these at their defaults for this tutorial.

  1. Leave Result as the default aiMcpbasetoolkit and select Save.

The MCP toolkit appears as aiMcpbasetoolkit attached to the agent node, connected by a dashed line, and a McpToolKit type is added under Types in the sidebar. The agent discovers the available tools from the server at startup.

The completed agent canvas with the Agent Chat trigger, the AI Agent node connected to the Default WSO2 Model Provider, and aiMcpbasetoolkit attached to the AI Agent node by a dashed lineThe completed agent canvas with the Agent Chat trigger, the AI Agent node connected to the Default WSO2 Model Provider, and aiMcpbasetoolkit attached to the AI Agent node by a dashed line

Step 3: Run and test​

Make sure the ShopEasy MCP server is running, then select Run. WSO2 Agent Builder compiles and starts the service, with progress shown in the integrated terminal.

The chat resource flow with Start, an agent:run node for CustomerCareAgent with an Open Agent button, and Return, above the integrated terminal showing bal run compiling customer_care and Running executableThe chat resource flow with Start, an agent:run node for CustomerCareAgent with an Open Agent button, and Return, above the integrated terminal showing bal run compiling customer_care and Running executable

Once it's running, open the chat resource under Entry Points > AI Agent Services. Its flow shows Start, an agent:run node (with an Open Agent link back to the CustomerCareAgent canvas), and Return. Select Chat in the toolbar (next to Tracing) to open the Agent Chat panel. Type your message in the input field and press Enter to send it.

When the service starts, a pop-up also offers to test it with the Try It client. Selecting Test there opens the same Agent Chat panel.

Try the following messages to exercise all three tools:

  • "Do you have any wireless headphones in stock?"
  • "What is the status of my order ORD-042?"
  • "I want to return ORD-001. The item arrived damaged."
The chat resource next to the Agent Chat panel, where the agent answers that SoundPro X200 Wireless Headphones are in stock, that order ORD-042 is out for delivery, and that the return for ORD-001 is accepted with return ID RET-001The chat resource next to the Agent Chat panel, where the agent answers that SoundPro X200 Wireless Headphones are in stock, that order ORD-042 is out for delivery, and that the return for ORD-001 is accepted with return ID RET-001

What you built​

  • Connected an agent to a live MCP server through an MCP toolkit
  • Let the agent discover three tools (searchProducts, getOrderStatus, submitReturnRequest) at startup, with no hardcoded tool definitions
  • Exposed the agent as an HTTP chat service with session-scoped memory

What's next​