MacOS Claude Desktop - 'Server transport closed unexpectedly, this is likely due to the process exiting early' error
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
I'm getting this error with a custom MCP server as well
Also getting this error.
Runs as expected when done via terminal via the following commands.
npx -y @modelcontextprotocol/server-filesystem /Users/tbrazelton/Desktop /Users/tbrazelton/Downloads
npx -y @modelcontextprotocol/inspector npx @modelcontextprotocol/server-filesystem /Users/tbrazelton/Desktop /Users/tbrazelton/Downloads
I even tried giving claude desktop full disk access.
Running latest version of OSX on M1 Pro.
Logs:
2025-05-19T22:43:17.007Z [info] [filesystem] Initializing server...
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:43:17.007Z [filesystem] [info] Initializing server...
2025-05-19T22:43:17.064Z [filesystem] [info] Server started and connected successfully
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:43:17.064Z [info] [filesystem] Server started and connected successfully
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:43:17.067Z [filesystem] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:43:17.067Z [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}
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
npx: installed 59 in 3.189s
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/Users/tbrazelton/Desktop', '/Users/tbrazelton/Downloads' ]
2025-05-19T22:44:17.066Z [filesystem] [info] Message from client: {"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0,"reason":"Error: MCP error -32001: Request timed out"}}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:44:17.067Z [info] [filesystem] Message from client: {"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0,"reason":"Error: MCP error -32001: Request timed out"}}
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:44:17.068Z [filesystem] [info] Client transport closed
2025-05-19T22:44:17.070Z [filesystem] [info] Server transport closed
2025-05-19T22:44:17.070Z [filesystem] [info] Client transport closed
2025-05-19T22:44:17.070Z [filesystem] [info] 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-19T22:44:17.070Z [filesystem] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:44:17.068Z [info] [filesystem] Client transport closed
2025-05-19T22:44:17.070Z [info] [filesystem] Server transport closed
2025-05-19T22:44:17.070Z [info] [filesystem] Client transport closed
2025-05-19T22:44:17.070Z [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-19T22:44:17.070Z [error] [filesystem] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging)
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:44:17.302Z [filesystem] [info] Server transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:44:17.303Z [info] [filesystem] Server transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:44:17.303Z [filesystem] [info] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:44:17.303Z [info] [filesystem] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:47:00.409Z [filesystem] [info] Initializing server...
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:47:00.409Z [info] [filesystem] Initializing server...
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:47:00.472Z [filesystem] [info] Server started and connected successfully
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:47:00.472Z [info] [filesystem] Server started and connected successfully
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:47:00.473Z [filesystem] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:47:00.473Z [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}
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
npx: installed 59 in 2.819s
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/Users/tbrazelton/Documents/Blog Posts' ]
2025-05-19T22:48:00.475Z [filesystem] [info] Message from client: {"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0,"reason":"Error: MCP error -32001: Request timed out"}}
2025-05-19T22:48:00.479Z [filesystem] [info] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:48:00.478Z [info] [filesystem] Message from client: {"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0,"reason":"Error: MCP error -32001: Request timed out"}}
2025-05-19T22:48:00.479Z [info] [filesystem] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:48:00.481Z [filesystem] [info] Server transport closed
2025-05-19T22:48:00.482Z [filesystem] [info] Client transport closed
2025-05-19T22:48:00.482Z [filesystem] [info] 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-19T22:48:00.482Z [filesystem] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:48:00.482Z [info] [filesystem] Server transport closed
2025-05-19T22:48:00.482Z [info] [filesystem] Client transport closed
2025-05-19T22:48:00.482Z [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-19T22:48:00.482Z [error] [filesystem] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging)
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:48:00.704Z [filesystem] [info] Server transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:48:00.704Z [info] [filesystem] Server transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:48:00.704Z [filesystem] [info] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:48:00.704Z [info] [filesystem] Client transport closed
ca
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:51:02.060Z [filesystem] [info] Initializing server...
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:51:02.061Z [info] [filesystem] Initializing server...
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
2025-05-19T22:51:02.102Z [filesystem] [info] Server started and connected successfully
2025-05-19T22:51:02.103Z [filesystem] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:51:02.103Z [info] [filesystem] Server started and connected successfully
2025-05-19T22:51:02.103Z [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}
==> /Users/tbrazelton/Library/Logs/Claude/mcp-server-filesystem.log <==
command not found: /Users/tbrazelton/Desktop
2025-05-19T22:51:02.348Z [filesystem] [info] Server transport closed
2025-05-19T22:51:02.349Z [filesystem] [info] Client transport closed
2025-05-19T22:51:02.349Z [filesystem] [info] 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-19T22:51:02.349Z [filesystem] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-05-19T22:51:02.349Z [filesystem] [info] Client transport closed
==> /Users/tbrazelton/Library/Logs/Claude/mcp.log <==
2025-05-19T22:51:02.349Z [info] [filesystem] Server transport closed
2025-05-19T22:51:02.349Z [info] [filesystem] Client transport closed
2025-05-19T22:51:02.349Z [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-19T22:51:02.349Z [error] [filesystem] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging)
2025-05-19T22:51:02.349Z [info] [filesystem] Client transport closed
Node Version:
➜ ~ node --version
v22.14.0
➜ ~ nvm --version
zsh: command not found: nvm
➜ ~ npm --version
10.9.2
➜ ~
Same issue here. Running macOS Sequoia v15.5. Works fine in Docker, but only in Docker. Tested with Node v22 and v23
This fixed it for me https://github.com/modelcontextprotocol/servers/issues/64#issuecomment-2841435876
TL;DR do nvm ls and do nvm uninstall [version] for anything older than 18. Restart Claude Desktop.
This fixed it for me #64 (comment)
TL;DR do
nvm lsand donvm uninstall [version]for anything older than 18. Restart Claude Desktop.
it works!
I'm having the same issue on macOS Claude Desktop, using python command.
{
"mcpServers": {
"fetch": {
"command": "python",
"args": ["-m", "mcp_server_fetch"]
}
}
Error log:
2025-06-07T10:10:44.177Z [fetch] [info] Initializing server... { metadata: undefined }
2025-06-07T10:10:44.197Z [fetch] [error] spawn python ENOENT {
metadata: {
context: 'connection',
stack: 'Error: spawn python ENOENT\n' +
' at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n' +
' at onErrorNT (node:internal/child_process:483:16)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:90:21)'
}
}
2025-06-07T10:10:44.198Z [fetch] [error] spawn python ENOENT {
metadata: {
stack: 'Error: spawn python ENOENT\n' +
' at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n' +
' at onErrorNT (node:internal/child_process:483:16)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:90:21)'
}
}
2025-06-07T10:10:44.201Z [fetch] [info] Server transport closed { metadata: undefined }
2025-06-07T10:10:44.201Z [fetch] [info] Client transport closed { metadata: undefined }
2025-06-07T10:10:44.201Z [fetch] [info] 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. { metadata: undefined }
2025-06-07T10:10:44.201Z [fetch] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) { metadata: { context: 'connection', stack: undefined } }
If I change the command from python to python3, I'll get this error log instead:
2025-06-07T10:14:44.333Z [fetch] [info] Initializing server... { metadata: undefined }
2025-06-07T10:14:44.379Z [fetch] [info] Server started and connected successfully { metadata: undefined }
2025-06-07T10:14:44.380Z [fetch] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0} { metadata: undefined }
/Library/Developer/CommandLineTools/usr/bin/python3: No module named mcp_server_fetch
2025-06-07T10:14:44.470Z [fetch] [info] Server transport closed { metadata: undefined }
2025-06-07T10:14:44.470Z [fetch] [info] Client transport closed { metadata: undefined }
2025-06-07T10:14:44.471Z [fetch] [info] 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. { metadata: undefined }
2025-06-07T10:14:44.471Z [fetch] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) { metadata: { context: 'connection', stack: undefined } }
2025-06-07T10:14:44.471Z [fetch] [info] Client transport closed { metadata: undefined }
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?
$ which python
/Users/myname/miniconda3/bin/python
$ python --version
Python 3.13.2
$ which python3
/Users/myname/miniconda3/bin/python3
$ python3 --version
Python 3.13.2
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.