Siddharth Menon

Filesystem MCP Server

AI 智慧體v1.0.0
作者:Siddharth Menon更新於 2026-05-11filesystem-mcp@clawhub_buddhasource/filesystem-mcp
Agent 框架工具呼叫#Log Analysis#Local Files#Project Management

據 AlphaMoat 統計,截至 2026-10,Filesystem MCP Server 累計下載 9,451 次、獲 7 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 2,919 位,在「AI 智慧體」分類(1,632 個)中排名第 388 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
9451
星標
7
全站下載量排名
#2,919
全站前 27% · 「AI 智慧體」前 24%
平台累計下載星標評論
ClawHub ↗62077-
SkillHub ↗94517—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

提供讀、寫、建立、刪除、移動與搜尋檔案目錄的能力,包括列目錄與取檔案資訊。訪問被限制在顯式允許的目錄內,每個目錄可分別給只讀、可寫或完全許可權,路徑校驗用於擋住目錄穿越。實現只依賴 Node 內建模組,不連外部介面。僅向有限的專案目錄授予存取權;不需寫入時優先唯讀模式。執行批次移動、覆寫或刪除前先複核,並用固定且審核過的套件版本取代可變的 npx -y 啟動。

資料釋出於 2026-10-27

可以用來做什麼

  • 讓 agent 只讀某個資料目錄
  • 在指定目錄裡批次重新命名或移動檔案

什麼時候用

  • 需要收窄 agent 的檔案訪問範圍時
  • 要按目錄區分讀寫許可權時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

只允許讀取這個目錄下的檔案
在這個目錄裡找出包含關鍵詞的檔案

月度資料趨勢

累計下載9451
3325661599052026-03 · 累計下載 37792026-05 · 累計下載 49142026-06 · 累計下載 51772026-07 · 累計下載 56082026-08 · 累計下載 58632026-09 · 累計下載 62692026-10 · 累計下載 945126-0326-0926-10
星標7
4672026-03 · 星標 42026-05 · 星標 62026-06 · 星標 72026-07 · 星標 72026-08 · 星標 72026-09 · 星標 72026-10 · 星標 726-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-109451—7
2026-096269—7
2026-085863+4.5%7
2026-075608+8.3%7
2026-065177+5.4%7
2026-054914—6
2026-033779—4

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

9.4 KB · ClawHub v1.0.0
---
name: filesystem-mcp
description: Official Filesystem MCP Server for secure file operations with configurable access controls. Read, write, create, delete, move, search files and directories. List directory contents, get file info, edit text files, and manage file permissions. Built-in security sandbox prevents unauthorized access. Essential for agents working with local files, project management, log analysis, content generation, and file organization. Use when agents need filesystem access, file manipulation, directory navigation, or content management.
---

# Filesystem MCP Server

> **Secure File Operations for AI Agents**

Official MCP reference implementation providing safe, sandboxed filesystem access with fine-grained permission controls.
展開全部(共 395 行)

## Why Filesystem MCP?

### 🔒 Security-First Design
- **Sandboxed Access**: Agents can only access explicitly allowed directories
- **Permission Controls**: Read-only, write, or full access per directory
- **Path Validation**: Prevents directory traversal and unauthorized access
- **Audit Trail**: All operations logged for security review

### 🤖 Essential for Agent Workflows
Most agent tasks involve files:
- Reading documentation
- Writing code files
- Analyzing logs
- Generating reports
- Managing project files
- Organizing content

### 📦 Zero External Dependencies
Pure implementation using Node.js built-in modules. No external API dependencies or rate limits.

## Installation

```bash
# Official reference implementation
npm install -g @modelcontextprotocol/server-filesystem

# Or build from source
git clone https://github.com/modelcontextprotocol/servers
cd servers/src/filesystem
npm install
npm run build
```

## Configuration

Add to your MCP client config:

```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/yourname/Documents",
        "/Users/yourname/Projects"
      ]
    }
  }
}
```

**Arguments** = allowed directories (one or more paths)

### Permission Modes

**Read-Only Access:**
```json
"args": ["--read-only", "/path/to/docs"]
```

**Full Access (default):**
```json
"args": ["/path/to/workspace"]
```

### Example Configurations

#### Development Workspace
```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/dev/projects",
        "/Users/dev/workspace"
      ]
    }
  }
}
```

#### Documentation Access (Read-Only)
```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "--read-only",
        "/Users/docs/knowledge-base"
      ]
    }
  }
}
```

## Available Tools

### Directory Operations

#### 1. **List Directory** (`list_directory`)
```
Agent: "What files are in my Projects folder?"
Agent: "Show contents of /workspace/src"
```

**Returns:**
- File names
- File types (file, directory, symlink)
- File sizes
- Last modified timestamps

#### 2. **Create Directory** (`create_directory`)
```
Agent: "Create a new folder called 'components'"
Agent: "Make directory /workspace/tests"
```

#### 3. **Move/Rename** (`move_file`)
```
Agent: "Rename old-name.txt to new-name.txt"
Agent: "Move report.pdf to /Documents/Reports/"
```

### File Operations

#### 4. **Read File** (`read_file`)
```
Agent: "Read the contents of config.json"
Agent: "Show me the README.md file"
```

**Supports:**
- Text files (UTF-8)
- JSON, YAML, XML
- Markdown, code files
- Large files (streaming)

#### 5. **Write File** (`write_file`)
```
Agent: "Create a file called notes.txt with meeting notes"
Agent: "Write the generated code to src/index.ts"
```

#### 6. **Edit File** (`edit_file`)
```
Agent: "Replace 'version: 1.0' with 'version: 2.0' in package.json"
Agent: "Add a new function to utils.js"
```

