diff --git a/mcp-client-typescript/index.ts b/mcp-client-typescript/index.ts index 99a185b..a0c5c89 100644 --- a/mcp-client-typescript/index.ts +++ b/mcp-client-typescript/index.ts @@ -183,6 +183,10 @@ async function main() { try { await mcpClient.connectToServer(process.argv[2]); await mcpClient.chatLoop(); + } catch (e) { + console.error("Error:", e); + await mcpClient.cleanup(); + process.exit(1); } finally { await mcpClient.cleanup(); process.exit(0);