How to quickly implement MCP functionality

:gear: How to Quickly Implement MCP Features

Please follow the instructions in this article for configuration.


:blue_book: MCP Introduction

MCP (Model Context Protocol) is a mechanism that provides large models with the ability to access external data via APIs.

MCP enables AI to have the ability to “read” and “write” databases, for example:

:receipt: Read

Based on an order number (or product number), allow the AI to know the information stored in the database and answer the customer with the results.
Example:

Customer asks: “Where is my item?”
→ Search for information in the database based on the “order number” provided by the customer
→ Reply to the customer: “The item you purchased shows [In Transit], please pay attention to receive it.”


:fountain_pen: Write

Based on the order number and the issue mentioned by the customer, automatically write after-sales information into the database.
Example:

Customer asks: “The treadmill I bought isn’t working?”
→ Record the after-sales issue in the database based on the “order number” provided by the customer
→ Reply to the customer: “Our colleague will contact you shortly~”


:test_tube: Quickly Experience MCP Features

To help you quickly experience the capabilities of MCP, we provide a test API interface. The data is stored in the following online spreadsheet:

:link: Online Spreadsheet (Click to Enter)

:backhand_index_pointing_right: The following example is for “Query (Read)” configuration.
For more advanced features, please refer to:
MCP CRUD Parameter Documentation


:ladder: Configuration Steps

Preparation: Create Access Token (Click to Expand)
  1. Open Open Platform → OAuth Clients → Create New


  2. You will be automatically redirected to the page to create a Permanent Token. Record the Token value.



Preparation: Configure Token
  1. Go to 3Chat Agent → MCP Authorized Access → Create New

  2. Fill in the information in the pop-up page:


Configure AI Task Query Logic
  1. In the left menu, go to 3Chat Agent → AI Tasks
  2. Create a new AI task, configure it according to the diagram below, and save and run:
Query Order Information
---
When the user asks about order-related information
---
If the customer has not provided an order number in the conversation history: Output "Please provide an order number"
If the customer has provided an order number in the conversation history: Call the "Query Order Information" tool and output the queried order information

Click the plus sign in the top right corner and select the corresponding MCP tool


Configure MCP Tool (Configure according to the image)
  1. Configuration Name and Description

    The description helps the large model understand when to call this tool

    search_order
    ---
    Query Order Information
    

  2. Configure Request Parameters

    Parameter descriptions tell the large model how to construct the query request

    https://c2.xinheyun.com/api/open/v2/coze/workflow/run
    ---
    order_id   Customer's order number
    ---
    {
      "workflowId": "7555717286728908834",
      "parameters": {
        "base_url": "https://3chat-ai.feishu.cn/base/Ct31bmyqgaquzxsjGG0cETeRnzc?table=tbl4tFYj2pkMk9ub&view=vewfieQ4B1",
        "fields": {},
        "order_id": "{{order_id}}",
        "purpose": "read"
      }
    }
    

  3. Configure Parameter Values and Test the Interface

    You can add test order numbers in the online spreadsheet yourself

    order_id   P1234567896112222222
    

  4. Clean Return Parameters

  5. Click Save


:white_check_mark: Final Test Results