Filesystem MCP Server

Secure filesystem MCP server for reading, writing, searching, diffing, and patching files.

Local serverstdio

What is the Filesystem MCP server?

Filesystem MCP server exists for a simple reason — assistants are far more useful when they can act on Filesystem directly instead of describing what you should do. Secure filesystem MCP server for reading, writing, searching, diffing, and patching files.

What you get

A secure, production-ready Model Context Protocol server that gives AI assistants controlled access to the local filesystem. All operations are sandboxed to explicitly allowed directories with path traversal prevention, sensitive file blocking, and optional Bearer token authentication.

  • 18 filesystem tools — — read, write, search, diff, patch, hash, and bulk operations with structured output schemas
  • Security-first — — path validation, symlink escape prevention, sensitive file denylist, localhost-only CORS, Host header validation for loopback HTTP binds, optional API key auth
  • Dual transport — — stdio for local use, Node Streamable HTTP for networked/multi-session deployments
  • Structured output — — all tools return typed outputSchema / structuredContent for reliable LLM parsing
  • Self-documenting — — 6 built-in resources (internal://instructions, internal://tool-catalog, etc.) and 4 built-in prompts (get-help, compare-files, analyze-path, get-tool-help)

Setting it up

Installation goes through your MCP client rather than a global install: point it at @j0hanz/filesystem-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

What the assistant can call

Once Filesystem is connected, these are the calls the assistant has available:

  • Tools — The Tools tool exposed by this server
  • roots — List allowed workspace roots. Call first — all other tools are scoped to these directories
  • find — Find files by glob pattern. Returns matching files with metadata
  • tree — Render a directory tree with bounded recursion. Returns ASCII tree + structured JSON
  • read — Read text file contents. Use head/tail to preview first/last N lines of large files
  • read_many — The read_many tool exposed by this server
  • stat — Get file/directory metadata: size, modified, permissions, mime, tokenEstimate
  • stat_many — The stat_many tool exposed by this server
  • grep — Search file contents (grep-like). Returns matching lines with optional context
  • mkdir — The mkdir tool exposed by this server

Configuration and credentials

  • Node.js >= 24

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 10 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Filesystem.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the filesystem mcp server does with a few real requests.

Choosing this one

Among the file and storage access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Filesystem's toolset — Tools, roots, find and 7 more — is a fair guide to whether it matches your workflow. It is maintained by GitHub Actions; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Available tools

ToolWhat it does
ToolsThe Tools tool exposed by this server.
rootsList allowed workspace roots. Call first — all other tools are scoped to these directories.
findFind files by glob pattern. Returns matching files with metadata.
treeRender a directory tree with bounded recursion. Returns ASCII tree + structured JSON.
readRead text file contents. Use head/tail to preview first/last N lines of large files.
read_manyThe read_many tool exposed by this server.
statGet file/directory metadata: size, modified, permissions, mime, tokenEstimate.
stat_manyThe stat_many tool exposed by this server.
grepSearch file contents (grep-like). Returns matching lines with optional context.
mkdirThe mkdir tool exposed by this server.

How to install the Filesystem MCP server

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

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js >= 24

Example prompts to try

  • Use Filesystem to Tools.
  • Use Filesystem to roots.
  • Use Filesystem to find.

Frequently asked questions

It connects Filesystem to MCP-compatible AI assistants such as Claude and Cursor, exposing 10 tools (Tools, roots, find, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Filesystem directly.