Skip to content

Commit c8c585d

Browse files
committed
fix: mcp last-event-id request return 404. #3118
1 parent e29a25f commit c8c585d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arthas-mcp-server/src/main/java/com/taobao/arthas/mcp/server/protocol/server/handler/McpStreamableHttpRequestHandler.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ protected void handle(ChannelHandlerContext ctx, FullHttpRequest request) throws
200200
* Handles GET requests to establish SSE connections and message replay.
201201
*/
202202
private void handleGetRequest(ChannelHandlerContext ctx, FullHttpRequest request) {
203+
// TODO support last-event-id #3118
204+
// MCP 客户端在 SSE 断线重连时,可能会带上 last-event-id 尝试做消息回放。
205+
// Arthas MCP Server 不支持基于 last-event-id 的恢复逻辑:直接返回 404,
206+
// 让客户端触发完整重置并重新走 Initialize 握手申请新的会话。
207+
if (request.headers().get(HttpHeaders.LAST_EVENT_ID) != null) {
208+
sendError(ctx, HttpResponseStatus.NOT_FOUND,
209+
new McpError("Session not found, please re-initialize"));
210+
return;
211+
}
212+
203213
List<String> badRequestErrors = new ArrayList<>();
204214

205215
String accept = request.headers().get(ACCEPT);

0 commit comments

Comments
 (0)