mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
updated mcp-endpoint-integration documentation
This commit is contained in:
parent
7f12e55a87
commit
8858ff4db1
2 changed files with 1223 additions and 55 deletions
1173
docs/indian-calendar-integration.md
Normal file
1173
docs/indian-calendar-integration.md
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,104 +1,100 @@
|
|||
# MCP 接入点部署使用指南
|
||||
# MCP Endpoint Deployment and Usage Guide
|
||||
|
||||
本教程包含2个部分
|
||||
- 1、如何开启mcp接入点
|
||||
- 2、如何为智能体接入一个简单的mcp功能,如计算器功能
|
||||
This tutorial contains 2 parts:
|
||||
- 1. How to enable the MCP endpoint
|
||||
- 2. How to integrate a simple MCP function for the AI agent, such as calculator functionality
|
||||
|
||||
部署的前提条件:
|
||||
- 1、你已经部署了全模块,因为mcp接入点需要全模块中的智控台功能
|
||||
- 2、你想在不修改xiaozhi-server项目的前提下,扩展小智的功能
|
||||
Prerequisites for deployment:
|
||||
- 1. You have deployed the full module suite, as the MCP endpoint requires the management console functionality from the full module
|
||||
- 2. You want to extend Xiaozhi's functionality without modifying the xiaozhi-server project
|
||||
|
||||
# 如何开启mcp接入点
|
||||
# How to Enable the MCP Endpoint
|
||||
|
||||
## 第一步,下载mcp接入点项目源码
|
||||
## Step 1: Download the MCP Endpoint Project Source Code
|
||||
|
||||
浏览器打开[mcp接入点项目地址](https://github.com/xinnan-tech/mcp-endpoint-server)
|
||||
Open the [MCP endpoint project repository](https://github.com/xinnan-tech/mcp-endpoint-server) in your browser.
|
||||
|
||||
打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。
|
||||
Once opened, find the green button labeled `Code` on the page, click it, and you'll see the `Download ZIP` button.
|
||||
|
||||
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`mcp-endpoint-server-main`
|
||||
你需要把它重命名成`mcp-endpoint-server`。
|
||||
Click it to download the project source code archive. After downloading to your computer, extract it. The folder name might be `mcp-endpoint-server-main`, which you need to rename to `mcp-endpoint-server`.
|
||||
|
||||
## 第二步,启动程序
|
||||
这个项目是一个很简单的项目,建议使用docker运行。不过如果你不想使用docker运行,你可以参考[这个页面](https://github.com/xinnan-tech/mcp-endpoint-server/blob/main/README_dev.md)使用源码运行。以下是docker运行的方法
|
||||
## Step 2: Start the Program
|
||||
This is a simple project, and it's recommended to run it using Docker. However, if you don't want to use Docker, you can refer to [this page](https://github.com/xinnan-tech/mcp-endpoint-server/blob/main/README_dev.md) to run from source code. Here's how to run with Docker:
|
||||
|
||||
```
|
||||
# 进入本项目源码根目录
|
||||
```bash
|
||||
# Enter the project source code root directory
|
||||
cd mcp-endpoint-server
|
||||
|
||||
# 清除缓存
|
||||
# Clear cache
|
||||
docker compose -f docker-compose.yml down
|
||||
docker stop mcp-endpoint-server
|
||||
docker rm mcp-endpoint-server
|
||||
docker rmi ghcr.nju.edu.cn/xinnan-tech/mcp-endpoint-server:latest
|
||||
|
||||
# 启动docker容器
|
||||
# Start docker container
|
||||
docker compose -f docker-compose.yml up -d
|
||||
# 查看日志
|
||||
# View logs
|
||||
docker logs -f mcp-endpoint-server
|
||||
```
|
||||
|
||||
此时,日志里会输出类似以下的日志
|
||||
At this point, the logs will output something similar to:
|
||||
```
|
||||
======================================================
|
||||
接口地址: http://172.1.1.1:8004/mcp_endpoint/health?key=xxxx
|
||||
=======上面的地址是MCP接入点地址,请勿泄露给任何人============
|
||||
Interface URL: http://172.1.1.1:8004/mcp_endpoint/health?key=xxxx
|
||||
=======The above URL is the MCP endpoint address, do not share with anyone============
|
||||
```
|
||||
|
||||
请你把接口地址复制出来:
|
||||
Please copy the interface URL:
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
**Important: Since you're using Docker deployment, DO NOT use the above address directly!**
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
**Important: Since you're using Docker deployment, DO NOT use the above address directly!**
|
||||
|
||||
由于你是docker部署,切不可直接使用上面的地址!
|
||||
**Important: Since you're using Docker deployment, DO NOT use the above address directly!**
|
||||
|
||||
你先把地址复制出来,放在一个草稿里,你要知道你的电脑的局域网ip是什么,例如我的电脑局域网ip是`192.168.1.25`,那么
|
||||
原来我的接口地址
|
||||
First copy the address and save it in a draft. You need to know your computer's local network IP. For example, if my computer's local IP is `192.168.1.25`, then the original interface address:
|
||||
```
|
||||
http://172.1.1.1:8004/mcp_endpoint/health?key=xxxx
|
||||
```
|
||||
就要改成
|
||||
should be changed to:
|
||||
```
|
||||
http://192.168.1.25:8004/mcp_endpoint/health?key=xxxx
|
||||
```
|
||||
|
||||
改好后,请使用浏览器直接访问这个接口。当浏览器出现类似这样的代码,说明是成功了。
|
||||
After making the change, please access this interface directly using your browser. When the browser displays code similar to this, it means success:
|
||||
```
|
||||
{"result":{"status":"success","connections":{"tool_connections":0,"robot_connections":0,"total_connections":0}},"error":null,"id":null,"jsonrpc":"2.0"}
|
||||
```
|
||||
|
||||
请你保留好这个`接口地址`,下一步要用到。
|
||||
Please keep this `interface URL` safe, as you'll need it in the next step.
|
||||
|
||||
## 第三步,配置智控台
|
||||
## Step 3: Configure the Management Console
|
||||
|
||||
使用管理员账号,登录智控台,点击顶部`参数字典`,选择`参数管理`功能。
|
||||
Log in to the management console using an administrator account, click on `Parameter Dictionary` at the top, and select the `Parameter Management` function.
|
||||
|
||||
然后搜索参数`server.mcp_endpoint`,此时,它的值应该是`null`值。
|
||||
点击修改按钮,把上一步得来的`接口地址`粘贴到`参数值`里。然后保存。
|
||||
Then search for the parameter `server.mcp_endpoint`. At this point, its value should be `null`.
|
||||
Click the modify button and paste the `interface URL` from the previous step into the `Parameter Value` field. Then save.
|
||||
|
||||
如果能保存成功,说明一切顺利,你可以去智能体查看效果了。如果不成功,说明智控台无法访问mcp接入点,很大概率是网络防火墙,或者没有填写正确的局域网ip。
|
||||
If you can save successfully, everything is going smoothly, and you can go to the AI agent to see the effects. If unsuccessful, it means the management console cannot access the MCP endpoint, most likely due to network firewall issues or incorrect local network IP configuration.
|
||||
|
||||
# 如何为智能体接入一个简单的mcp功能,如计算器功能
|
||||
# How to Integrate a Simple MCP Function for the AI Agent, Such as Calculator Functionality
|
||||
|
||||
如果以上步骤顺利,你可以进入智能体管理,点击`配置角色`,在`意图识别`的右边,有一个`编辑功能`的按钮。
|
||||
If the above steps went smoothly, you can enter AI agent management, click `Configure Role`, and on the right side of `Intent Recognition`, there's an `Edit Functions` button.
|
||||
|
||||
点击这个按钮。在弹出的页面里,位于底部,会有`MCP接入点`,正常来说,会显示这个智能体的`MCP接入点地址`,接下来,我们来给这个智能体扩展一个基于MCP技术的计算器的功能。
|
||||
Click this button. In the popup page, at the bottom, there will be `MCP Endpoint`. Normally, it will display this AI agent's `MCP Endpoint Address`. Next, we'll extend this AI agent with calculator functionality based on MCP technology.
|
||||
|
||||
这个`MCP接入点地址`很重要,你等一下会用到。
|
||||
This `MCP Endpoint Address` is important - you'll need it shortly.
|
||||
|
||||
## 第一步 下载虾哥MCP计算器项目代码
|
||||
## Step 1: Download the MCP Calculator Project Code
|
||||
|
||||
浏览器打开虾哥写的[计算器项目](https://github.com/78/mcp-calculator),
|
||||
Open the [calculator project](https://github.com/78/mcp-calculator) in your browser.
|
||||
|
||||
打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。
|
||||
|
||||
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`mcp-calculatorr-main`
|
||||
你需要把它重命名成`mcp-calculator`。接下来,我们用命令行进入项目目录即安装依赖
|
||||
Once opened, find the green button labeled `Code` on the page, click it, and you'll see the `Download ZIP` button.
|
||||
|
||||
Click it to download the project source code archive. After downloading to your computer, extract it. The folder name might be `mcp-calculator-main`, which you need to rename to `mcp-calculator`. Next, we'll use the command line to enter the project directory and install dependencies:
|
||||
|
||||
```bash
|
||||
# 进入项目目录
|
||||
# Enter project directory
|
||||
cd mcp-calculator
|
||||
|
||||
conda remove -n mcp-calculator --all -y
|
||||
|
|
@ -108,27 +104,26 @@ conda activate mcp-calculator
|
|||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## 第二步 启动
|
||||
## Step 2: Launch
|
||||
|
||||
启动前,先从你的智控台的智能体里,复制到了MCP接入点的地址。
|
||||
Before launching, first copy the MCP endpoint address from your AI agent in the management console.
|
||||
|
||||
例如我的智能体的mcp地址是
|
||||
For example, if my AI agent's MCP address is:
|
||||
```
|
||||
ws://192.168.4.7:8004/mcp_endpoint/mcp/?token=abc
|
||||
```
|
||||
|
||||
开始输入命令
|
||||
Start by entering the command:
|
||||
|
||||
```bash
|
||||
export MCP_ENDPOINT=ws://192.168.4.7:8004/mcp_endpoint/mcp/?token=abc
|
||||
```
|
||||
|
||||
输入完后,启动程序
|
||||
After entering this, start the program:
|
||||
|
||||
```bash
|
||||
python mcp_pipe.py calculator.py
|
||||
```
|
||||
|
||||
|
||||
启动完后,你再进入智控台,点击刷新MCP的接入状态,就会看到你扩展的功能列表了。
|
||||
After startup, go back to the management console and click refresh on the MCP connection status. You'll then see the list of extended functions you've added.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue