Filesystem MCP

io.github.j0hanz由 GitHub 帳號 j0hanz 發布v2.19.3更新於 Nov 8, 2026

Filesystem MCP server for AI assistants.

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,為 AI 助理提供 14 個工具,在你允許的資料夾內列出、搜尋、讀取、比對、編輯、移動與刪除檔案。

可以做什麼
  • 列出可用的根目錄,並以樹狀結構瀏覽資料夾、依名稱或萬用字元尋找檔案
  • 在檔案內容中依字面文字或 RE2 正規表示式搜尋,預設略過 .gitignore 中的檔案與隱藏檔案
  • 檢視並讀取檔案:大小、日期、權限與 token 估算,可整份讀取或依行、開頭、結尾讀取,圖片與音訊以媒體形式回傳
  • 以統一 diff 形式比對兩個檔案
  • 寫入與修改檔案:新建、精確比對取代、套用統一補丁、跨多個檔案批次取代,並可用 dryRun 預覽
  • 移動、重新命名、複製、刪除檔案,並可在 30 分鐘內復原最近的變更
適用情境
適合讓助理直接處理本機專案或文件資料夾,例如找出 TODO、在儲存庫中重新命名符號、寫入前先查看 diff、讀取大型日誌的尾端內容,同時把存取範圍限制在指定目錄內。
執行需求
以 stdio 在本機執行(也可用 --port 走 HTTP)。npx 套件需要 Node.js 24 或更新版本,容器映像需要 Docker。至少透過參數或 FS_ALLOWED_DIRS 指定一個允許的資料夾。未宣告需要帳號或 API 金鑰。
安裝前請注意
預設包含會修改檔案的工具有:edit、patch 與 replace_text 無須確認即生效,create 或複製時使用 overwrite: true 會不經確認覆寫檔案。覆寫、遞迴刪除與越界資料夾的確認提示只在支援該能力的用戶端中有效,否則伺服器直接拒絕。可用 --read-only 或 FS_READ_ONLY_DIRS 限制寫入。.env 與金鑰等敏感檔案預設會被攔截,但可用 --allow 解除。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Filesystem MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[Filesystem MCP logo]

Filesystem MCP

Let your AI assistant work with your files, safely.

Read, search, edit, and patch files in the folders you choose.
Secret files stay hidden, and risky changes wait for your OK.

[npm version] [CI] [License: MIT] [GitHub stars] [HOL Trust] [Filesystem MCP security badge] [Filesystem MCP status badge] [TDQS]

[Install in VS Code] [Install in VS Code Insiders] [Install in Visual Studio] [Install in Cursor] [Install in Claude Desktop]

[filesystem-mcp MCP server – quality and maintenance score on Glama]

Real sessions with a real model, except the web client demo. The apply? prompt comes from the example gatekeeper client, not the server.

Undo skips a file you edited since, so your edit stays

[A model removes a line from a.ts and b.ts. You then edit b.ts in a second pane. Asked to undo, the server restores a.ts, reports b.ts SKIPPED, and your edit stays]

Rename across a repo, reviewed as one diff, with dist/ and .env untouched

[A model renames getUser to fetchUser after showing a diff of four files. getUserById is unchanged, and grep still finds the old name in dist/bundle.js and .env]

Bring back a deleted folder that git can't restore

[A model deletes the gitignored seed-data folder after the server asks about all its contents. Asked to bring it back, undo restores the whole nested folder]

Secret files stay hidden, and overwrites wait for your OK

[The example web client lists a folder with .env hidden, the server refuses to open .env, then asks before overwriting README.md and keeps the file when told to skip]

Move files into an archive, then undo a move that overwrote one

[A model moves three screenshots into archive/2025, and the server asks before overwriting two.png. Undo puts them back, and cat shows the old two.png is restored]

Review different edits to three files as one diff before they are written

[A model adds a retries option. One preview shows different edits to client.ts, server.ts and types.ts, which are written only after approval]

