From 18d882a0d7d54c963dfe56c9969f293bca137cdb Mon Sep 17 00:00:00 2001 From: Alireza Jahanshahlou Date: Sun, 12 Oct 2025 17:34:36 +0330 Subject: [PATCH] Update mcp-endpoint-integration.md --- docs/mcp-endpoint-integration.md | 94 ++++++++++++++++---------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/docs/mcp-endpoint-integration.md b/docs/mcp-endpoint-integration.md index 91d622786..ba8f870ea 100644 --- a/docs/mcp-endpoint-integration.md +++ b/docs/mcp-endpoint-integration.md @@ -1,48 +1,48 @@ -# MCP 接入点使用指南 +# MCP Access Point User Guide -本教程以虾哥开源的mcp计算器功能为示例,介绍如何将自己自定义的mcp服务接入到自己的接入点里。 +This tutorial uses the open source MCP calculator function of Xia Ge as an example to introduce how to connect your own customized MCP service to your own access point. -本教程的前提是,你的`xiaozhi-server`已经启用了mcp接入点功能,如果你还没启用,可以先根据[这个教程](./mcp-endpoint-enable.md)启用。 +The premise of this tutorial is that the mcp endpoint function has been enabled on your `xiaozhi-server`. If you haven't enabled it yet, you can enable it according to [this tutorial](./mcp-endpoint-enable.md). -# 如何为智能体接入一个简单的mcp功能,如计算器功能 +# How to access a simple mcp function for the agent, such as a calculator function -### 如果你是全模块部署 -如果你是全模块部署,你可以进入智控台,智能体管理,点击`配置角色`,在`意图识别`的右边,有一个`编辑功能`的按钮。 +### If you are deploying a full module +If you are deploying a full module, you can go to the Intelligent Console, select Agent Management, click Configure Role, and to the right of Intent Recognition, there is an Edit Function button. -点击这个按钮。在弹出的页面里,位于底部,会有`MCP接入点`,正常来说,会显示这个智能体的`MCP接入点地址`,接下来,我们来给这个智能体扩展一个基于MCP技术的计算器的功能。 +Click this button. In the pop-up page, at the bottom, there will be an MCP access point. Normally, it will display the MCP access point address of this agent. Next, we will extend this agent with a calculator function based on MCP technology. -这个`MCP接入点地址`很重要,你等一下会用到。 +This `MCP access point address` is very important and you will need it later. -### 如果你是单模块部署 -如果你是单模块部署,且你已经在配置文件里配置了MCP接入点地址,那么正常来说,单模块部署启动的时候,会输出如下的日志。 +### If you are deploying a single module +If you are deploying a single module and you have configured the MCP access point address in the configuration file, then normally, the following log will be output when the single module deployment is started. ``` -250705[__main__]-INFO-初始化组件: vad成功 SileroVAD -250705[__main__]-INFO-初始化组件: asr成功 FunASRServer -250705[__main__]-INFO-OTA接口是 http://192.168.1.25:8002/xiaozhi/ota/ -250705[__main__]-INFO-视觉分析接口是 http://192.168.1.25:8002/mcp/vision/explain -250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc -250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/ -250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问======= -250705[__main__]-INFO-如想测试websocket请用谷歌浏览器打开test目录下的test_page.html -250705[__main__]-INFO-============================================================= +250705[__main__]-INFO-Initialization component: vad successful SileroVAD +250705[__main__]-INFO-Initialization component: asr successful FunASRServer +250705[__main__]-INFO-OTA interface is http://192.168.1.25:8002/xiaozhi/ota/ +250705[__main__]-INFO-The visual analysis interface is http://192.168.1.25:8002/mcp/vision/explain +250705[__main__]-INFO-mcp access point is ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc +250705[__main__]-INFO-Websocket address is ws://192.168.1.25:8000/xiaozhi/v1/ +250705[__main__]-INFO-=======The above address is the websocket protocol address, please do not access it with a browser======= +250705[__main__]-INFO-If you want to test websocket, please use Google Chrome to open the test_page.html in the test directory +250705[__main__]-INFO-================================================================ ``` -如上,输出`mcp接入点是`中`ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc`就是你的`MCP接入点地址`。 +As shown above, `ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc` in the `mcp access point is` output is your `MCP access point address`. -这个`MCP接入点地址`很重要,你等一下会用到。 +This `MCP access point address` is very important and you will need it later. -## 第一步 下载虾哥MCP计算器项目代码 +## The first step is to download the MCP calculator project code -浏览器打开虾哥写的[计算器项目](https://github.com/78/mcp-calculator), +Open the [calculator project](https://github.com/78/mcp-calculator) written by Brother Xia in the browser. -打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。 +After opening, find a green button on the page with the word `Code` written on it, click it, and then you will see the `Download ZIP` button. -点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`mcp-calculatorr-main` -你需要把它重命名成`mcp-calculator`。接下来,我们用命令行进入项目目录即安装依赖 +Click it to download the source code of this project. After downloading it to your computer, unzip it. At this time, its name may be `mcp-calculatorr-main` +You need to rename it to `mcp-calculator`. Next, we use the command line to enter the project directory to install the dependencies ```bash -# 进入项目目录 +# Enter the project directory cd mcp-calculator conda remove -n mcp-calculator --all -y @@ -52,43 +52,43 @@ conda activate mcp-calculator pip install -r requirements.txt ``` -## 第二步 启动 +## Second step startup -启动前,先从你的智控台的智能体里,复制到了MCP接入点的地址。 +Before starting, copy the address of the MCP access point from the intelligent body of your smart console. -例如我的智能体的mcp地址是 +For example, the mcp address of my agent is ``` ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc ``` -开始输入命令 +Start typing commands ```bash export MCP_ENDPOINT=ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc ``` -输入完后,启动程序 +After entering, start the program ```bash python mcp_pipe.py calculator.py ``` -### 如果你是智控台部署 -如果你是智控台部署,启动完后,你再进入智控台,点击刷新MCP的接入状态,就会看到你扩展的功能列表了。 +### If you are deploying on a smart console +If you are deploying on a smart console, after startup, enter the smart console and click Refresh MCP access status, you will see your expanded function list. -### 如果你是单模块部署 -如果你是单模块部署,当设备连接后,会输出类似的日志,说明成功了 +### If you are deploying a single module +If you are deploying a single module, a similar log will be output when the device is connected, indicating success. ``` -250705 -INFO-正在初始化MCP接入点: wss://2662r3426b.vicp.fun/mcp_e -250705 -INFO-发送MCP接入点初始化消息 -250705 -INFO-MCP接入点连接成功 -250705 -INFO-MCP接入点初始化成功 -250705 -INFO-统一工具处理器初始化完成 -250705 -INFO-MCP接入点服务器信息: name=Calculator, version=1.9.4 -250705 -INFO-MCP接入点支持的工具数量: 1 -250705 -INFO-所有MCP接入点工具已获取,客户端准备就绪 -250705 -INFO-工具缓存已刷新 -250705 -INFO-当前支持的函数列表: [ 'get_time', 'get_lunar', 'play_music', 'get_weather', 'handle_exit_intent', 'calculator'] +250705 -INFO-Initializing MCP access point: wss://2662r3426b.vicp.fun/mcp_e +250705 -INFO-Send MCP access point initialization message +250705 -INFO-MCP access point connection successful +250705 -INFO-MCP access point initialization successful +250705 -INFO-Unified tool processor initialization completed +250705 -INFO-MCP access point server information: name=Calculator, version=1.9.4 +250705 -INFO - Number of tools supported by MCP access point: 1 +250705 -INFO-All MCP access point tools have been obtained and the client is ready +250705 -INFO-Tools cache flushed +250705 -INFO- List of currently supported functions: [ 'get_time', 'get_lunar', 'play_music', 'get_weather', 'handle_exit_intent', 'calculator'] ``` -如果包含了 `'calculator'`,说明设备将可以根据意图识别,调用计算器这个工具。 \ No newline at end of file +If `'calculator'` is included, the device will be able to use the calculator tool based on the intent recognition.