@@ -141,6 +141,15 @@ diff --git a/dist/cjs/client/streamableHttp.js b/dist/cjs/client/streamableHttp.
141141index a29a7d3a0f14d9cd800ef5b296485237350c666f..c362ae5fe6c62c8c8eae7e2e61de1eedff5443c9 100644
142142--- a/dist/cjs/client/streamableHttp.js
143143+++ b/dist/cjs/client/streamableHttp.js
144+ @@ -204,7 +204,7 @@ class StreamableHTTPClientTransport {
145+ if (!event.event || event.event === 'message') {
146+ try {
147+ const message = types_js_1.JSONRPCMessageSchema.parse(JSON.parse(event.data));
148+ - if ((0, types_js_1.isJSONRPCResultResponse)(message)) {
149+ + if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
150+ // Mark that we received a response - no need to reconnect for this request
151+ receivedResponse = true;
152+ if (replayMessageId !== undefined) {
144153@@ -290,7 +290,38 @@ class StreamableHTTPClientTransport {
145154 this.onclose?.();
146155 }
@@ -518,10 +527,19 @@ index 624172aa24ae255a67c083f9c19053343e4a0581..ac75b14545fda44aff7ff4d97cc5da88
518527@@ -1,5 +1,5 @@
519528 import { createFetchWithInit, normalizeHeaders } from '../shared/transport.js';
520529- import { isInitializedNotification, isJSONRPCRequest, isJSONRPCResultResponse, JSONRPCMessageSchema } from '../types.js';
521- + import { isInitializedNotification, isInitializeRequest, isJSONRPCRequest, isJSONRPCResultResponse, JSONRPCMessageSchema } from '../types.js';
530+ + import { isInitializedNotification, isInitializeRequest, isJSONRPCErrorResponse, isJSONRPCRequest, isJSONRPCResultResponse, JSONRPCMessageSchema } from '../types.js';
522531 import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js';
523532 import { EventSourceParserStream } from 'eventsource-parser/stream';
524533 // Default reconnection options for StreamableHTTP connections
534+ @@ -200,7 +200,7 @@ export class StreamableHTTPClientTransport {
535+ if (!event.event || event.event === 'message') {
536+ try {
537+ const message = JSONRPCMessageSchema.parse(JSON.parse(event.data));
538+ - if (isJSONRPCResultResponse(message)) {
539+ + if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
540+ // Mark that we received a response - no need to reconnect for this request
541+ receivedResponse = true;
542+ if (replayMessageId !== undefined) {
525543@@ -286,7 +286,38 @@ export class StreamableHTTPClientTransport {
526544 this.onclose?.();
527545 }
0 commit comments