@@ -51,7 +51,7 @@ export class MCPClient extends Component {
5151 }
5252
5353 // TODO [Forhad]: Need to check and validate input prompt token
54- const { client } = await this . connectMCP ( mcpUrl ) ;
54+ const { client } = await this . connectMCP ( mcpUrl , logger ) ;
5555
5656 const toolsData = await client . listTools ( ) ;
5757 const conv = new Conversation (
@@ -105,17 +105,17 @@ export class MCPClient extends Component {
105105 return { _error : `Error on running MCP Client!\n${ error ?. message || JSON . stringify ( error ) } ` , _debug : logger . output } ;
106106 }
107107 }
108- private async connectMCP ( mcpUrl : string ) {
108+ private async connectMCP ( mcpUrl : string , logger : any ) {
109109 const client = new Client ( { name : 'auto-client' , version : '1.0.0' } ) ;
110110
111111 // 1) Try Streamable HTTP first
112112 try {
113113 const st = new StreamableHTTPClientTransport ( new URL ( mcpUrl ) ) ;
114114 await client . connect ( st ) ;
115- console . debug ( 'Connected to MCP using Streamable HTTP' ) ;
115+ logger . debug ( 'Connected to MCP using Streamable HTTP' ) ;
116116 return { client, transport : 'streamable' as const } ;
117117 } catch ( e : any ) {
118- console . debug ( 'Failed to connect to MCP using Streamable HTTP, falling back to SSE' ) ;
118+ logger . debug ( 'Failed to connect to MCP using Streamable HTTP, falling back to SSE' ) ;
119119 // 2) If clearly unsupported, fall back to SSE
120120 const msg = String ( e ?. message || e ) ;
121121 const isUnsupported = / 4 0 4 | 4 0 5 | E N O T F O U N D | E C O N N R E F U S E D | C O R S / i. test ( msg ) ;
0 commit comments