Repository navigation
Description
Describe the bug
MCP Server starts fine
Claude Desktop (the client) connects and sends an "initialize" message
Immediately after, the connection drops
Either Claude Desktop crashes / exits
Or the server crashes right after receiving the message
Server tries to write back → EPIPE error (because client connection is already closed)
Everything shuts down cleanly but prematurely
To Reproduce
Steps to reproduce the behavior:
- Install MCP server with
npm i @modelcontextprotocol/server-filesystem
Expected behavior
Claude Desktop connects to sever successfully.
Logs
2025-05-12T13:59:25.751Z [info] [filesystem] Initializing server...
2025-05-12T13:59:25.773Z [info] [filesystem] Server started and connected successfully
2025-05-12T13:59:25.783Z [info] [filesystem] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
2025-05-12T13:59:25.784Z [error] [filesystem] write EPIPE
2025-05-12T13:59:25.786Z [info] [filesystem] Server transport closed
2025-05-12T13:59:25.786Z [info] [filesystem] Client transport closed
2025-05-12T13:59:25.787Z [info] [filesystem] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. console.error('...') in JavaScript, print('...', file=sys.stderr) in python) and it will appear in this log.
2025-05-12T13:59:25.787Z [error] [filesystem] Server disconnected. For troubleshooting guidance, please visit our debugging documentation
2025-05-12T13:59:25.787Z [info] [filesystem] Client transport closed
2025-05-12T14:01:11.577Z [info] [filesystem] Initializing server...
2025-05-12T14:01:11.591Z [info] [filesystem] Server started and connected successfully
2025-05-12T14:01:11.596Z [info] [filesystem] Server transport closed
2025-05-12T14:01:11.596Z [info] [filesystem] Client transport closed
2025-05-12T14:01:11.596Z [info] [filesystem] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. console.error('...') in JavaScript, print('...', file=sys.stderr) in python) and it will appear in this log.
2025-05-12T14:01:11.596Z [error] [filesystem] Server disconnected. For troubleshooting guidance, please visit our debugging documentation
2025-05-12T14:01:11.597Z [info] [filesystem] Client transport closed
Activity
[-]Claude Desktop - 'Server transport closed unexpectedly, this is likely due to the process exiting early' error[/-][+]MacOS Claude Desktop - 'Server transport closed unexpectedly, this is likely due to the process exiting early' error[/+]garrettlove8 commentedon May 18, 2025
I'm getting this error with a custom MCP server as well
Ryanb58 commentedon May 19, 2025
Also getting this error.
Runs as expected when done via terminal via the following commands.
I even tried giving claude desktop full disk access.
Running latest version of OSX on M1 Pro.
Logs:
Node Version:
brodkin commentedon May 19, 2025
Same issue here. Running macOS Sequoia v15.5. Works fine in Docker, but only in Docker. Tested with Node v22 and v23
paulchiu commentedon May 20, 2025
This fixed it for me #64 (comment)
TL;DR do
nvm lsand donvm uninstall [version]for anything older than 18. Restart Claude Desktop.katoro commentedon May 20, 2025
it works!
sudokien commentedon Jun 7, 2025
I'm having the same issue on macOS Claude Desktop, using python command.
{ "mcpServers": { "fetch": { "command": "python", "args": ["-m", "mcp_server_fetch"] } }Error log:
If I change the command from
pythontopython3, I'll get this error log instead:It seems like Claude Desktop is trying to use the Apple's system Python in
/Library/Developer/CommandLineTools/usr/bin/python3. How to make it use my miniconda Python instead?Tylersuard commentedon Jul 4, 2025
Same issue! Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e.
console.error('...')in JavaScript,print('...', file=sys.stderr)in python) and it will appear in this log.2025-07-04T06:50:03.173Z [error] [weather] Server disconnected. For troubleshooting guidance, please visit our debugging documentation
When I type nvm in my command line, it says "command not recognized". I am on Windows.
sstklen commentedon Feb 24, 2026
Hey! I ran into a similar pattern in our bug knowledge base and thought this might help.
What's happening: Claude Desktop on macOS spawns MCP server processes without inheriting the user's shell PATH/environment.
npx/noderesolves to a different binary (or fails entirely) compared to your interactive terminal, causing the child process to exit immediately after spawn — hence EPIPE when the server tries to write back to the already-dead pipe.What worked for us:
Use absolute paths for node/npx in your Claude Desktop MCP config, and explicitly set PATH in the env block. Run
which npxandwhich nodein your terminal to get the full paths, then update claude_desktop_config.json.Hope this helps! Let me know if it doesn't match your case — happy to dig deeper. 🦞
🦞 Confucius Debug — community knowledge base for AI agent bugs. Free to search via MCP.
D1no commentedon Mar 29, 2026
Another option is simply to symlink to a known path so claude desktop (and other tools) stay happy. Using NVS (not NVM), but they also symlink through. Run the following for MacOS
Symlinks the default selected node, npm and npx command.
laozhangzzz commentedon Jun 25, 2026
cliffhall commentedon Oct 19, 2026
Closing: superseded by the v2 release.
Thank you for reporting this, and apologies for the long wait for a response.
Since this was filed, the reference servers have been rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers). Each server now runs on v2 of its SDK, and the behavior described here has either been fixed or no longer exists in the same form. This is a Claude Desktop setup report against a pre-v2 release, resolved in the thread by removing an old Node version; the current server requires Node 24 and no defect was identified.
This is not a judgment on whether the problem was real; it's a consequence of the code it describes having been replaced. This is happening as part of the backlog triage in #4875.
If this still happens on the v2 release, we'd genuinely like to know. Please open a fresh issue with the version you're running and steps to reproduce, and we'll look at it. Note that this repository accepts contributions as issues rather than pull requests; see
CONTRIBUTING.md.Thanks for taking the time to report it.