瀏覽代碼

fix: env not work

Kadxy 10 月之前
父節點
當前提交
e440ff56c8
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      app/mcp/client.ts

+ 8 - 1
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(