Local Files MCP Server

Local Files MCP Server

Provides safe local file operations through MCP, including reading, writing, searching, organizing, and protected deletion with configurable path restrictions.

Category
访问服务器

README

Local Files MCP Server

A Model Context Protocol (MCP) server for managing local files. Provides tools for reading, writing, analyzing, searching, and organizing files with built-in safety protections.

Features

  • 📖 Read/Write files - UTF-8 and base64 support
  • 📂 Directory operations - List, organize, search
  • 🔍 Content search - Regex pattern matching
  • 🔎 Find duplicates - MD5 hash comparison
  • 📊 File analysis - Size, MIME type, line counts
  • 🛡️ Safety protections - Configurable allowed/protected paths
  • 🖥️ Cross-platform - macOS, Linux, Windows

Installation

NPX

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "local-files": {
      "command": "npx",
      "args": ["-y", "fsorg"]
    }
  }
}

That's it! Claude Desktop will automatically download and run the MCP server via npx.

Alternative: Install from source

git clone https://github.com/argtobias/fsorg.git
cd fsorg
pnpm install
pnpm build

Then configure Claude Desktop:

{
  "mcpServers": {
    "local-files": {
      "command": "node",
      "args": ["/path/to/fsorg/dist/index.js"]
    }
  }
}

Safety Configuration

Create a config file at:

-- macOS/Linux: ~/.config/localfiles-org/config.json

-- Windows: %LOCALAPPDATA%\localfiles-org\config.json

{
  "allowedPaths": [
    "~/projects",
    "~/Development",
    "~/workspace",
    "/tmp"
  ],
  "additionalProtectedPaths": [
    "~/my-important-folder"
  ],
  "additionalProtectedPatterns": [
    "^backup",
    "\\.bak$"
  ]
}

Configuration Options

Option Description Default
allowedPaths Paths where delete operations are permitted ~/projects, ~/dev, etc.
additionalProtectedPaths Extra paths to protect from deletion []
additionalProtectedPatterns Regex patterns for protected file names []

Always Protected (cannot be overridden)

  • System paths: /, /etc, /usr, /bin, /System, etc.
  • User paths: ~, ~/Documents, ~/Desktop, ~/Downloads, ~/.ssh
  • Patterns: .git, .env, .ssh, credentials, secrets

Available Tools

File Operations

Tool Description
read_file Read file contents (UTF-8 or base64)
write_file Write content to file (UTF-8 or base64)
delete_file Safely delete a file with protection checks
move_file Move file with optional empty directory cleanup
analyze_file Get file stats (size, MIME, lines, words)

Directory Operations

Tool Description
list_directory List files with optional recursion and glob patterns
delete_directory Safely delete directory (requires confirmation for recursive)
organize_by_type Organize files into folders by extension/date/size

Search Operations

Tool Description
search_content Search for regex patterns in file contents
find_duplicates Find duplicate files by MD5 hash
sort_file_content Sort lines in a file

Batch Operations

Tool Description
rename_files Batch rename files using regex patterns

Usage Examples

Read a file

{
  "tool": "read_file",
  "arguments": {
    "path": "~/projects/myfile.txt"
  }
}

Find and delete duplicates

{
  "tool": "find_duplicates",
  "arguments": {
    "path": "~/projects/images",
    "recursive": true
  }
}

Safely delete with preview

{
  "tool": "delete_file",
  "arguments": {
    "path": "~/projects/temp/old-file.txt",
    "preview": true
  }
}

Organize files by extension

{
  "tool": "organize_by_type",
  # Local Files MCP Server

  Simple MCP server for safe local file operations: read, write, search, organize and protected delete.

  ## Quick install

  Run via npx (recommended for Claude Desktop):

  ```json
  {
    "mcpServers": {
      "local-files": {
        "command": "npx",
        "args": ["-y", "fsorg"]
      }
    }
  }

From source:

git clone https://github.com/argtobias/fsorg.git
cd fsorg
pnpm install
pnpm build

Configuration

Create user config at:

  • macOS/Linux: ~/.config/localfiles-org/config.json

  • Windows: %LOCALAPPDATA%\\localfiles-org\\config.json

Minimal config example:

{
  "allowedPaths": ["~/projects", "~/Development"],
  "additionalProtectedPaths": [],
  "additionalProtectedPatterns": []
}

Safety

  • Only operations inside allowedPaths can delete files.
  • System and user-critical paths are always protected.
  • Pattern-based protection (e.g. .git, .env) is enforced.

Usage examples

Read a file:

{ "tool": "read_file", "arguments": { "path": "~/projects/myfile.txt" } }

Find duplicates:

{ "tool": "find_duplicates", "arguments": { "path": "~/projects/images", "recursive": true } }

Delete with preview (safe):

{ "tool": "delete_file", "arguments": { "path": "~/projects/temp/old.txt", "preview": true } }

Development

pnpm install
pnpm build
pnpm dev

License

ISC

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选