Skip to main content
MCP Server

Secure file operations with configurable access controls

Share
1,250 stars TypeScript MIT Updated: 2025-05-15

Send to Your Agent

Copy this prompt and paste it into Claude, Cursor, or any MCP client to install instantly.

Install the Filesystem MCP server for me.

Server: Filesystem
Description: Secure file operations with configurable access controls
Install command: npx -y @modelcontextprotocol/server-filesystem /allowed/path

Environment variables needed:
- ALLOWED_PATHS: Directory paths the server can access (space-separated) (required)

GitHub: https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem

Please install this MCP server and confirm when ready.

Paste into any AI agent with MCP support — works with Claude Desktop, Cursor, Cline, and more.

Quick Install

Config file: ~/Library/Application Support/Claude/claude_desktop_config.json

  1. Open Claude Desktop app
  2. Go to Settings → Developer → Edit Config
  3. Paste the config below into the file
  4. Restart Claude Desktop
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/allowed/path"
      ],
      "env": {
        "ALLOWED_PATHS": "/home/user/documents /home/user/projects"
      }
    }
  }
}

Add this to your ~/Library/Application Support/Claude/claude_desktop_config.json

Installation Methods

npx Run directly with npx
npx -y @modelcontextprotocol/server-filesystem /allowed/path
docker Run with Docker
docker run -i --rm mcp/filesystem /allowed/path

Tools (7)

read_file

Read the complete contents of a file from the file system

write_file

Create a new file or overwrite an existing file with new content

list_directory

Get a detailed listing of all files and directories in a specified path

move_file

Move or rename files and directories from one location to another

search_files

Recursively search for files and directories matching a pattern

get_file_info

Retrieve detailed metadata about a specific file or directory

list_allowed_directories

Show all directories the server is currently allowed to access

Environment Variables

ALLOWED_PATHS Required

Directory paths the server can access (space-separated)

Example: /home/user/documents /home/user/projects

Compatibility

Claude Desktop
Cursor
Cline
VS Code
Devin (formerly Windsurf)

About

A Node.js server implementing Model Context Protocol (MCP) for filesystem operations. This server provides tools to read, write, create, list, delete, move, and search files and directories with strict access controls.

Key Features

  • Read/write files — Access file contents for analysis and modification
  • Create/list/delete directories — Manage directory structures
  • Move files/directories — Rename and reorganize files
  • Search files — Find files matching patterns across directories
  • Get file metadata — Retrieve size, permissions, timestamps
  • Dynamic directory access control via Roots

Directory Access Control

The server uses a flexible directory access control system. Directories can be specified via command-line arguments or dynamically via MCP Roots.

Method 1: Command-line Arguments

Specify allowed directories when starting the server:

npx -y @modelcontextprotocol/server-filesystem /path/to/dir1 /path/to/dir2

Method 2: MCP Roots (Recommended)

MCP clients that support Roots can dynamically update allowed directories at runtime without restarting the server.

Use Cases

  • Code analysis and refactoring across multiple files
  • Documentation generation from source code
  • Project structure exploration
  • File organization and cleanup
  • Content migration between directories

Related Resources

Compare LLM Pricing

This server works with Claude, GPT-4o, and other models. Compare API costs side-by-side to find the cheapest option for your workflow.