A patch that no longer fits changes nothing

[A model tries a two-hunk patch whose second hunk is stale. It fails, the file stays untouched, and the model explains why, fixes the hunk, applies it, and shows a diff]

Find a crash in a 14 MB log without reading all of it

[A model finds a 14 MB log, reads only its tail, names the db pool error, points at src/pool.ts, and reports that reading the whole log would have cost about 3.5 million tokens]

What is this?

Model Context Protocol (MCP) is how AI apps such as Claude, GitHub Copilot in VS Code, and Cursor connect to tools. Filesystem MCP is an MCP server: a small program that runs on your computer and gives the AI 14 tools for working with files. You choose which folders it can use, and everything outside them is off limits.

Once it is connected, you can ask things like:

  • "Find every TODO in this repo and group them by file."
  • "Rename getUser to fetchUser in all .ts files. Show me the diff first."
  • "What changed between config.dev.json and config.prod.json?"
  • "Read the last 50 lines of server.log and explain the error."
  • "Move the old screenshots into archive/2025/."

Why Filesystem MCP?

  • It is safe by default. The AI can use only the folders you allow, and .env files, private keys, and cloud credentials are blocked. The server asks you before the AI deletes a non-empty folder, opens a folder you did not allow, or writes over a file with create or move. These questions need a client that can show them. If yours cannot, the server refuses each of those actions instead of asking. Only create and copies can skip the question, because overwrite: true replaces a file without asking, on any client. undo can usually restore a file that create or a copy replaced. Edits made with edit, patch, and replace_text apply without asking, but the AI can show you the diff first with dryRun. If the AI should never change anything, --read-only removes every tool that writes.
  • Search and editing are made for code. The AI can search inside files like grep, with a regex engine (RE2) that cannot hang, and by default the server skips .gitignored files and folders like node_modules. Edits are exact-match replacements that return an error when the text does not match, and you can preview them as a diff first.
  • It saves the AI's context. The AI can read many files in one call or only the lines it needs, and it can check a file's size and token estimate before reading it.
  • It works with any MCP client, over stdio or HTTP, on macOS, Linux, and Windows. You can install it with npx, Docker, or a one-click Claude Desktop extension, or build your own client on it.
  • It is private. It runs on your machine, has no telemetry, and makes no network calls.

Compared with the reference server

How this server differs from the official @modelcontextprotocol/server-filesystem, checked against its README on 2026-11-05:

CapabilityFilesystem MCPReference server
Search inside filessearch_text: literal text or RE2 regexNone; search_files matches names only
Secret files.env, keys, and credentials blocked by defaultNot blocked
Overwriting a filecreate asks first; overwrite: true does not askwrite_file overwrites without asking
Delete filesdelete; asks before deleting a non-empty folderNone
Undo a changeundo reverts recent changes; skips files edited sinceNone
.gitignoreRespected by listing and search toolsNot supported
Read-only mode--read-only removes every tool that writes--read-only removes every tool that writes
Per-folder read-only--read-only-root guards chosen foldersRun a second server with --read-only
Apply a unified diffpatchNone
Compare two filesdiffNone
Replace across many filesreplace_text over a folder or globNone
Watch filesSubscribe to a file and get change notificationsNone
Transportstdio, or Streamable HTTP with --portstdio

Quick start

[!NOTE] You need Node.js 24 or later. Check with node --version.

  1. Add the server to your AI app. Pick yours below.
  2. Replace /path/to/project with the folder the AI may use. You can list several folders.
  3. Restart the app and ask: "Which folders can you access?"

[!TIP] VS Code currently shares the folders you have open with the server, so the one-click VS Code install works without a path. In other apps, or over HTTP, put the folder in args. If the AI says it has no folders, that is the fix.

VS Code

Click Install in VS Code above, or add this to .vscode/mcp.json:

json
{  "servers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@j0hanz/filesystem-mcp@latest", "/path/to/project"]    }  }}

