Logo Filesystem MCP Server

Filesystem MCP Server

Cộng đồng
j0hanz

A local filesystem MCP server that lets LLMs and AI agents read, write, search, diff, patch, and manage files safely and efficiently. Built for reliable, structured, and controlled filesystem interaction.

Nhà phát hànhj0hanz
Kho mãfilesystem-mcp
Ngôn ngữTypeScript
Bản fork
5
Sao
22
Công cụ có sẵn
18
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Filesystem MCP Server cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 18 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    22 sao và 5 bản fork từ kho mã được liên kết.

Filesystem MCP Server

License npm version Build GitHub stars

Install in VS Code Install in VS Code Insiders Install in Visual Studio Install in Cursor

Overview

Filesystem-MCP is a Model Context Protocol server that lets AI assistants read and write files within explicitly allowed directories. Sensitive file patterns (.env, *.pem, *id_rsa*) are blocked by default. It exposes filesystem tools, resources, and prompts over stdio or Streamable HTTP transport.

AspectDetails
StatusActive (see npm badge for the current version)
LanguageTypeScript (strict)
RuntimeNode.js >= 24
Packagenpm
LicenseMIT

Features

FeatureDescription
Path guardingEvery path is validated against allowed roots; .env, *.pem, *id_rsa* and similar patterns are denied
Filesystem toolsNavigate, inspect, read, and write across all major file operations
Batch operationsMost tools accept path, paths[], or files[] for parallel execution
Dual transportstdio by default; --port enables Streamable HTTP for both 2025-era and 2026-07-28 clients
File subscriptionsResource subscriptions push change notifications when watched files update
Regex safetyRE2 in all search tools: linear-time matching, so no pattern can ReDoS the server

Built with

Node.js TypeScript Docker

LayerTechnology
ProtocolMCP SDK v2 (@modelcontextprotocol/server)
RuntimeNode.js >= 24 · TypeScript 6 · ESM
Transportstdio (default) · Streamable HTTP (--port)
RegexRE2 (re2-wasm) — linear time, no lookahead/lookbehind/backreferences
ContainerDocker alpine · multi-stage build · non-root user

Table of Contents

Quick start

[!NOTE] Requires Node.js ≥ 24.

Prerequisites

RequirementVersion / Notes
Node.js≥ 24
npmBundled with Node.js
DockerOptional — for container use

Install via npx

bash
npx -y @j0hanz/filesystem-mcp /path/to/allowed/dir

Or install globally:

bash
npm install -g @j0hanz/filesystem-mcp
filesystem-mcp /path/to/allowed/dir

Install via Docker

bash
docker run -i --rm \
  -v /path/to/project:/workspace:ro \
  ghcr.io/j0hanz/filesystem-mcp:latest \
  --read-only /workspace

Configure in VS Code

Add to .vscode/mcp.json:

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

Or install via CLI:

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

Configure in Visual Studio

Add to .vs\mcp.json in your solution directory, or %USERPROFILE%\.mcp.json for a global configuration:

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

Configure in Claude Desktop

Add to your claude_desktop_config.json:

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

Install in Cursor

Add to .cursor/mcp.json in your project root (project-scoped), or ~/.cursor/mcp.json for a global configuration:

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

Docker configuration

VS Code (.vscode/mcp.json) and Visual Studio (.vs\mcp.json):

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

Claude Desktop (claude_desktop_config.json) and Cursor (mcp.json):

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

[!NOTE] For least privilege, use both controls: :ro makes the container mount read-only at the operating-system boundary, while the server's --read-only flag removes mutating tools (create, edit, move, delete, patch, replace_text) from tools/list.

Usage

Tools

All tools are scoped to the configured roots. Call list_roots first to discover what is allowed.

Navigate

