MCP.so
登录
F

Filesystem MCP Server

@j0hanz

基本信息

分类

开发工具

传输方式

stdio

作者

j0hanz

提交者

Linus Johansson

关于 Filesystem MCP Server

Read-only MCP server for secure filesystem exploration, searching, and analysis

Filesystem MCP Server 配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

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

Filesystem MCP Server 工具

13

Write whole text files: create new ones, overwrite, or append. Missing parent directories are created. edit or patch changes part of an existing file.

Permanently delete files, directories, or symlinks, like rm or rm -r. Paths are exact; globs are not expanded.

Compare two text files and return a unified diff from a to b, like diff -u.

Edit text files in place by replacing exact oldText with newText, like str_replace. Each oldText must match exactly once, and a file is written only if all its edits match. replace_text replaces every occurrence across files.

List a directory's files and subdirectories as a tree of names, like ls or tree. stat returns sizes and dates.

Move, rename, or copy files and directories, like mv or cp -r. Each destination is the full new path, not a folder to move into; missing parent directories are created.

Apply a single-file unified diff to one existing text file, like git apply. Nothing is written unless every hunk applies in file order with exactly matching context; hunks are found by their context, so start line numbers may be off.

Read text files, like cat: whole, or one slice via head, tail, or startLine/endLine. Images and audio return as media; other binary files are rejected.

Find and replace every occurrence of literal text or an RE2 regex, like sed -i, in one file or all files under a directory, optionally filtered by glob. The pattern runs over the whole file: it can span lines, and ^ and $ anchor to file start and end. edit replaces one unique exact match.

List the directories this server can access, as absolute paths, including any the user granted during this session. Other tools can ask the user to grant access to a path outside them.

Search file contents for literal text or an RE2 regex, like grep; returns matching lines with line numbers and paths relative to the searched directory. Patterns match within one line. find_files matches file names.

Find files by name or glob pattern; returns file paths relative to the searched directory. A pattern without / matches file names at any depth. search_text searches contents.

Get metadata without reading contents, like ls -ld: type, size (a directory reports its own entry, not its contents), tokenEstimate, timestamps, permissions, MIME type guessed from the extension, and symlink target. Also checks whether paths exist.

概览

What is it?

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.

How to use it?

Run it with npx: npx -y @j0hanz/filesystem-mcp /path/to/allowed/dir (Node.js 24+). Pass allowed directories as arguments, use --allow-cwd for the current directory, or let the client supply roots. Add --read-only to remove every write tool, or --port 3000 to serve Streamable HTTP instead of stdio. A Docker image is published at ghcr.io/j0hanz/filesystem-mcp.

Key features:

Path guarding: every path is validated against allowed roots; .env, *.pem and id_rsa are denied by default Read and write tools: navigate, inspect, read, create, edit, move, delete RE2 regex search: linear-time matching, so no pattern can hang the server Unified diffs: compare two files with diff, apply changes with patch Bulk search-and-replace across files matching a glob Batch operations: most tools accept path, paths[] or files[] File subscriptions: resources push change notifications when watched files update Dual transport: stdio by default, Streamable HTTP with --port and optional API key --read-only mode removes every mutating tool

Use cases:

Giving coding agents safe read and write access to a project directory Searching large codebases with regex that cannot hang the server Reviewing and applying changes as unified diffs Refactoring text across many files with glob-scoped replace Serving a shared workspace to remote clients over authenticated HTTP

FAQ:

Q: Can it write files?

A: Yes. create, edit, move, delete, replace_text and patch write inside allowed roots. Start with --read-only to remove all of them.

Q: How are directories allowed?

A: Pass them as arguments, set FS_ALLOWED_DIRS, use --allow-cwd, or let the MCP client supply roots. --root-boundary limits which roots can be added.

Q: Which files are blocked?

A: .env, *.pem, id_rsa and similar patterns are denied by default. Add patterns with --deny, or exempt one with --allow.

Q: What transport does it use?

A: stdio by default. --port starts Streamable HTTP, and --api-key requires a key on every request.

Q: What does it require?

A: Node.js 24 or later. Docker is optional (ghcr.io/j0hanz/filesystem-mcp).

评论

开发工具 分类下的更多 MCP 服务器