Fix/mcp environment inheritance #3909
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
connect #3904, connect #3902, connect #3681, connect #3671, connect #3703
What is in this change?
Problem: MCP servers fail to start when AnythingLLM is launched via GUI on macOS, Docker, and other environments with
-32000 Connection closed
errors. The root cause is improper environment variable inheritance in the#buildMCPServerENV
method.Root Issues Fixed:
npx
/node
not found errors/usr/bin/node
) instead of modules directory (/usr/local/lib/node_modules
)env
specified, method returns empty object instead of essential PATH/NODE_PATHEvidence:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
(missing/usr/local/bin
) β MCP failsPATH=/usr/local/bin:/usr/local/Cellar/node/23.11.0/bin:/usr/bin:/bin
β MCP worksSolution:
User Experience Improvement:
The fix enables clean, natural MCP configurations without shell workarounds:
β Now Works:
Developer Validations
yarn lint
from the root of the repo & committed changes