Skip to content

filesystem: document hard-link behavior and report the link count in get_file_info #5226

Closed

Description

@cliffhall

The filesystem server's README should spell out what hard links mean for reads and writes, and get_file_info should report a file's link count.

Problem

write_file and edit_file overwrite an existing file in place, and the README says so (src/filesystem/README.md:106: the file "keeps its inode, creation time, hard links and permissions"). It does not spell out the consequence: when a file inside an allowed directory is a hard link to a file elsewhere, both names are the same file, so an overwrite changes the content seen at every name, and a read returns that shared content. Some tools create hard links routinely (pnpm's content-addressable store, for example, hard-links package files into node_modules), so this can happen without anyone choosing it.

The server cannot currently tell a caller whether a file has other names: get_file_info does not report the link count.

Expected

  1. A README paragraph, under write_file (or in a short note on allowed directories), saying that the server's allowed-directory checks are path-based, that a hard link is a real name of the same file, and that overwriting or editing such a file changes it at all of its names.
  2. get_file_info reports the link count (nlink from fs.stat), so a client or model can see that a file has more than one name before changing it.

Tests for the new get_file_info field, and a changeset (minor: a new output field).

Activity

  1. added this to the v2.2.0 milestone on Oct 23, 2026
  2. added
    enhancementNew feature or request
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    on Oct 23, 2026
  3. self-assigned this
    on Oct 27, 2026
  4. added a commit that references this issue on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions