filesystem MCP: MCP filesystem Server disconnected (nvm node not on PATH)
Fixes the filesystem MCP server showing Server disconnected in Claude Desktop when Node was installed via nvm. Use when the server never connects and you installed Node with nvm. Not for wrong directory paths or permission errors.
Fix filesystem MCP MCP filesystem: Server disconnected (nvm Node)
TL;DR
If you installed Node with nvm, Claude Desktop cannot find your npx. Create a small wrapper script that puts your nvm Node bin directory on PATH and execs npx, then point the server's command at the wrapper.
The exact symptom in Claude Desktop:
MCP filesystem: Server disconnectedSteps
1. Find your nvm Node path
which nodeSuccess check: it prints something like [HOME]/.... Copy the directory part up to /bin.
2. Create the wrapper script
Create /usr/local/bin/npx-for-claude with:
#!/usr/bin/env bash
export PATH="[your nvm node bin dir]:$PATH"
exec npx "$@"Replace [your nvm node bin dir] with the directory from step 1, e.g. [HOME]/.... Then:
chmod +x /usr/local/bin/npx-for-claudeSuccess check: /usr/local/bin/npx-for-claude --version prints an npx version.
3. Point the MCP config at the wrapper
Edit claude_desktop_config.json:
{
"mcpServers": {
"filesystem": {
"command": "npx-for-claude",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "[an absolute allowed directory]"]
}
}
}Success check: command is the wrapper, not bare npx.
4. Restart Claude Desktop fully
Quit the app and end any leftover Claude processes, then reopen.
Success check: the filesystem server shows connected and list_directory works on the allowed directory.
When this applies
- Claude Desktop shows
MCP filesystem: Server disconnectedfor the filesystem server. which nodein your terminal points inside.nvm.- The same config works on machines where Node was installed system-wide.
When it does not apply
- The server starts but refuses a path. That is the allowed-directories problem: the directory must be absolute and listed in
args. - You get permission errors reading files. That is OS permissions, not the launcher.
Tool compatibility
- @modelcontextprotocol/server-filesystem
- Claude Desktop on macOS (nvm installs)
- Node.js via nvm (any recent version)
Why it happens
Claude Desktop launches MCP servers with a minimal environment that does not source your shell profile, so nvm's PATH entries are missing. Bare npx then resolves to nothing (or the wrong node), the server process dies instantly, and the client reports the generic "Server disconnected" with no hint that the launcher was the problem.
Edge cases
- If you switch nvm Node versions, update the wrapper's PATH or the server will silently run the old version.
- On Apple Silicon vs Intel mismatches, make sure the nvm Node arch matches the client.
- An alternative some users prefer: use the absolute path to npx in
command(fromwhich npx) instead of a wrapper; it breaks on every nvm version switch.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.