Skip to main content
← Back to Articles
MCPFilesystemClaude DesktopCursor IDEVS CodeAI integration

How to Set Up the Filesystem MCP Server (2026)

Give Claude, Cursor, and VS Code safe, scoped access to your local files with the Filesystem MCP server. Full setup with copy-paste config, allowed directories, and troubleshooting.

By Web MCP GuideJune 23, 20267 min read

The Filesystem MCP server is the single most useful server to start with: it lets Claude, Cursor, or VS Code read and write files in directories you choose. Instead of copy-pasting code and documents into a chat, your AI assistant works with the real files on disk — safely scoped to the folders you allow. This guide covers the full setup with copy-paste config for each client.

What This Integration Enables

  • Read any file inside your allowed directories
  • Create, edit, and move files and folders
  • Search files by name or content across a project
  • List directory trees so the assistant understands your structure
  • Refactor across many files in one prompt

Prerequisites

  • Node.js 18+ installed and on your PATH
  • An MCP client: Claude Desktop, Cursor, or VS Code
  • One or more directories you want the assistant to access

Step 1: Verify the Server Runs

No install is needed — npx fetches it on demand. Confirm it launches against a test directory:

npx -y @modelcontextprotocol/server-filesystem ~/projects

It should print that it is serving the allowed directory and wait for a client. Press Ctrl+C to stop.

Step 2: Configure Claude Desktop

Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/projects",
        "/Users/you/notes"
      ]
    }
  }
}

Each path after the package name is an allowed root. The server can never read or write outside these directories.

Step 3: Configure Cursor

Edit ~/.cursor/mcp.json (macOS/Linux) or %APPDATA%\Cursor\mcp.json (Windows) with the same block. See our Cursor MCP setup guide for details.

Step 4: Configure VS Code

Add the server to your VS Code MCP settings using the identical command and args. Full instructions are in our VS Code MCP guide.

Step 5: Restart and Verify

Fully quit and reopen your client, then test it:

List the files in my projects directory and read the README in the largest one

Real-World Use Cases

  • Refactor a function across every file that imports it
  • Generate a project README from the actual source tree
  • Search a notes folder and summarize everything about a topic
  • Rename and reorganize a batch of files following a naming convention

Troubleshooting

"Path is not allowed"

The requested file is outside your allowed roots. Add the directory to your args array and restart, and always use absolute paths.

Tools don't appear

Confirm Node 18+ is installed, that the JSON is valid (a trailing comma will silently break it), and that you fully quit the client before reopening.

Permission denied on write

The OS user running the client must own or have write permission on the target directory. Check folder permissions or choose a directory you control.

Security Best Practices

  • Scope to a single project or documents folder — never your home directory or root
  • Keep allowed directories under git so you can review and revert AI changes
  • Approve destructive actions (delete, move) deliberately rather than auto-running them
  • Avoid symlinks that escape the allowed roots

Frequently Asked Questions

What is the Filesystem MCP server?

The Filesystem MCP server is the official reference server published as @modelcontextprotocol/server-filesystem. It exposes tools to read, write, list, search, and move files within directories you explicitly allow, letting an AI assistant work with your local files safely.

Is it safe to give an AI access to my filesystem?

It is safe when scoped correctly. The Filesystem MCP server only accesses directories you pass as allowed paths on the command line. It cannot read or write anything outside those roots, so you grant access to a specific project or documents folder rather than your whole disk.

Can the Filesystem MCP server write and delete files?

Yes, it supports write, edit, create directory, and move operations within allowed directories. Because writes are possible, you should scope it tightly, keep the directories under version control, and review changes your assistant proposes before approving destructive actions.

How do I allow multiple directories?

Pass each directory as an additional argument after the package name in the args array, for example ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects", "/Users/you/notes"]. The server treats each path as a separate allowed root.

Why does the server say a path is not allowed?

That error means you requested a file outside the allowed directories. Confirm the path is inside one of the roots you configured, use absolute paths, and avoid symlinks that point outside the allowed roots, since the server resolves real paths before granting access.

More MCP Integrations

Browse the full MCP server directory to connect Google Drive, Slack, Notion, GitHub, and 50+ more tools to your AI workflow.