Skip to content

Commit 50ab76b

Browse files
committed
MCP logs tweak
1 parent b959857 commit 50ab76b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/core/src/Components/MCPClient.class.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = /404|405|ENOTFOUND|ECONNREFUSED|CORS/i.test(msg);

0 commit comments

Comments
 (0)