Filesystem MCP server

Provides secure filesystem operations for reading, writing, and manipulating files and directories within specified access boundaries.
Back to servers
Provider
Yong Liu
Release date
Mar 01, 2025
Language
TypeScript
Stats
1 star

This MCP server provides filesystem operations for Claude AI, allowing it to read, write, create directories, search files and more within specified directories on your system.

Installation

To install the Filesystem MCP Server, follow these steps:

  1. Clone the repository
  2. Install dependencies
  3. Build the project
npm install
npm run build

Running the Server

The server requires one or more allowed directories to be specified as command-line arguments:

node build/index.js /path/to/allowed/dir1 /path/to/allowed/dir2

Note: For security reasons, the server will only allow operations within the directories you specify when starting it.

MCP Configuration

To use the filesystem server with Claude, add it to your MCP configuration file:

{
  "mcpServers": {
    "filesystem-server": {
      "command": "node",
      "args": [
        "/path/to/filesystem-server/build/index.js",
        "/path/to/allowed/dir1",
        "/path/to/allowed/dir2"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Available Operations

Reading Files

Read a Single File

Read the complete contents of a file:

read_file
Input: path (string)

Read Multiple Files

Read multiple files simultaneously:

read_multiple_files
Input: paths (string[])

When reading multiple files, failed reads won't stop the entire operation.

Writing Files

Create a new file or overwrite an existing one:

write_file
Inputs:
- path (string): File location
- content (string): File content

Directory Operations

Create Directory

Create a new directory or ensure it exists:

create_directory
Input: path (string)

This operation creates parent directories if needed and succeeds silently if the directory already exists.

List Directory Contents

List all items in a directory with [FILE] or [DIR] prefixes:

list_directory
Input: path (string)

Move or Rename Files

Move or rename files and directories:

move_file
Inputs:
- source (string)
- destination (string)

This operation fails if the destination already exists.

Search and Information

Search Files

Recursively search for files or directories:

search_files
Inputs:
- path (string): Starting directory
- pattern (string): Search pattern

This performs case-insensitive matching and returns full paths to matches.

Get File Information

Get detailed metadata about a file or directory:

get_file_info
Input: path (string)

Returns size, creation time, modified time, access time, type (file/directory), and permissions.

List Allowed Directories

List all directories the server is allowed to access:

list_allowed_directories
No input required

Returns a list of directories that this server can read from and write to.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later