#### 7. **Get File Info** (`get_file_info`)
```
Agent: "When was report.pdf last modified?"
Agent: "What's the size of data.csv?"
```

**Returns:**
- File size (bytes)
- Creation time
- Last modified time
- Permissions
- File type

### Advanced Operations

#### 8. **Search Files** (`search_files`)
```
Agent: "Find all Python files in the project"
Agent: "Search for files containing 'API_KEY'"
```

**Search by:**
- File name pattern (glob)
- File content (regex)
- File type
- Date modified

#### 9. **Delete File** (`delete_file`)
```
Agent: "Delete the temporary log files"
Agent: "Remove old-backup.zip"
```

**Safety:**
- Requires confirmation for large files
- Cannot delete files outside allowed directories
- Logged for audit

## Agent Workflow Examples

### Code Generation
```
Human: "Create a React component for a login form"

Agent:
1. create_directory("/workspace/components")
2. write_file("/workspace/components/LoginForm.tsx", generated_code)
3. write_file("/workspace/components/LoginForm.test.tsx", test_code)
4. "Created LoginForm component at components/LoginForm.tsx"
```

### Log Analysis
```
Human: "Analyze error logs and summarize issues"

Agent:
1. list_directory("/var/log/app")
2. read_file("/var/log/app/error.log")
3. search_files(pattern="ERROR", path="/var/log/app")
4. generate_summary()
5. write_file("/reports/error-summary.md", summary)
```

### Project Organization
```
Human: "Organize my documents by type"

Agent:
1. list_directory("/Documents")
2. For each file:
   - get_file_info(file)
   - Determine file type
   - create_directory("/Documents/[type]")
   - move_file(file, destination_folder)
```

### Documentation Generation
```
Human: "Generate API documentation from code comments"

Agent:
1. search_files(pattern="*.ts", path="/src")
2. For each file:
   - read_file(file)
   - extract_doc_comments()
3. Generate markdown docs
4. write_file("/docs/API.md", generated_docs)
```

## Security Model

### Sandbox Enforcement

**What Agents CAN Do:**
- ✅ Access explicitly allowed directories
- ✅ Create/read/write files within allowed paths
- ✅ List directory contents
- ✅ Search within allowed paths

**What Agents CANNOT Do:**
- ❌ Access parent directories (`../`)
- ❌ Access system files (`/etc/`, `/sys/`)
- ❌ Follow symlinks outside allowed paths
- ❌ Execute binaries or scripts
- ❌ Modify file permissions

### Path Validation

```
Allowed: /Users/dev/projects
Agent tries: /Users/dev/projects/src/index.ts → ✅ Allowed
Agent tries: /Users/dev/projects/../secret → ❌ Blocked
Agent tries: /etc/passwd → ❌ Blocked
```

### Best Practices

1. **Principle of Least Privilege**
   - Grant only necessary directories
   - Use `--read-only` when write not needed

2. **Never Allow Root Access**
   - Don't add `/` or system directories
   - Restrict to user workspace

3. **Audit Agent Actions**
   - Review MCP server logs regularly
   - Monitor for unexpected file access patterns

4. **Separate Sensitive Data**
   - Keep credentials, keys in separate directories
   - Don't include in allowed paths

## Use Cases

### 📝 Content Management
Agents generate blog posts, reports, documentation and save to organized folders.

### 🤖 Code Assistants
Read project files, generate code, create tests, update configurations.

### 📊 Data Analysis
Read CSV/JSON data files, analyze, generate reports and visualizations.

### 🗂️ File Organization
Scan directories, categorize files, move to appropriate folders, cleanup duplicates.

### 📚 Knowledge Base
Index markdown files, search documentation, extract information, update wikis.

### 🔍 Log Analysis
Parse log files, identify errors, generate summaries, create alerts.

## Performance

### Large Files
- Streaming for files >10MB
- Incremental reads supported
- Memory-efficient processing

### Directory Scanning
- Recursive search optimized
- Glob pattern matching
- Ignore patterns (e.g., `node_modules/`)

### Concurrent Operations
- Safe for parallel file access
- Atomic write operations
- File locking where needed

## Troubleshooting

### "Permission denied" Error
- Verify path is in allowed directories
- Check filesystem permissions
- Ensure MCP server has read/write access

### "Path not found" Error
- Confirm directory exists
- Check for typos in path
- Verify path format (absolute vs relative)

### Read-Only Mode Issues
- Can't write in `--read-only` mode
- Reconfigure server with write access if needed

## vs Other File Access Methods

| Method | Security | Agent Integration | Setup |
|--------|----------|-------------------|-------|
| **Filesystem MCP** | ✅ Sandboxed | ✅ Auto-discovered | Simple |
| **Direct FS Access** | ❌ Full system | ❌ Manual | None |
| **File Upload/Download** | ✅ Manual control | ⚠️ Limited | Complex |
| **Cloud Storage API** | ✅ API-level | ⚠️ Requires SDK | Complex |

## Resources

- **GitHub**: https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem
- **MCP Docs**: https://modelcontextprotocol.io/
- **Security Best Practices**: https://modelcontextprotocol.io/docs/concepts/security

## Advanced Configuration

```json
{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": [
        "/path/to/filesystem-server/build/index.js",
        "/workspace",
        "/documents"
      ],
      "env": {
        "MAX_FILE_SIZE": "10485760",
        "ENABLE_LOGGING": "true",
        "LOG_PATH": "/var/log/mcp-filesystem.log"
      }
    }
  }
}
```

---

**Safe, secure filesystem access for agents**: From code generation to log analysis, Filesystem MCP is the foundation for agent file operations.

「AI 智慧體」分類下的熱門技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。