ToolDescription
list_rootsList allowed workspace roots. Call this first — all other tools scope to these.
listList directory contents. Returns entries (dirs-first, alphabetical) and an ASCII tree.
find_filesFind files by glob pattern (e.g. **/*.ts). Returns matching files with metadata.

Inspect

ToolDescription
statGet file/directory metadata: size, modified time, permissions, MIME type, token estimate.
search_textSearch file contents for text (grep-like). Returns matching lines with context.
diffCompare two files and return a unified diff with added/removed line counts.

Read

ToolDescription
readRead a text file. Supports head/tail and line ranges. Accepts paths[] for batches.

Write

ToolDescription
createCreate one or more files, creating parent directories as needed. An existing file prompts the user to confirm the overwrite; overwrite: true on an entry skips the prompt, append: true adds to the end instead.
editApply sequential literal string replacements to one or more files (max 5 per call).
moveMove, rename, or copy (copy: true) one or more files/directories to explicit destinations.
deletePermanently delete one or more files or directories. This action is irreversible.
replace_textBulk search-and-replace across files matching a glob pattern.
patchApply a single-file unified diff and write the result.

Resources

URIDescription
internal://instructionsServer navigation guide — tools overview, constraints, and error recovery.
filesystem-mcp://file/{+path}Read a workspace file. Subscribe to receive push notifications on change.
filesystem-mcp://result/{id}Ephemeral cached tool output. Expires after ~60 seconds, eviction, or server restart.

Prompts

PromptDescription
get-helpReturn usage instructions, optionally filtered to a specific section.

Project structure

text
filesystem-mcp/
├── __tests__/        Test suites
├── src/
│   ├── core/         Path guarding, filesystem abstraction, concurrency, observability
│   ├── tools/        Tool definitions and registration
│   ├── index.ts      Process entrypoint and transport selection
│   ├── server.ts     Server factory and registrar composition
│   ├── transport/    stdio and Streamable HTTP transport setup
│   ├── prompts.ts    Prompt definitions and registration
│   └── resources.ts  Resource definitions and registration
└── Dockerfile        Multi-stage alpine build, non-root user

Runtime composition flows from src/index.ts to src/transport.ts, then to src/server.ts, the registrars, and finally src/core/. Each registrar owns the narrow dependency contract it consumes.

PathPurpose
src/core/path.tsPathGuard — validates every path against allowed roots
src/core/fs.tsGuardedFileSystem — guarded filesystem facade
src/tools/define.tsTool registration and execution framework
src/tools/batch.tsBatch helpers (runOverPaths, isTotalFailure)
src/server.tsBuilds shared dependencies and invokes the three registrars
src/transport.tsOwns stdio and Streamable HTTP setup around the server factory

Configuration

The server starts with allowed directories from explicit startup configuration:

  1. Positional directories passed to filesystem-mcp.
  2. Environment variable FS_ALLOWED_DIRS (separated by : on POSIX or ; on Windows).
  3. Current working directory when --allow-cwd is enabled.

Legacy MCP connections may additionally seed roots through the deprecated roots/list flow. Modern 2026-07-28 connections do not automatically send workspace roots. They can add access after startup by calling a tool with a concrete path and approving the elicitation-backed grant. list_roots reports the roots already configured or accepted; it cannot discover an unknown workspace by itself.

Over HTTP, 2025-era clients are served statelessly: tools, resources and prompts work. Confirmations (recursive delete, overwrite, access grants) need a 2026-07-28 client or stdio and answer with a tool error saying so; file subscriptions are not advertised on that leg, and a resources/subscribe sent anyway is refused with method-not-found.

Recommended global recipes

VS Code / Cursor / Claude Code (primary recipe)

Configure the project directory explicitly:

Add to your global or project-scoped configuration:

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

Claude Desktop (fallback recipe via environment variable)

Claude Desktop and similar clients don't support the MCP Roots protocol. Use the FS_ALLOWED_DIRS environment variable to configure allowed folders.

Add to your claude_desktop_config.json:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@j0hanz/filesystem-mcp@latest"],
      "env": {
        "FS_ALLOWED_DIRS": "/path/to/project1:/path/to/project2"
      }
    }
  }
}

(On Windows, separate directories with a semicolon ; instead of a colon :).

Advanced / per-project positional arguments

You can also restrict access to specific directories by passing positional arguments directly:

bash
# Start with explicit positional paths
filesystem-mcp /path/to/project1 /path/to/project2

Configuration reference

CLI flags

FlagDefaultPurpose
[dirs...]—One or more allowed root directories (positional)
--allow-cwdfalseAlso allow the current working directory as a root
--walk-cwdfalseWalk up from CWD to find a project root; implies --allow-cwd
--allow-missing-rootsfalseStart even if configured allowed directories do not exist
--port <n>—Enable Streamable HTTP transport on the given port (env: FS_PORT)
--http-host <host>—HTTP server bind address (env: FS_HTTP_HOST)
--api-key <key>—Require this API key on HTTP requests (env: FS_API_KEY)
--read-onlyfalseDisable write tools: create, edit, delete, move, patch, replace_text
--deny <pattern>—Block paths matching this pattern; repeatable
--allow <pattern>—Exempt a pattern from the built-in sensitive denylist; repeatable (env: FS_ALLOWLIST). Does not lift --deny/FS_DENYLIST entries
--allow-sensitivefalseAllow access to sensitive system paths (env: FS_ALLOW_SENSITIVE)
--root-boundary <path>—Require all allowed roots to fall under this path (env: FS_ROOT_BOUNDARY)
--max-file-size <bytes>—Maximum file size for reads in bytes (env: FS_MAX_FILE_SIZE)
--log-level <level>infoRFC 5424 log level, debug through emergency (env: FS_LOG_LEVEL)
--print-configfalsePrint the active configuration as JSON and exit

--deny and --allow patterns support * (any run within a segment), ** (any run of segments), ?, [...] classes, and {a,b} alternation. Dot-leading (hidden) names match like any other — secrets/** denies secrets/.env, *id_rsa* denies .id_rsa.

Environment variables

All boolean variables accept true or 1 to enable and false, 0, or unset to disable; any other value logs a warning and reads as disabled. Flags take precedence when both are set.

VariablePurpose
FS_ALLOWED_DIRSColon-separated (POSIX) or semicolon-separated (Windows) list of directories to allow.
FS_ROOT_BOUNDARYPath prefix all allowed roots must fall under (mirrors --root-boundary).
FS_ALLOW_CWD_WALKWalk up from CWD to find a project root (mirrors --walk-cwd).
FS_ALLOW_MISSING_ROOTSStart even if configured directories do not exist (mirrors --allow-missing-roots).
FS_ALLOW_SENSITIVEAllow access to sensitive system paths (mirrors --allow-sensitive).
FS_DENYLISTComma-separated list of paths or patterns to block (mirrors --deny).
FS_ALLOWLISTComma-separated patterns exempted from the built-in sensitive denylist (mirrors --allow). Never lifts FS_DENYLIST/--deny entries.
FS_MAX_FILE_SIZEMaximum file size for reads in bytes (mirrors --max-file-size).
FS_LOG_LEVELRFC 5424 log level: debug, info, notice, warn/warning, error, critical, alert, or emergency (mirrors --log-level).
FS_PORTStart the Streamable HTTP transport on this port; unset = stdio (mirrors --port).
FS_HTTP_HOSTHTTP server bind address (mirrors --http-host).
FS_API_KEYAPI key required on HTTP requests (mirrors --api-key).
FS_TRUST_PROXYExpress trust proxy setting: hop count or expression. Unset = do not trust X-Forwarded-*.
FS_ALLOWED_HOSTSComma-separated Host header values to accept (HTTP transport).
FS_ALLOWED_ORIGINSComma-separated origin hostnames for CORS.
FS_ALLOW_UNRESTRICTED_HOSTSBind a wildcard host with no Host validation (accepts the risk).
FS_PUBLIC_URLResource identifier URL for RFC 9728 discovery.
FS_RATE_LIMIT_RPMPer-client-IP requests/minute (default 120 with API-key authentication, 6,000 for keyless loopback; range 1–100000).
FS_MAX_WATCHERSMax concurrent file watchers (default 256, 1–4096).
NO_COLORAny value disables ANSI color output.
FS_REQUEST_STATE_KEYHMAC key sealing input_required requestState across retry rounds. Optional (random per boot if unset); set it, at >=32 bytes UTF-8, to keep in-flight rounds alive across a restart.

Examples

bash
# Allow current working directory
filesystem-mcp --allow-cwd

# HTTP transport on port 3000
filesystem-mcp --port 3000

Scripts

ModeCommandDescription
Full checknpm run checkRun build, type check, lint, format, knip, and tests
Auto-fix + checknpm run fixAuto-fix formatting/linting and run the full check
Static onlynpm run check:staticRun static analysis without tests
Tests onlynpm testRun tests; accepts native node --test options

Security

[!IMPORTANT] Report vulnerabilities privately via GitHub Security Advisories. Do not open public issues for security reports.

TopicDetail
Path traversalEvery path is resolved and validated against allowed roots before any operation
Sensitive files.env, *.pem, *id_rsa*, and similar patterns are denied by default
Regex safetyRE2 cannot backtrack, so a hostile pattern cannot hang the server (ReDoS)
ContainerRuns as non-root mcp user; bind mounts control what is exposed

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feat/your-feature.
  3. Commit your changes with a clear message.
  4. Run npm run check to confirm tests, types, lint, formatting, and knip all pass.
  5. Open a pull request.

Contributors

License

Released under the MIT License. See LICENSE for details.

Cài đặt

TypingMind
{
  "mcpServers": {
    "filesystem-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@j0hanz/filesystem-mcp@latest"
      ]
    }
  }
}

Công cụ có sẵn

  • roots

    List allowed workspace roots. Call first — all other tools are scoped to these directories.

  • ls

    List immediate directory contents (non-recursive): name, path, type, size, modified date. Omit path for workspace root. includeIgnored=true for node_modules etc. For recursive search, use find.

  • find

    Find files by glob pattern (e.g. **/*.ts). Returns matching files with metadata. For content search, use grep. For bulk edits, pass the same glob to search_and_replace.

  • tree

    Render a directory tree (bounded recursion). Returns ASCII tree + structured JSON. maxDepth=0 returns only the root node.

  • read

    Read text file contents. Use head to preview first N lines of large files. For multiple files, use read_many.

  • read_many

    Read multiple text files in one request with contents and metadata. For a single file, use read.

  • stat

    Get file/directory metadata: size, modified, permissions, mime, tokenEstimate. Use tokenEstimate (size÷4) to pre-screen token cost before reading.

  • stat_many

    Get metadata for multiple files/directories in one request. Use tokenEstimate (size÷4) to pre-screen token cost before reading.

  • grep

    Search file contents for text (grep-like). Returns matching lines. Scope with filePattern (e.g. **/*.ts) to reduce noise. includeHidden=true for dotfiles.

  • mkdir

    Create a new directory at the specified path (recursive).

  • write

    Write content to a file, OVERWRITING ALL existing content. Creates the file and parent directories if needed.

  • edit

    Apply sequential literal string replacements to a file (first occurrence per edit). oldText must match exactly — include 3–5 lines of context for unique targeting. Use dryRun:true to preview.

  • mv

    Move or rename a file or directory.

  • rm

    Permanently delete a file or directory. This action is irreversible.

  • calculate_hash

    Calculate SHA-256 hash of a file or directory.

  • diff_files

    Generate a unified diff between two files. Output feeds directly into apply_patch. isIdentical=true means files match — no patch needed.

  • apply_patch

    Apply a unified diff patch to one or more files. Single-file: throws on failure. Multi-file: best-effort per file with results[]. Workflow: diff_files → apply_patch(dryRun:true) → apply_patch. On failure, regenerate the patch from current file content.

  • search_and_replace

    Bulk search-and-replace across files matching a glob. Replaces ALL occurrences per file (unlike edit: first only). Always dryRun:true first — returns a unified diff. Literal matching by default; isRegex:true enables RE2 with capture groups ($1, $2).

Dùng MCP Filesystem MCP Server với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Filesystem MCP Server, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Filesystem MCP Server làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Filesystem MCP Server.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "filesystem-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@j0hanz/filesystem-mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Filesystem MCP Server, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Filesystem MCP Server.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Filesystem MCP Server giúp tôi làm việc này không?
Filesystem MCP Server
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Filesystem MCP Server.

Câu hỏi thường gặp

Máy chủ MCP Filesystem MCP Server dùng để làm gì?

Filesystem MCP Server là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Filesystem MCP Server với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Filesystem MCP Server với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Filesystem MCP Server với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Filesystem MCP Server, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Filesystem MCP Server với TypingMind?

Filesystem MCP Server hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Filesystem MCP Server cung cấp những công cụ nào trong TypingMind?

Filesystem MCP Server cung cấp 18 công cụ MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Filesystem MCP Server không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Filesystem MCP Server yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

filesystem-mcp-instructions

Comprehensive rules and guidelines for filesystem-mcp usage.

filesystem-mcp-catalog

Tool selection guide and data flow map.

filesystem-mcp-workflows

Standard operating procedures for exploration, search, edit, and patch.

filesystem-mcp-metrics

Live per-tool call/error/avgDurationMs metrics snapshot.

roots

List allowed workspace roots. Call first — all other tools are scoped to these directories.

ls

List immediate directory contents (non-recursive): name, path, type, size, modified date. Omit path for workspace root. `includeIgnored=true` for node_modules etc. For recursive search, use `find`.

find

Find files by glob pattern (e.g. `**/*.ts`). Returns matching files with metadata. For content search, use `grep`. For bulk edits, pass the same glob to `search_and_replace`.

tree

Render a directory tree (bounded recursion). Returns ASCII tree + structured JSON. `maxDepth=0` returns only the root node.

read

Read text file contents. Use `head` to preview first N lines of large files. For multiple files, use `read_many`.

read_many

Read multiple text files in one request with contents and metadata. For a single file, use `read`.

stat

Get file/directory metadata: size, modified, permissions, mime, tokenEstimate. Use `tokenEstimate` (size÷4) to pre-screen token cost before reading.

stat_many

Get metadata for multiple files/directories in one request. Use `tokenEstimate` (size÷4) to pre-screen token cost before reading.

grep

Search file contents for text (grep-like). Returns matching lines. Scope with `filePattern` (e.g. `**/*.ts`) to reduce noise. `includeHidden=true` for dotfiles.

mkdir

Create a new directory at the specified path (recursive).

write

Write content to a file, OVERWRITING ALL existing content. Creates the file and parent directories if needed.

edit

Apply sequential literal string replacements to a file (first occurrence per edit). `oldText` must match exactly — include 3–5 lines of context for unique targeting. Use `dryRun:true` to preview.

mv

Move or rename a file or directory.

rm

Permanently delete a file or directory. This action is irreversible.

calculate_hash

Calculate SHA-256 hash of a file or directory.

diff_files

Generate a unified diff between two files. Output feeds directly into `apply_patch`. `isIdentical=true` means files match — no patch needed.

apply_patch

Apply a unified diff patch to one or more files. Single-file: throws on failure. Multi-file: best-effort per file with `results[]`. Workflow: `diff_files` → `apply_patch(dryRun:true)` → `apply_patch`. On failure, regenerate the patch from current file content.

search_and_replace

Bulk search-and-replace across files matching a glob. Replaces ALL occurrences per file (unlike `edit`: first only). Always `dryRun:true` first — returns a unified diff. Literal matching by default; `isRegex:true` enables RE2 with capture groups ($1, $2).

get-help

Return filesystem-mcp usage instructions.

compare-files

Generate a workflow for comparing two files using diff_files.

analyze-path

Generate a workflow for analyzing a file or directory using stat, read, and tree.

get-tool-help

Return a prompt with the authoritative contract for a specific filesystem-mcp tool.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