Skip to content

Filesystem MCP server crashes silently on paths containing ~ (tilde) character #3412

Description

@skl-chip

Filesystem MCP server crashes silently on directory paths containing leading ~ (tilde) character


Environment:

  • Claude Desktop: Latest (as of February 26, 2026)
  • macOS: Sequoia (Apple Silicon)
  • Node.js: v25.4.0 (Homebrew)
  • MCP Filesystem Extension: Installed via Claude Desktop extensions marketplace

Description:

The Filesystem MCP server crashes silently when any of the configured allowed directories contains a leading tilde (~) as a literal character in the folder name (e.g., /Volumes/Drive/Projects/~MyFolder). This is a valid and common naming convention used to force important folders to sort to the top of a directory listing.

The server starts successfully, receives the initialize handshake from the client, then immediately exits with no error message or stack trace. The failure is silent — nothing in the logs indicates what went wrong.

Log snippet showing failure pattern:

2026-02-26T15:12:22.731Z [Filesystem] [info] Server started and connected successfully
2026-02-26T15:12:22.867Z [Filesystem] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2025-11-25"...}
2026-02-26T15:12:22.877Z [Filesystem] [info] Server transport closed unexpectedly, this is likely due to the process exiting early.
2026-02-26T15:12:22.877Z [Filesystem] [error] Server disconnected.

Steps to reproduce:

  1. Install the Filesystem MCP extension via Claude Desktop
  2. Add an allowed directory whose name begins with ~ (e.g., /Volumes/Drive/Projects/~MyFolder)
  3. Relaunch Claude Desktop
  4. Observe server fails with "Server disconnected" and no descriptive error

Verification:

Running the server manually works without issue:

node "/Users/<user>/Library/Application Support/Claude/Claude Extensions/ant.dir.ant.anthropic.filesystem/server/index.js" "/Volumes/Drive/Projects/~MyFolder"

Output: Secure MCP Filesystem Server running on stdio

Removing the ~ prefix from the directory name resolves the issue immediately, confirming the tilde character is the root cause.

Expected behavior:

The server should either handle ~ as a literal character in directory paths, or throw a descriptive error identifying the problematic path rather than crashing silently.

Impact:

Using ~ as a prefix to sort important folders to the top of a directory listing is a common convention. Any user employing this pattern will hit this bug with no indication of what went wrong, requiring significant debugging effort to isolate.

Activity

  1. added a commit that references this issue on Mar 17, 2026
    12f3158
  2. nanami-0713 commented on Sep 27, 2026

    @nanami-0713

    I could not reproduce this on current main (f46d957) — it looks like the marketplace build predates the guards that were added since.

    What I ran (macOS ARM, Node 26): a full stdio MCP session against the built server with an allowed directory whose name starts with a literal tilde, exactly the reported shape:

    mkdir -p '/tmp/mcp-test/~TildeProject' && echo 'hello tilde' > '/tmp/mcp-test/~TildeProject/note.txt'
    node dist/index.js /tmp/mcp-test
    

    Session transcript (JSON-RPC over stdio):

    • initialize → ok (serverInfo: secure-filesystem-server)
    • startup log: Client does not support MCP Roots, using allowed directories set from server args: [ '/tmp/mcp-test', '/private/tmp/mcp-test' ]
    • tools/list → ok, 14 tools
    • tools/call list_directory {"path": "/tmp/mcp-test/~TildeProject"} → [FILE] note.txt
    • tools/call read_file {"path": "/tmp/mcp-test/~TildeProject/note.txt"} → hello tilde
    • no transport close, no exit

    The current code is defensive at every step of the reported path: expandHome (src/filesystem/path-utils.ts:119-124) only expands a leading ~/ or bare ~, so /Volumes/…/~MyFolder passes through untouched; startup validation skips inaccessible dirs with a warning instead of throwing (src/filesystem/index.ts:46-80); and the roots-protocol path wraps every conversion in try/catch (src/filesystem/roots-utils.ts:13-25, 52-77).

    Given the reporter's log is from the Claude Desktop marketplace build (Feb 2026), the silent crash they hit was most likely in a build before those guards landed. #3414 (open since June, last activity 2026-06-13) also adds tilde-path test coverage for this area — maybe worth reviving or superseding so this report can be closed against a released build.

    AI-assisted analysis note: the session above was executed locally by me against a fresh build of current main; the transcript is verbatim.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions