From e440ff56c89d11b29cdbb303eb8a9a71cddc2553 Mon Sep 17 00:00:00 2001 From: Kadxy <2230318258@qq.com> Date: Wed, 15 Jan 2025 18:47:05 +0800 Subject: [PATCH] fix: env not work --- app/mcp/client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/mcp/client.ts b/app/mcp/client.ts index b7b511a92..5c2f071e3 100644 --- a/app/mcp/client.ts +++ b/app/mcp/client.ts @@ -15,7 +15,14 @@ export async function createClient( const transport = new StdioClientTransport({ command: config.command, args: config.args, - env: config.env, + env: { + ...Object.fromEntries( + Object.entries(process.env) + .filter(([_, v]) => v !== undefined) + .map(([k, v]) => [k, v as string]), + ), + ...(config.env || {}), + }, }); const client = new Client(