# @modelcontextprotocol/server-filesystem ## 2.4.0 ### Minor Changes - [#5536](https://github.com/modelcontextprotocol/servers/pull/5536) [`311c0fd`](https://github.com/modelcontextprotocol/servers/commit/311c0fdc953f38da08153fd2e8d134d03c8e168b) [@cliffhall](https://github.com/cliffhall) - Serve Streamable HTTP as well as stdio ([#576](https://github.com/modelcontextprotocol/servers/issues/576)). `--transport streamable-http` serves the server on one `/mcp` endpoint, for 2026-07-28 and 2025-era clients alike, at `HOST`:`PORT` (`127.0.0.1:3001` by default); stdio stays the default. Over HTTP the filesystem server requires its allowed directories on the command line, since it cannot ask a client for its Roots, and the sequential-thinking history belongs to the server process rather than to one connection. ### Patch Changes - [#5584](https://github.com/modelcontextprotocol/servers/pull/5584) [`89b1152`](https://github.com/modelcontextprotocol/servers/commit/89b1152805e832371219d27fb9ef885e5a325dfb) [@cliffhall](https://github.com/cliffhall) - Fix GHSA-rq2p-q7c4-6g27. ## 2.3.0 ### Minor Changes - [#5451](https://github.com/modelcontextprotocol/servers/pull/5451) [`b766bc2`](https://github.com/modelcontextprotocol/servers/commit/b766bc2488f2692248a0b7ea736806bf94e17091) [@cliffhall](https://github.com/cliffhall) - Add `--read-only-dir `, repeatable, to make one allowed directory read-only while the others stay writable. Every write tool stays listed but refuses a target inside a read-only directory (`move_file` on either end, including moving a directory that contains one, and `copy_file` on its destination), checked on the resolved path so a symlink cannot route around it; a 2025-era client's Roots never lift the marking. Each read-only directory must exist when the server starts, or it refuses to start. `list_allowed_directories` names the read-only directories. ### Patch Changes - [#5475](https://github.com/modelcontextprotocol/servers/pull/5475) [`2a73097`](https://github.com/modelcontextprotocol/servers/commit/2a7309707ce00d340bc8c29288084a1408f14efb) [@cliffhall](https://github.com/cliffhall) - Describe every tool input property in tools/list ([#3669](https://github.com/modelcontextprotocol/servers/issues/3669)). Every filesystem path argument now says how it is resolved and that it must stay inside the allowed directories, and `excludePatterns` says how its globs match (which differs between `directory_tree` and `search_files`). The memory server's top-level array arguments, and the everything server's `resourceType`, gain descriptions, and `get-resource-reference`'s `resourceId` no longer claims to fetch only text resources. - [#5446](https://github.com/modelcontextprotocol/servers/pull/5446) [`92f03ec`](https://github.com/modelcontextprotocol/servers/commit/92f03ec077622ac8f97bc76d977c7ca3ab83f634) [@cliffhall](https://github.com/cliffhall) - `search_files` now reads `excludePatterns` the same way `directory_tree` does: a bare name such as `"node_modules"` excludes an entry of that name at any depth and the whole subtree below it, instead of only one directly under the searched path. Wildcard patterns keep their meaning, and an excluded directory is still never resolved or read. Thanks to @xubenqiang for the prototype fix. - [#5450](https://github.com/modelcontextprotocol/servers/pull/5450) [`39c66a4`](https://github.com/modelcontextprotocol/servers/commit/39c66a4ba9fd3e3c1f74a86b9b191f8bf0cf3beb) [@cliffhall](https://github.com/cliffhall) - On Windows, refuse paths that name an NTFS alternate data stream (`file.txt:stream`, `file.txt::$DATA`): a colon anywhere but the drive-letter prefix now fails with "Access denied - NTFS alternate data stream paths are not supported" instead of letting the tools read or write data no directory listing shows. POSIX hosts are unaffected, since a colon is an ordinary character in a file name there. Thanks to @andreiminca, whose [#4523](https://github.com/modelcontextprotocol/servers/issues/4523) prototyped the check. - [#5447](https://github.com/modelcontextprotocol/servers/pull/5447) [`aef22c8`](https://github.com/modelcontextprotocol/servers/commit/aef22c88090f3cb651cb970e05b003ceb55e62cf) [@cliffhall](https://github.com/cliffhall) - `edit_file`: an `oldText` of whole lines that ends with a newline now matches when only indentation differs, keeping the file's indentation; the trailing newline ends the last line instead of adding an empty one. - [#5448](https://github.com/modelcontextprotocol/servers/pull/5448) [`db2a4fc`](https://github.com/modelcontextprotocol/servers/commit/db2a4fc70c7da86e79d3151cffef50b1dfeea229) [@cliffhall](https://github.com/cliffhall) - A write into a directory that does not exist (`write_file`, `append_file`, `move_file`, `copy_file`) now fails with `Parent directory does not exist: ` instead of a raw `chdir` error that showed the server's working directory. Any other failure to enter a directory names only that directory. - [#5458](https://github.com/modelcontextprotocol/servers/pull/5458) [`03891ce`](https://github.com/modelcontextprotocol/servers/commit/03891ce9e4d622c893488f4ae7b9622d5874080a) [@cliffhall](https://github.com/cliffhall) - On Windows, refuse paths with a component that is a reserved device name (`CON`, `PRN`, `AUX`, `NUL`, `COM1`-`COM9`, `LPT1`-`LPT9`, in any case and with or without an extension) or that ends in a dot or a space (`file.txt.`, `file.txt `), with "Access denied - Windows reserved device names ... are not supported" or "Access denied - Windows path components ending in a dot or a space are not supported". Windows opens the device instead of a file in the allowed directory, and strips trailing dots and spaces so the name refers to a different file. `.` and `..` components are not affected, and POSIX hosts are unaffected. - [#5456](https://github.com/modelcontextprotocol/servers/pull/5456) [`e7b956e`](https://github.com/modelcontextprotocol/servers/commit/e7b956e405f12d6f4bdb652d827da7e962d17db0) [@cliffhall](https://github.com/cliffhall) - An `excludePatterns` glob ending in `/**`, such as `**/node_modules/**`, now also excludes the directory it names in `search_files` and `directory_tree`. Before, the directory itself was still resolved and read, `search_files` could return it, and `directory_tree` listed it as an empty directory; now the whole subtree is pruned before it is touched. - [#5516](https://github.com/modelcontextprotocol/servers/pull/5516) [`f3f636d`](https://github.com/modelcontextprotocol/servers/commit/f3f636d119edb429c5cbb43e534374759edf4685) [@cliffhall](https://github.com/cliffhall) - Anchor read tools to the validated file, as write tools are, and pin the source of a same-device `move_file` to the entry that was validated. A FIFO, socket or device is refused rather than read. - [#5460](https://github.com/modelcontextprotocol/servers/pull/5460) [`5bfe0ae`](https://github.com/modelcontextprotocol/servers/commit/5bfe0ae7301e0d0902a6a18f945c4b9d5c02ec24) [@cliffhall](https://github.com/cliffhall) - The `list_directory` and `list_directory_with_sizes` descriptions now say when to use each one and name the other: `list_directory` for the names directly inside a path (and `directory_tree` for a recursive view), `list_directory_with_sizes` when sizes matter, sorted by name or by size, largest first, with the totals at the end. ## 2.2.0 ### Minor Changes - [#5395](https://github.com/modelcontextprotocol/servers/pull/5395) [`99ba0c6`](https://github.com/modelcontextprotocol/servers/commit/99ba0c60a1b61556f8f30a03e0bf68328ad9331f) [@cliffhall](https://github.com/cliffhall) - Add a `--confine-roots` command-line flag. With it, a 2025-era client's Roots can narrow the command-line directories but never replace or widen them: a root inside a command-line directory is allowed, a root containing one is narrowed to it, and a root outside all of them is ignored and logged. Without the flag, Roots replace the command-line directories as before. - [#5359](https://github.com/modelcontextprotocol/servers/pull/5359) [`ea2997b`](https://github.com/modelcontextprotocol/servers/commit/ea2997b807b157978c0e18760433c9fedb8a20d4) [@cliffhall](https://github.com/cliffhall) - Add a `--read-only` command-line flag. With it the server registers only the tools annotated `readOnlyHint: true`, so every tool that writes (such as `write_file` and `edit_file`) is not listed and cannot be called, on both protocol eras and whether the directories come from the command line or a client's Roots. `--` now ends the options, so a directory named like an option can still be given after it. - [#5376](https://github.com/modelcontextprotocol/servers/pull/5376) [`af8a01b`](https://github.com/modelcontextprotocol/servers/commit/af8a01b598ba5d8037c574a7ef77f2a7bf98c444) [@cliffhall](https://github.com/cliffhall) - Add an `append_file` tool that appends text to the end of a file, exactly as given, creating the file if it does not exist ([#1208](https://github.com/modelcontextprotocol/servers/issues/1208)). - [#5385](https://github.com/modelcontextprotocol/servers/pull/5385) [`65e68d3`](https://github.com/modelcontextprotocol/servers/commit/65e68d3f382b8e097e16d665808d28c3f13b6f71) [@cliffhall](https://github.com/cliffhall) - Add a `copy_file` tool that copies one regular file to a new location, keeping its permissions and modification time, and never overwrites an existing destination ([#519](https://github.com/modelcontextprotocol/servers/issues/519)). - [#5388](https://github.com/modelcontextprotocol/servers/pull/5388) [`3a2e1fd`](https://github.com/modelcontextprotocol/servers/commit/3a2e1fde2252749df82773e7accc5d1976d20313) [@cliffhall](https://github.com/cliffhall) - Add an optional `depth` parameter to `directory_tree` that limits how many levels the tree descends; omitted, the whole tree is returned as before ([#1077](https://github.com/modelcontextprotocol/servers/issues/1077)). - [#5368](https://github.com/modelcontextprotocol/servers/pull/5368) [`3f173d6`](https://github.com/modelcontextprotocol/servers/commit/3f173d6f674cb1e33d45ae724dfc334e1e3a6e73) [@cliffhall](https://github.com/cliffhall) - Expose files in the allowed directories as MCP resources through a `file://{+path}` resource template, so a client can read a file with `resources/read` (text or a base64 blob by MIME type), confined to the allowed directories exactly as the tools are. `resources/list` stays empty, so the server never enumerates the disk. ### Patch Changes - [#5390](https://github.com/modelcontextprotocol/servers/pull/5390) [`6017ed3`](https://github.com/modelcontextprotocol/servers/commit/6017ed304d0df3e23415182c408ee05fc0b523b9) [@cliffhall](https://github.com/cliffhall) - Log the effective allowed directories to stderr, with their source, at startup and whenever they change: from the command line, or from the client's Roots (saying whether those replaced the command-line directories), or none, with why every path is now refused. Previously the server logged only a count of valid Roots. - [#5426](https://github.com/modelcontextprotocol/servers/pull/5426) [`81ca196`](https://github.com/modelcontextprotocol/servers/commit/81ca19651d2b3dd09c616223f7afc35d1e0e16ba) [@cliffhall](https://github.com/cliffhall) - Move `minimatch` to `^11.0.4`. Every 10.x release is affected by GHSA-g3hv-75wg-m249 (denial of service through glob-part amplification), and the `search_files` patterns and the `excludePatterns` of `search_files` and `directory_tree` reach it from the client. The fix is outside the old `^10.0.1` range, so neither a fresh install nor `npm update` could pick it up. - [#5380](https://github.com/modelcontextprotocol/servers/pull/5380) [`d665e43`](https://github.com/modelcontextprotocol/servers/commit/d665e43ee75484889c6910f5fa356b530badbbbf) [@cliffhall](https://github.com/cliffhall) - Report a dangling symlink as a broken symlink. A request through a symlink whose target does not exist is still refused, but the error now names the symlink instead of saying its parent directory, which exists, does not. - [#5379](https://github.com/modelcontextprotocol/servers/pull/5379) [`6575d87`](https://github.com/modelcontextprotocol/servers/commit/6575d8705e95160b3dbfe380da8c0c5e01b170e0) [@cliffhall](https://github.com/cliffhall) - `edit_file`: when an edit's `oldText` matches nowhere, the error now names which edit failed, states the matching rules, and quotes the closest lines of the file with line numbers, plus the first differing line JSON-quoted so a whitespace difference is visible. The tool description now states the matching rules too. What matches is unchanged. - [#5384](https://github.com/modelcontextprotocol/servers/pull/5384) [`eed581e`](https://github.com/modelcontextprotocol/servers/commit/eed581eda6d76eac3229bb73b3555cc1bc18edc6) [@cliffhall](https://github.com/cliffhall) - Expand `~\` to the home directory on Windows, in command-line directories, request paths and client Roots alike, as `~/` already is. On POSIX a backslash is a filename character, so `~\name` there still names a literal file. - [#5377](https://github.com/modelcontextprotocol/servers/pull/5377) [`fbddfb0`](https://github.com/modelcontextprotocol/servers/commit/fbddfb02d8fe8d9fefb29f3e468241c40a490359) [@cliffhall](https://github.com/cliffhall) - `read_text_file` (and the deprecated `read_file`) now treats `head: 0` or `tail: 0` as a request for zero lines and returns empty text, instead of the whole file. `head` and `tail` accept only non-negative integers, and `head` with `tail` is rejected even when either is 0. - [#5353](https://github.com/modelcontextprotocol/servers/pull/5353) [`1a7b9f9`](https://github.com/modelcontextprotocol/servers/commit/1a7b9f975e0390183d18280bf898cea53e631cf3) [@cliffhall](https://github.com/cliffhall) - Every read-only tool (`read_file`, `read_text_file`, `read_media_file`, `read_multiple_files`, `list_directory`, `list_directory_with_sizes`, `directory_tree`, `search_files`, `get_file_info` and `list_allowed_directories`) now also sets `idempotentHint: true` and `destructiveHint: false`, so all four tool annotation hints are explicit on every tool and a client never falls back to the spec's defaults (destructive, not idempotent). - [#5383](https://github.com/modelcontextprotocol/servers/pull/5383) [`22ce3e5`](https://github.com/modelcontextprotocol/servers/commit/22ce3e52148f95bfb991dbfd84d9bcaecb4678f7) [@cliffhall](https://github.com/cliffhall) - Keep an allowed directory's name exactly as the file system spells it. A command-line directory, or a client Root's realpath, whose name ends in a space or a quote was trimmed, so the server allowed the sibling directory without that suffix (and refused the directory that was actually given). - [#5351](https://github.com/modelcontextprotocol/servers/pull/5351) [`13c781a`](https://github.com/modelcontextprotocol/servers/commit/13c781a79411fb04efbd540505cfe0a207f580a1) [@cliffhall](https://github.com/cliffhall) - Drop the unused `glob` runtime dependency: nothing in the server imported it (pattern matching goes through `minimatch`), so installing the server no longer downloads `glob` and its own dependencies. - [#5378](https://github.com/modelcontextprotocol/servers/pull/5378) [`9192ea3`](https://github.com/modelcontextprotocol/servers/commit/9192ea3655cbe4cda51f42c33749008867d298c7) [@cliffhall](https://github.com/cliffhall) - `list_directory_with_sizes` no longer reports an entry it could not stat (unreadable, a dangling symlink, removed mid-listing, or a symlink leaving the allowed directories) as `0 B`. Such an entry is shown with size `unknown`, sorts last by size, and is left out of the combined size, which notes how many files it excludes. - [#5367](https://github.com/modelcontextprotocol/servers/pull/5367) [`4441e23`](https://github.com/modelcontextprotocol/servers/commit/4441e23c4c9e9c6d415b0ef5abb79c00e31f08ce) [@cliffhall](https://github.com/cliffhall) - The `search_files` description now says plainly that it finds files and directories by name, not by content, and that its glob is matched case-sensitively against each entry's path relative to `path` (not the working directory), so a model no longer reaches for it to grep file contents. - [#5355](https://github.com/modelcontextprotocol/servers/pull/5355) [`135a925`](https://github.com/modelcontextprotocol/servers/commit/135a925c04f37ef3b80d87cddd812c964b485853) [@cliffhall](https://github.com/cliffhall) - `search_files` no longer drops a subdirectory it cannot read without saying so. It still returns the matches it found, and now follows them with a note that the search is incomplete, listing each unreadable directory and its error code. Paths outside the allowed directories are still skipped silently, and an unreadable starting directory is still an error. ## 2.1.0 ### Minor Changes - [#5315](https://github.com/modelcontextprotocol/servers/pull/5315) [`15f16b9`](https://github.com/modelcontextprotocol/servers/commit/15f16b9ff8ff68350f16dec80e4d2761dd05c9be) [@cliffhall](https://github.com/cliffhall) - `get_file_info` now reports a file's hard-link count as a `hardLinks: ` line, after `permissions`, so a client can see that a file has other names before changing it. The README now says that allowed-directory checks are path-based, and that overwriting or editing a file that is hard-linked from elsewhere changes it at every name ([#5226](https://github.com/modelcontextprotocol/servers/issues/5226)). ### Patch Changes - [#5326](https://github.com/modelcontextprotocol/servers/pull/5326) [`f3e5d36`](https://github.com/modelcontextprotocol/servers/commit/f3e5d36819cf68cc732c66e854e4a83fc40bb2b0) [@cliffhall](https://github.com/cliffhall) - `search_files`, `directory_tree` and path validation no longer hang on slow provider-backed folders (macOS CloudStorage, iCloud Drive, slow network mounts). Each `realpath` and recursive `readdir` now waits at most 15 seconds and then fails the request with an error naming the path; a path whose realpath times out is refused. `search_files` and `directory_tree` stop with an error after visiting 100,000 entries. `search_files` now applies `excludePatterns` before resolving an entry, so an excluded folder is never touched. - [#5319](https://github.com/modelcontextprotocol/servers/pull/5319) [`b57b04c`](https://github.com/modelcontextprotocol/servers/commit/b57b04c479d87a312728378a321beab0c1baec64) [@cliffhall](https://github.com/cliffhall) - A path that spells an allowed directory's own name in a letter case matching neither the configured nor the on-disk spelling (for example `C:\Work\CASETEST\file.txt` for an allowed `C:\Work\CaseTest`) is no longer refused on a case-insensitive file system (Windows NTFS, default macOS APFS). The request is mapped onto the allowed directory only where the file system confirms, component by component, that both spellings name one entry, so a sibling directory differing only in case is still refused on a case-sensitive directory. - [#5325](https://github.com/modelcontextprotocol/servers/pull/5325) [`322dcf0`](https://github.com/modelcontextprotocol/servers/commit/322dcf02e79f9a2dc74a32dba1337a42dbf74e02) [@cliffhall](https://github.com/cliffhall) - `write_file` and `edit_file` compare the file they opened against the one they checked as BigInt stats, so a Windows file id above 2^53 is compared exactly rather than rounded. Where a path-based stat on Windows reports no device (libuv < 1.51.0, the Node 23 line), the overwrite no longer refuses every existing file: the file must instead match on inode, size and modification time, and any difference still refuses. - [#5317](https://github.com/modelcontextprotocol/servers/pull/5317) [`d98c856`](https://github.com/modelcontextprotocol/servers/commit/d98c8566ef278a6caf802b7db8f647ca1e377981) [@cliffhall](https://github.com/cliffhall) - A client Root is now allowed in the form the client advertised it as well as in its resolved form, as command-line directories already were. A request that names a path through a symlinked Root's own spelling (for example `/tmp/...` for a Root of `file:///tmp/...` on macOS) is no longer refused, and `list_allowed_directories` lists both forms. Every request is still resolved and checked against the resolved directory, so a symlink inside a Root that points outside it stays refused. - [#5318](https://github.com/modelcontextprotocol/servers/pull/5318) [`dfe9187`](https://github.com/modelcontextprotocol/servers/commit/dfe9187334af83208a27ba871abc4d729e39685d) [@cliffhall](https://github.com/cliffhall) - A Root or command-line directory whose `realpath` fails once is now retried after a short delay instead of being lost for the life of the process. On Windows the first native `realpath` right after `subst` maps a drive can fail before the mapping is visible; a Root was dropped as inaccessible, and a command-line directory lost its resolved spelling, so every request on the drive was refused. - [#5324](https://github.com/modelcontextprotocol/servers/pull/5324) [`1002969`](https://github.com/modelcontextprotocol/servers/commit/1002969d59dc1e1a6e6754ecea7d12c689833c6d) [@cliffhall](https://github.com/cliffhall) - `read_text_file` with `head` no longer leaves a `\r` at the end of each line of a CRLF file. Like `tail`, it returns lines normalized to LF, including a `\r\n` pair split across a read chunk. LF output is unchanged. - [#5316](https://github.com/modelcontextprotocol/servers/pull/5316) [`30afc34`](https://github.com/modelcontextprotocol/servers/commit/30afc34bfcc851ed0175b727c45320de57c3fe6b) [@cliffhall](https://github.com/cliffhall) - `read_text_file` with `tail` no longer returns one line too few when the file ends with a newline: the final newline ends the last line instead of counting as an empty one, for LF and CRLF files and for files longer than one read chunk. Like `head`, the result carries no trailing newline. - [#5322](https://github.com/modelcontextprotocol/servers/pull/5322) [`f438a62`](https://github.com/modelcontextprotocol/servers/commit/f438a620a601cf5ed489cc476d93066573f8c4f2) [@cliffhall](https://github.com/cliffhall) - `move_file` now moves a regular file between allowed directories on different filesystems (mounts, disks or shares), where it used to fail with `EXDEV`: it copies the file to a newly created destination, keeping its permissions and modification time, then removes the source, and removes a partial copy if anything fails. A directory still cannot be moved across filesystems, and now fails with an error that says so. ## 2.0.1 ### Patch Changes - [#5236](https://github.com/modelcontextprotocol/servers/pull/5236) [`a2fd82c`](https://github.com/modelcontextprotocol/servers/commit/a2fd82c6e995d8dc8ac10831bb0c173f7126612d) [@cliffhall](https://github.com/cliffhall) - Harden path validation for new files and directories. - [#5235](https://github.com/modelcontextprotocol/servers/pull/5235) [`c0d81fc`](https://github.com/modelcontextprotocol/servers/commit/c0d81fcb967db28c47276bc42a6c72ad576f550b) [@cliffhall](https://github.com/cliffhall) - Harden path validation. - [#5234](https://github.com/modelcontextprotocol/servers/pull/5234) [`3f9dd79`](https://github.com/modelcontextprotocol/servers/commit/3f9dd797999feeb69127632935d0d9e56ca80e5e) [@cliffhall](https://github.com/cliffhall) - Harden path validation in directory listings. - [#5237](https://github.com/modelcontextprotocol/servers/pull/5237) [`5e811d4`](https://github.com/modelcontextprotocol/servers/commit/5e811d41fa43d843164f7c7463ab580e951187b2) [@cliffhall](https://github.com/cliffhall) - Harden path handling in write operations. ## 2.0.0 ### Major Changes - [#5118](https://github.com/modelcontextprotocol/servers/pull/5118) [`5b400a6`](https://github.com/modelcontextprotocol/servers/commit/5b400a6ec05bd883522665ebeae110bf1a2744ff) [@cliffhall](https://github.com/cliffhall) - Move to the TypeScript SDK v2 packages (`@modelcontextprotocol/server`) from `@modelcontextprotocol/sdk` 1.x ([#4856](https://github.com/modelcontextprotocol/servers/issues/4856)). Breaking for clients: the server now requires Node.js 24 or later; over stdio, a single incoming JSON-RPC message larger than 10 MiB now closes the connection (the SDK v2 default read-buffer cap; SDK 1.x buffered without a limit); an unknown tool name is rejected with JSON-RPC error `-32602` instead of returning an `isError` result; error messages no longer carry the `MCP error : ` prefix, and input-validation messages name the field first (`field: message`); and tools no longer advertise `execution.taskSupport`. ### Minor Changes - [#5131](https://github.com/modelcontextprotocol/servers/pull/5131) [`419200b`](https://github.com/modelcontextprotocol/servers/commit/419200b8a4d1e66c294575930ac7be29d4b37330) [@cliffhall](https://github.com/cliffhall) - Serve the 2026-07-28 protocol revision alongside the 2025 era on stdio, through the SDK's `serveStdio` entry ([#4852](https://github.com/modelcontextprotocol/servers/issues/4852)). A 2026-07-28 connection has no `initialize` and no server-to-client `roots/list`, and Roots is deprecated as of that revision, so the command-line directories are its whole allow-list; a server started with none answers each tool call on such a connection with an error saying so. 2025-era clients keep the Roots behavior they had. The README now recommends command-line directories over Roots ([#4844](https://github.com/modelcontextprotocol/servers/issues/4844)). ## 1.0.0 The first semantic version, resuming semver after the date-stamped releases (last `2026.8.31`). It describes everything since `2026.8.31`, and is the last release of the legacy-era server, on the 1.x MCP SDK. ### Patch Changes - [#4970](https://github.com/modelcontextprotocol/servers/pull/4970) [`3a63f52`](https://github.com/modelcontextprotocol/servers/commit/3a63f52e751882e20b24e8f0c840d402348bbd72) [@cliffhall](https://github.com/cliffhall) - Internal: the server is now built by a `createServer()` factory in `server.ts`, and `index.ts` starts it over stdio only when run as the bin, with each server instance holding its own allowed directories. No change to the tools, their results, or how the allowed directories are resolved from arguments and Roots. - [#5011](https://github.com/modelcontextprotocol/servers/pull/5011) [`d8ebdbe`](https://github.com/modelcontextprotocol/servers/commit/d8ebdbef770768c05d9fddbb663bc6f380a08867) [@cliffhall](https://github.com/cliffhall) - `edit_file` keeps a file's line endings: a CRLF file is written back with CRLF instead of being converted to LF. When `oldText` has no exact match and the whitespace-tolerant matcher is used, each replacement line now takes the indentation of the file line it replaces, shifted by its indentation relative to the matching `oldText` line, instead of only the first line being reindented. - [#5022](https://github.com/modelcontextprotocol/servers/pull/5022) [`7dc802f`](https://github.com/modelcontextprotocol/servers/commit/7dc802f914a727e840b65712b0a9fbaf7fe1c2b5) [@cliffhall](https://github.com/cliffhall) - `write_file` and `edit_file` now overwrite an existing file in place instead of renaming a temp file over it, so the file keeps its inode, creation time (birthtime), hard links and permission bits ([#4512](https://github.com/modelcontextprotocol/servers/issues/4512)), and an overwrite no longer fails with `EPERM` on Windows when another process holds the file open ([#3199](https://github.com/modelcontextprotocol/servers/issues/3199)). A symlink swapped in after the path was validated is still refused rather than written through, now by an `O_NOFOLLOW` open (on POSIX) and a check that the opened file is the one validated (on every platform). The overwrite is no longer crash-atomic. A read-only file is now refused (`EACCES`, or `EPERM` on Windows) instead of being replaced, since writing in place opens the file itself for writing. - [#5025](https://github.com/modelcontextprotocol/servers/pull/5025) [`2309e08`](https://github.com/modelcontextprotocol/servers/commit/2309e089b12385650e52784e26668aabdbc9b74b) [@cliffhall](https://github.com/cliffhall) - Tool calls now wait for the client's initial roots before checking paths, so a call sent right after connecting is no longer refused with "Access denied" ([#3204](https://github.com/modelcontextprotocol/servers/issues/3204)). A server started with no directories, connected to a client without Roots support, now fails visibly: it logs the reason, closes the connection and exits with status 1, instead of staying up and refusing every call ([#4992](https://github.com/modelcontextprotocol/servers/issues/4992)). - [#5030](https://github.com/modelcontextprotocol/servers/pull/5030) [`5c04d74`](https://github.com/modelcontextprotocol/servers/commit/5c04d74ff6430ae82763aae76b3b1e585f5f13fd) [@cliffhall](https://github.com/cliffhall) - Every tool's input and output schema in `tools/list` now declares `"$schema": "https://json-schema.org/draft/2020-12/schema"` instead of draft-07, so clients that validate tool schemas strictly against JSON Schema 2020-12 no longer reject every tool. The schemas are otherwise unchanged. - [#5087](https://github.com/modelcontextprotocol/servers/pull/5087) [`09edf63`](https://github.com/modelcontextprotocol/servers/commit/09edf633b93cdaf094ba43622294d587afcd1023) [@cliffhall](https://github.com/cliffhall) - Require `@modelcontextprotocol/sdk` 1.31.0 or later (was `^1.30.0`), so an install can no longer resolve an SDK version affected by GHSA-6qxp-vccf-f47h. The advisory concerns the SDK's OAuth client, which this server does not use. - [#5010](https://github.com/modelcontextprotocol/servers/pull/5010) [`fd4dff7`](https://github.com/modelcontextprotocol/servers/commit/fd4dff7da877068734bee9419fa935213d66e359) [@cliffhall](https://github.com/cliffhall) - On Windows, a UNC share root given as an allowed directory (`\\server\share` or `\\server\share\`) now admits the files and subdirectories under it. Before, only the share root itself was accessible and every path below it was refused. Sibling shares such as `\\server\share-evil` are still refused. - [#5009](https://github.com/modelcontextprotocol/servers/pull/5009) [`f621c75`](https://github.com/modelcontextprotocol/servers/commit/f621c75a92347738f28f26c9461286764beba3c8) [@cliffhall](https://github.com/cliffhall) - Paths that differ from the names on disk only in Unicode form now resolve ([#1970](https://github.com/modelcontextprotocol/servers/issues/1970)). An NFC spelling of an allowed directory whose name is stored NFD (macOS "Capture d’écran", Japanese dakuten) is no longer refused as outside the allowed directories, and a request that spells a U+202F or U+00A0 in a name as a plain space (the macOS screenshot "Screenshot … at 2.40.40 PM.png") finds the file instead of failing with ENOENT. The exact spelling still wins when it exists, and a name matching two entries is refused as ambiguous. - [#5094](https://github.com/modelcontextprotocol/servers/issues/5094) [`bea1c9a`](https://github.com/modelcontextprotocol/servers/commit/bea1c9a1bd623aea093a4408b0f71e95cd0e1d03) [@cliffhall](https://github.com/cliffhall) - A `roots/list_changed` update that leaves no valid root now revokes access once the client's roots are in force, instead of keeping the previous allowed directories, so a client that withdraws its roots withdraws the server's access too (#5094). Every path is then refused with "Access denied - no allowed directories" until the client exposes a root again. Before any root has been in force, such an update still keeps the command-line directories. - [#5097](https://github.com/modelcontextprotocol/servers/issues/5097) [`a13e809`](https://github.com/modelcontextprotocol/servers/commit/a13e809d95d6771159483a69e707d0466a9fe1b1) [@cliffhall](https://github.com/cliffhall) - Overlapping roots refreshes now take effect in the order they started: when a client sends `roots/list_changed` again before the previous `roots/list` answer arrived (or while the initial roots are still loading), an answer that arrives after a newer refresh has started is discarded instead of overwriting it, so a stale answer can no longer undo a newer update such as a revocation (#5097). - [#5101](https://github.com/modelcontextprotocol/servers/issues/5101) [`3f6aaf4`](https://github.com/modelcontextprotocol/servers/commit/3f6aaf4ff6b3d48243f8a94f1ea8dafb574de5ad) [@cliffhall](https://github.com/cliffhall) - Tool calls that arrive while a `roots/list_changed` refresh is fetching the client's roots now wait for it, as they already did for the initial roots, so a call can no longer reach a root the client has just withdrawn while the answer is pending (#5101).