Skip to content

Commit f3e3c62

Browse files
committed
feat:《AI MCP Gateway 网关服务系统》第3-4节:会话消息结构设计
1 parent 9ef6455 commit f3e3c62

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,7 @@ function getBarAIMCPGateway() {
23082308
"第3-1节:工程初始化创建.md",
23092309
"第3-2节:会话管理服务实现.md",
23102310
"第3-3节:会话接口编排.md",
2311+
"第3-4节:会话消息结构设计.md",
23112312
"none.md",
23122313
]
23132314
},
232 KB
Loading
274 KB
Loading
124 KB
Loading
793 KB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: 【更】第3-4节:会话消息结构设计
3+
pay: https://t.zsxq.com/02FXE
4+
---
5+
6+
# 《AI MCP Gateway 网关服务系统》第3-4节:会话消息结构设计
7+
8+
作者:小傅哥
9+
<br/>博客:[https://bugstack.cn](https://bugstack.cn)
10+
<br/>视频:[https://t.zsxq.com/t0xJC](https://t.zsxq.com/t0xJC)
11+
12+
>大家好,我是技术UP主小傅哥。
13+
14+
## 一、本章诉求
15+
16+
增加 MCP 会话通信,处理请求消息的 HTTP 服务入口方法,完成简单的消息请求接收验证。并根据消息信息,设计会话领域层中消息处理策略。
17+
18+
## 二、功能设计
19+
20+
如图,会话消息响应设计;
21+
22+
<div align="center">
23+
<img src="https://bugstack.cn/images/article/project/ai-mcp-gateway/ai-mcp-gateway-3-4-01.png" width="850px"/>
24+
</div>
25+
26+
- 首先,这里要设计一个同名接口的不同类型服务,get 用于创建会话服务,建立 sse 连接。而 post 则是处理端点消息,完成会话服务应答。
27+
- 之后,对于会话消息,我们在前面已经分析过,主要包括;InitializeHandler - 协议握手、ResourcesListHandler - 返回可用资源列表、ToolsCallHandler - 执行指定的工具调用、ToolsListHandler - 返回服务器支持的工具列表。本节我们先把这些策略结构设计出来,方便后续实现具体功能。
28+
- 重点,本节会先来实现接口和定义整个处理消息的结构,后续再做具体的功能实现,以及服务的编排动作。
29+
- 此外,本节还会引入 jdk16+ 定义的新语法关键字,**record****sealed****permits** 来定义对象。

0 commit comments

Comments
 (0)