From 95c32e48e070ffede2022685d8155a9eb0ed2fe3 Mon Sep 17 00:00:00 2001 From: ksankaran Date: Mon, 30 Jun 2025 03:35:25 +0000 Subject: [PATCH] fix(use-mcp): connect to mcp fails with handleMessage function --- src/react/useMcp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/useMcp.ts b/src/react/useMcp.ts index 3f85c66..baaa7f1 100644 --- a/src/react/useMcp.ts +++ b/src/react/useMcp.ts @@ -235,7 +235,7 @@ export function useMcp(options: UseMcpOptions): UseMcpResult { // Use stable addLog addLog('debug', `[Transport] Received: ${JSON.stringify(message)}`) // @ts-ignore - clientRef.current?.handleMessage(message) // Forward to current client + clientRef.current?.handleMessage?.(message) // Forward to current client } transportInstance.onerror = (err: Error) => { // Transport errors usually mean connection is lost/failed definitively for this transport