Filesystem MCP Server — File系统 MCP Server
v1.0.0Official File系统 MCP Server for 安全 file operations with configurable 访问 controls. Read, write, 创建, 删除, move, 搜索 files and directories. 列出 directory contents, 获取 file 信息, edit text files, and manage file 权限s. Built-in security sandbox 预防s un授权d 访问. Essential for 代理s working with local files, project management, 记录 analysis, content generation, and file organization. Use when 代理s need file系统 访问, file manipulation, directory navigation, or content management.
运行时依赖
安装命令
点击复制技能文档
File系统 MCP Server
安全 File Operations for AI 代理s
Official MCP reference implementation providing safe, sandboxed file系统 访问 with fine-grAIned 权限 controls.
Why File系统 MCP? 🔒 Security-First De签名 Sandboxed 访问: 代理s can only 访问 explicitly allowed directories 权限 Controls: Read-only, write, or full 访问 per directory Path 验证: 预防s directory traversal and un授权d 访问 审计 TrAIl: All operations 记录ged for security review 🤖 Essential for 代理 工作流s
Most 代理 tasks involve files:
Reading documentation Writing code files Analyzing 记录s Generating 报告s Managing project files Organizing content 📦 Zero External Dependencies
Pure implementation using Node.js built-in 模块s. No external API dependencies or rate limits.
安装ation # Official reference implementation npm 安装 -g @模型上下文protocol/server-file系统
# Or build from source git clone https://github.com/模型上下文protocol/servers cd servers/src/file系统 npm 安装 npm 运行 build
Configuration
添加 to your MCP 命令行工具ent config:
{ "mcpServers": { "file系统": { "command": "npx", "args": [ "-y", "@模型上下文protocol/server-file系统", "/Users/yourname/Documents", "/Users/yourname/Projects" ] } } }
Arguments = allowed directories (one or more paths)
权限 Modes
Read-Only 访问:
"args": ["--read-only", "/path/to/docs"]
Full 访问 (default):
"args": ["/path/to/workspace"]
Example Configurations Development Workspace { "mcpServers": { "file系统": { "command": "npx", "args": [ "-y", "@模型上下文protocol/server-file系统", "/Users/dev/projects", "/Users/dev/workspace" ] } } }
Documentation 访问 (Read-Only) { "mcpServers": { "file系统": { "command": "npx", "args": [ "-y", "@模型上下文protocol/server-file系统", "--read-only", "/Users/docs/knowledge-base" ] } } }
AvAIlable 工具s Directory Operations
- 列出 Directory (列出_directory)
Returns:
File names File types (file, directory, symlink) File sizes Last modified timestamps
- 创建 Directory (创建_directory)
- Move/Rename (move_file)
File Operations
- Read File (read_file)
Supports:
Text files (UTF-8) JSON, YAML, XML Markdown, code files Large files (流ing)
- Write File (write_file)
- Edit File (edit_file)
- 获取 File 信息 (获取_file_信息)
Returns:
File size (bytes) Creation time Last modified time 权限s File type Advanced Operations
- 搜索 Files (搜索_files)
搜索 by:
File name pattern (glob) File content (regex) File type Date modified
- 删除 File (删除_file)
Safety:
Requires confirmation for large files Cannot 删除 files outside allowed directories 记录ged for 审计 代理 工作流 Examples Code Generation Human: "创建 a React 组件 for a 记录in form"
代理:
- 创建_directory("/workspace/组件s")
- write_file("/workspace/组件s/记录信息rm.tsx", 生成d_code)
- write_file("/workspace/组件s/记录信息rm.test.tsx", test_code)
- "创建d 记录信息rm 组件 at 组件s/记录信息rm.tsx"
记录 Analysis Human: "Analyze error 记录s and summarize issues"
代理:
- 列出_directory("/var/记录/应用")
- read_file("/var/记录/应用/error.记录")
- 搜索_files(pattern="ERROR", path="/var/记录/应用")
- 生成_summary()
- write_file("/报告s/error-summary.md", summary)
Project Organization Human: "Organize my documents by type"
代理:
- 列出_directory("/Documents")
- For each file:
Documentation Generation Human: "生成 API documentation from code comments"
代理:
- 搜索_files(pattern="*.ts", path="/src")
- For each file:
- 生成 markdown docs
- write_file("/docs/API.md", 生成d_docs)
Security 模型 Sandbox Enforcement
What 代理s CAN Do:
✅ 访问 explicitly allowed directories ✅ 创建/read/write files within allowed paths ✅ 列出 directory contents ✅ S