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