From 2c8e6361e01afb0da558dc2fe8ce894b14e0d0d9 Mon Sep 17 00:00:00 2001 From: devxpain <170700110+devxpain@users.noreply.github.com> Date: Sat, 24 May 2025 21:21:00 +0800 Subject: [PATCH] fix(mcp): fix error loading config when running MCP Server with npx and bunx The MCP Server was throwing an error 'error loading config: $HOME is not defined' when run using npx and bunx. This was due to the HOME environment variable not being set in the environment. The fix involves setting the HOME environment variable if it is available in the process environment. --- src/services/mcp/McpHub.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/mcp/McpHub.ts b/src/services/mcp/McpHub.ts index e83f7afb9e..a77fc8013f 100644 --- a/src/services/mcp/McpHub.ts +++ b/src/services/mcp/McpHub.ts @@ -451,6 +451,7 @@ export class McpHub { env: { ...(config.env ? await injectEnv(config.env) : {}), ...(process.env.PATH ? { PATH: process.env.PATH } : {}), + ...(process.env.HOME ? { HOME: process.env.HOME } : {}), }, stderr: "pipe", })