Or from a terminal:

sh
code --add-mcp '{"name":"filesystem","command":"npx","args":["-y","@j0hanz/filesystem-mcp@latest","/path/to/project"]}'
Cursor

Click Install in Cursor above, then add your folder to args. Or add this to .cursor/mcp.json in your project, or ~/.cursor/mcp.json for all projects:

json
{  "mcpServers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@j0hanz/filesystem-mcp@latest", "/path/to/project"]    }  }}
Claude Desktop

For a one-click install, download filesystem-mcp.mcpb, open it with Claude Desktop, and pick the folders to allow. Claude Desktop's built-in Node.js runs it. The extension's settings also let you turn on read-only mode, pick read-only folders with a folder picker, block more files, and unblock a built-in secret file.

To set it up by hand, add this to claude_desktop_config.json (Settings → Developer → Edit Config):

json
{  "mcpServers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@j0hanz/filesystem-mcp@latest", "/path/to/project"]    }  }}
Claude Code
sh
claude mcp add filesystem -- npx -y @j0hanz/filesystem-mcp@latest /path/to/project

Or install the plugin, which points the server at your current project:

text
/plugin marketplace add j0hanz/j0hanz-marketplace/plugin install filesystem-mcp@j0hanz-marketplace
Visual Studio

Add this to .vs\mcp.json in your solution folder, or %USERPROFILE%\.mcp.json for all solutions:

json
{  "servers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@j0hanz/filesystem-mcp@latest", "C:/path/to/project"]    }  }}
GitHub Copilot CLI and Antigravity CLI (plugin)

The filesystem-mcp plugin sets the server up for your current project:

ClientInstall
Copilot CLIcopilot plugin marketplace add j0hanz/j0hanz-marketplace, then copilot plugin install filesystem-mcp@j0hanz-marketplace
Antigravity CLIgit clone https://github.com/j0hanz/j0hanz-marketplace, then agy plugin install ./j0hanz-marketplace/plugins/filesystem-mcp
Docker

The container can only see the folders you mount. This setup blocks writes twice, with the :ro mount and with the --read-only flag.

json
{  "mcpServers": {    "filesystem": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "-v",        "/path/to/project:/workspace:ro",        "ghcr.io/j0hanz/filesystem-mcp:latest",        "--read-only",        "/workspace"      ]    }  }}

Drop :ro and --read-only to let the AI make changes. VS Code and Visual Studio use "servers" instead of "mcpServers". See Running in Docker for more.

Other MCP clients

Windsurf, Cline, and most other clients use the same mcpServers JSON as Claude Desktop above. In any client, the server is:

  • command: npx
  • args: -y, @j0hanz/filesystem-mcp@latest, then one or more folders

You can also install it globally and run filesystem-mcp /path/to/project:

sh
npm install -g @j0hanz/filesystem-mcp

Tools

