We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3de6e3b commit 4d53e35Copy full SHA for 4d53e35
apps/sim/lib/mcp/client.ts
@@ -281,9 +281,14 @@ export class McpClient {
281
/**
282
* Register a callback to be invoked when the underlying transport closes.
283
* Used by the connection manager for reconnection logic.
284
+ * Chains with the SDK's internal onclose handler so it still performs its cleanup.
285
*/
286
onClose(callback: () => void): void {
- this.transport.onclose = callback
287
+ const existingHandler = this.transport.onclose
288
+ this.transport.onclose = () => {
289
+ existingHandler?.()
290
+ callback()
291
+ }
292
}
293
294
0 commit comments