Skip to content

Conversation

@eran3d
Copy link

@eran3d eran3d commented Jan 6, 2026

Summary

Instead of crashing when a configured directory is unavailable (e.g., unmounted external drive, disconnected network share), the server now skips unavailable directories with a warning and continues operating with the remaining available directories.

Problem

Currently, if any directory in allowed_directories is unavailable at startup, the entire server crashes with process.exit(1). This makes ALL filesystem access unavailable, even for paths that are accessible.

This is particularly problematic for:

  • Laptop users with external drives that aren't always connected
  • Users with network shares that may be temporarily unavailable
  • Anyone who wants to configure multiple directories where some might not always be mounted

Solution

The server now:

  • Validates each directory individually
  • Skips unavailable directories with a warning log message
  • Continues operating with the remaining available directories
  • Only exits if ALL specified directories are unavailable

Example log output

Warning: Skipping unavailable directory /Volumes/External-Drive: ENOENT: no such file or directory
Skipped 1 unavailable directory: /Volumes/External-Drive
Server starting with 2 available directories: /Users/username/Documents, /Users/username/Desktop

Testing

Tested locally with a mix of available and unavailable directories. The server now starts successfully and operates on the available directories while logging warnings about the unavailable ones.

Fixes #2815

Instead of crashing when a configured directory is unavailable
(e.g., unmounted external drive, disconnected network share),
the server now:

- Skips unavailable directories with a warning log
- Continues operating with the remaining available directories
- Only exits if ALL specified directories are unavailable

This allows users with external drives or network shares to configure
all their directories without the server failing when some are
temporarily unavailable.

Fixes modelcontextprotocol#2815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Filesystem Server crashes when configured path is unavailable

1 participant