ToolWhat it does
list_rootsShows the folders the server may use.
listLists a folder as a tree, like ls or tree.
find_filesFinds files by name or glob, such as **/*.test.ts.
search_textSearches inside files for text or a regex, like grep, with optional context lines.
statGets size, dates, type, permissions, and a token estimate without reading the file.
readReads text files whole or by lines, head, or tail. Images and audio come back as media; others with binary.
diffCompares two files and returns a unified diff.
create ✎Writes new files, appends, or makes empty folders. Asks before replacing a file; overwrite: true replaces it without asking.
edit ✎Replaces exact text in files. All edits to a file apply, or none do. dryRun shows the diff first.
patch ✎Applies a unified diff to a file. All hunks apply, or none do. dryRun shows the diff first.
replace_text ✎Finds and replaces text or a regex across many files. dryRun shows what would change.
move ✎Moves, renames, or copies files and folders. Asks before overwriting; a copy with overwrite: true replaces without asking.
delete ✎Deletes files and folders. Asks before deleting a non-empty folder.
undo ✎Reverts recent changes by undo id or the last N calls, for 30 minutes while the server runs. Skips files changed since.

✎ changes files. --read-only removes these tools. To refuse changes under one folder while the rest stay writable, pass --read-only-root <dir> (repeatable, or FS_READ_ONLY_DIRS): those tools still exist, but a call that writes, moves, or deletes under the folder fails with Read-only root: ..., while listing, searching, and reading keep working.

Search and listing tools skip hidden files, .gitignored files, and folders like node_modules, dist, and .git unless the AI asks for them.

Configuration

Most people only need the folder argument. These options cover the common cases:

OptionWhat it does
--read-onlyRemoves every tool that changes files.
--read-only-root <dir>Refuses writes, moves, and deletes under this folder, which stays readable. Repeatable.
--deny '<pattern>'Blocks more files, for example --deny 'private/**' or --deny '*.sqlite'.
--allow '<pattern>'Unblocks one built-in secret pattern, for example --allow '.env.example'.
--allow-cwdAlso allows the folder the server was started from.
--max-file-size <n>Largest file read will load, in bytes. Default 10 MiB.
--port <n>Serves over HTTP at http://127.0.0.1:<n>/mcp instead of stdio.
--print-configPrints the settings the server would use, then exits.

Flags go in args after the package name, for example ["-y", "@j0hanz/filesystem-mcp@latest", "--read-only", "/path/to/project"].

The full configuration reference covers every flag and environment variable, the complete secret-file list, limits, HTTP setup with API keys, Docker, and troubleshooting.

Security

ProtectionHow it works
Folder sandboxThe server resolves every path, including symlinks, and the resolved path must stay inside an allowed folder.
Secret files.env, *.pem, *.key, SSH keys, .npmrc, cloud credentials, and more are blocked and hidden from listings.
You stay in chargeThe server asks you before the AI deletes a non-empty folder, gets access to a new folder, or writes over a file with create or move. Only create and copies skip that question: overwrite: true replaces a file without asking, on any client. In-place edits (edit, patch, replace_text) do not ask, but dryRun previews them. A client that cannot show the question gets a refusal instead: a folder outside the list stays closed, a recursive delete of a non-empty folder does not run, and a file is not overwritten unless overwrite: true was passed.
Off-limits foldersNeither the AI nor the client can ever add your home folder itself, system folders, or ~/.ssh, ~/.aws, and similar folders.
Safe writesNew content goes to a temporary file that is then renamed into place, so a crash never leaves a half-written file. Writes keep the file's permissions.
No regex hangsRE2 runs in linear time, so no search pattern can freeze the server.
HTTPThe server listens only on localhost by default. Any other address requires an API key.
ContainerThe Docker image runs as a non-root user.

If you find a vulnerability, please report it privately. SECURITY.md explains how.

Build your own client

You can also call Filesystem MCP from your own code: an agent, an editor plugin, a web app, a CI job, or a script. The same rules apply as for an AI app, so your code cannot reach outside the allowed folders or read secret files.

ts
import { Client } from '@modelcontextprotocol/client';import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
const dir = '/path/to/project';const client = new Client(  { name: 'my-app', version: '1.0.0' },  { capabilities: { elicitation: { form: {} } }, versionNegotiation: { mode: 'auto' } },);client.setRequestHandler('elicitation/create', async () => ({ action: 'decline' }));await client.connect(  new StdioClientTransport({    command: 'npx',    args: ['-y', '@j0hanz/filesystem-mcp', dir],    cwd: dir,  }),);
const result = await client.callTool({ name: 'search_text', arguments: { searchPattern: 'TODO' } });const { matches } = (result.structuredContent ?? result._meta) as { matches: unknown[] };console.log(matches);await client.close(); // stops the server process; without it the script never exits

The basics:

  • Where the data is. The text block is written for a model. The same data as JSON is in _meta for tools that write their own text (list, search_text, edit, ...) and in structuredContent for stat, create, and list_roots. read is the exception: the file's text is only in the text block, and _meta holds metadata about it.
  • Paths. A relative path resolves against the server's working directory when that is inside a root, and against the root otherwise. With several roots, it must exist under exactly one of them. Absolute paths are never ambiguous. Search results are printed relative to the root, or absolute when a relative path would not read back, so a result can be passed straight back. A name that differs from the one on disk only in Unicode form (NFC or NFD) or in its space characters (U+00A0, U+202F) finds that entry.
  • Confirmations. Overwrites, recursive deletes, and paths outside the roots are questions for the user. Declare the elicitation capability and answer them in a handler, or, on the 2026-07-28 protocol, take them as data (input_required) and answer later. A client that can do neither gets a refusal. overwrite: true on create and copies never asks.
  • Protocol versions. The server speaks the 2025 protocol and 2026-07-28, over stdio and Streamable HTTP. Over HTTP, 2025-era clients get no confirmations or change notifications.
  • Resources. Read and subscribe to any file as filesystem-mcp://file/{+path}; internal://instructions and the get-help prompt hold the server's guide for models.

The client guide has the details, tested with the TypeScript and Python SDKs, and examples/ has six runnable clients:

ExampleWhat it is
fsqAny tool from your shell, over stdio or HTTP; --json for scripts
browserA local web UI where the server's questions appear in the page
tailtail -f through file subscriptions, locally or on a remote server
gatekeeperA coding agent that shows each change's diff and waits for your y/N
hooksRuns a task through a model whenever the workspace changes
pythonA TODO report for a workspace, with the Python SDK

Privacy policy

Filesystem MCP runs entirely on your machine. This policy covers the npm package, the Docker image, and the .mcpb desktop extension.

  • Data collection: none. The server has no telemetry, analytics, or crash reporting, and starts no network connections of its own. SECURITY.md names the Windows paths that make the OS contact a host.
  • Use and storage: the server reads and writes files only inside the folders you allow, and only when your MCP client calls a tool. Tool results go to that client and nowhere else. Short-lived result caches and the undo history (saved file contents) live in memory and disappear when the server exits.
  • Third-party sharing: none by this server. Your MCP client may send tool results to its model provider under that client's own privacy policy.
  • Retention: the server keeps nothing after the process exits. Diagnostic logs go to stderr on your machine; your MCP client may save them in its own log files.
  • Contact: open an issue at https://github.com/j0hanz/filesystem-mcp/issues, or report security problems privately through GitHub Security Advisories.

Contributing

Bug reports, ideas, and pull requests are welcome. Start with CONTRIBUTING.md. It covers setup, running the server from source, and the checks a pull request needs.

If Filesystem MCP is useful to you, a star on GitHub helps other people find it.

[Contributors]

License

MIT

來源:README.md,提交 d72f268

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

24
  1. v2.19.2Nov 7, 2026
  2. v2.18.2Nov 5, 2026
  3. v2.17.0Nov 5, 2026
  4. v2.16.0Nov 5, 2026
  5. v2.15.0Nov 3, 2026
  6. v2.13.0Oct 29, 2026
  7. v2.11.0Oct 25, 2026
  8. v2.10.1Oct 23, 2026
  9. v2.10.0Oct 23, 2026
  10. v2.9.1Oct 16, 2026
  11. v2.9.0Oct 16, 2026
  12. v2.8.1Oct 13, 2026
  13. v2.8.0Oct 13, 2026
  14. v2.7.6Oct 12, 2026
  15. v2.7.5Oct 9, 2026
  16. v2.7.3Oct 7, 2026
  17. v2.7.1Oct 2, 2026
  18. v2.7.0Sep 30, 2026
  19. v2.6.3Sep 28, 2026
  20. v2.6.1Sep 27, 2026
  21. v2.5.2Sep 26, 2026
  22. v2.5.0Sep 23, 2026
  23. v2.4.1Sep 18, 2026
  24. v2.3.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分