Description
Describe the bug
In this line
typescript-sdk/src/client/stdio.ts
Line 119 in 0fa2397
To Reproduce
Steps to reproduce the behavior:
- Connect a stdio client without custom env (works)
- Connect the same client with custom env (fails because HOME, PATH and other default envs are missing when spawning the process)
Expected behavior
Both cases should pass.
env: { ...getDefaultEnvironment(), ...(this._serverParams.env ?? {}) },
Logs
file:///Users/pradeeptadash/langchain_mcp/node_modules/@langchain/mcp-adapters/dist/src/client.js:407
throw new MCPClientError(Failed to connect to stdio server "${serverName}": ${error}
, serverName);
^
MCPClientError: Failed to connect to stdio server "linear-server": Error: spawn npx ENOENT
at MultiServerMCPClient.initializeStdioConnection (file:///Users/pradeeptadash/langchain_mcp/node_modules/@langchain/mcp-adapters/dist/src/client.js:407:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MultiServerMCPClient.initializeConnections (file:///Users/pradeeptadash/langchain_mcp/node_modules/@langchain/mcp-adapters/dist/src/client.js:371:17)
Additional context
Add any other context about the problem here.