filesystem mcp server

Local 2025-08-31 23:58:44 0

An MCP server that allows Claude AI to perform filesystem operations including reading, writing, listing, moving files, and searching directories within specified allowed paths.


A Model Context Protocol (MCP) server that provides filesystem operations for Claude AI.

Features

This MCP server provides the following filesystem operations:

  1. read_file: Read complete contents of a file
  2. Input: path (string)
  3. Reads complete file contents with UTF-8 encoding

  4. read_multiple_files: Read multiple files simultaneously

  5. Input: paths (string[])
  6. Failed reads Will not stop the entire operation

  7. write_file: Create new file or overwrite existing

  8. Inputs:

    • path (string): File location
    • content (string): File content
  9. create_directory: Create new directory or ensure it exists

  10. Input: path (string)
  11. Creates parent directories if needed
  12. Succeeds silently if directory exists

  13. list_directory: List directory contents with [FILE] or [DIR] prefixes

  14. Input: path (string)

  15. move_file: Move or rename files and directories

  16. Inputs:
    • source (string)
    • destination (string)
  17. Fails if destination exists

  18. search_files: Recursively search for files/directories

  19. Inputs:
    • path (string): Starting directory
    • pattern (string): Search pattern
  20. Case-insensitive matching
  21. Returns full paths to matches

  22. get_file_info: Get detailed file/directory metadata

  23. Input: path (string)
  24. Returns:

    • Size
    • Creation time
    • Modified time
    • Access time
    • Type (file/directory)
    • Permissions
  25. list_allowed_directories: List all directories the server is allowed to access

  26. No input required
  27. Returns directories that this server can read/write from

Security

The server only allows operations within directories specified via command-line arguments.

Installation

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

Usage

Run the server with one or more allowed directories:

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

MCP Configuration

Add the server 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": []
    }
  }
}

License

ISC