Skip to content

Commit c3304f7

Browse files
committed
docs:更新 MCP 服务 MaxKB 使用步骤
1 parent 448d109 commit c3304f7

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

docs/img/maxkb_effect.png

-10.5 MB
Loading

docs/mcp_server.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
### 3.1 MaxKB 集成示例
9494
!!! Tip ""
95+
示例一:
9596
步骤⼀: 创建⼀个高级编排 ,添加用户输⼊用于在问数开始时输⼊ SQLBot 用户名和密码 。
9697

9798
步骤⼆: 添加⼀个 AI 对话 ,启用⼯具中的 MCP 功能 ,填⼊ MCP Sever 配置 。
@@ -113,6 +114,54 @@
113114
```
114115

115116
![集成示例](img/maxkb_ai_effect.png)
117+
!!! Tip ""
118+
示例二:
119+
120+
步骤⼀: 创建或进入一个高级编排类型的应用。
121+
122+
步骤二: 添加输入节点在,节点中定义输入变量: username(必填) 、password(必填)
123+
124+
步骤三: 添加条件判断,在开始节点后添加条件分支(IF)。判断条件:access_token 是否为空。为空:执行登录逻辑,调用 MCP 工具 mcp_start。
125+
126+
配置 MCP 工具:
127+
128+
- 输入全局变量:
129+
```
130+
{
131+
"username": "{{username}}",
132+
"password": "{{password}}"
133+
}
134+
135+
```
136+
- MCP Server Config 服务配置:
137+
```
138+
{
139+
"sqlbot_mcp": {
140+
"uri": "http://<SQLBot_MCP_IP>:8001/mcp",
141+
"transport": "sse"
142+
}
143+
}
144+
```
145+
- MCP 工具返回包含 chat_id 和 access_token 的 JSON。解析返回值,添加工具节点(Python)来解析 JSON:
146+
```
147+
import json
148+
def main1(data):
149+
json_obj = json.loads(data[0])
150+
return {"token":json_obj["data"]["access_token"], "chat_id":json_obj["data"]["chat_id"]}
151+
```
152+
添加变量赋值节点,将 chat_id 和 access_token 存储为会话变量,供后续 MCP 调用使用。
153+
154+
- 执行后续 MCP 业务调用,MCP Server Config 配置:
155+
156+
```
157+
{
158+
"sqlbot_mcp": {
159+
"uri": "http://<SQLBot_MCP_IP>:8001/mcp",
160+
"transport": "sse"
161+
}
162+
}
163+
```
164+
步骤四:在流程末尾添加指定回复节点,将 MCP 的输出结果作为回复内容。输入有效的 username 与 password 测试登录及 MCP 功能调用是否正常。
116165

117166
![集成示例](img/maxkb_effect.png)
118167

0 commit comments

Comments
 (0)