Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup when running onClose
  • Loading branch information
waleedlatif1 committed Feb 9, 2026
commit 4d53e3543916ab333873cb8d62e3b4bc678bf661
7 changes: 6 additions & 1 deletion apps/sim/lib/mcp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,14 @@ export class McpClient {
/**
* Register a callback to be invoked when the underlying transport closes.
* Used by the connection manager for reconnection logic.
* Chains with the SDK's internal onclose handler so it still performs its cleanup.
*/
onClose(callback: () => void): void {
this.transport.onclose = callback
const existingHandler = this.transport.onclose
this.transport.onclose = () => {
existingHandler?.()
callback()
}
}

/**
Expand Down