跳转至

Filesystem 本地文件系统沙箱 MCP 服务器 (Filesystem MCP Server)

Filesystem MCP Server 赋予了 AI 智能体直接在本机操作系统上开展文件与目录操作的强大能力。为了确保系统的绝对安全,该服务采用了严格的白名单沙箱机制:智能体仅被允许访问与操作你显式授权的目录,绝无可能越权访问宿主机上的其它敏感路径。非常适合用于文件自动化归档、数据清洗与工程素材编排。


安装与配置流程 (Installation)

  1. 打开 Griptape Nodes,依次点击 Settings → MCP Servers;
  2. 点击 + New MCP Server;
  3. 配置各项参数:

    • Server Name/ID:filesystem
    • Connection Type:Local Process (stdio)
    • Configuration JSON:
    {
      "transport": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/allowed/directory"
      ],
      "env": {},
      "encoding": "utf-8",
      "encoding_error_handler": "strict"
    }
    

    ⚠️ 注意:请将上述配置中的 /path/to/allowed/directory 替换为你本机真实的有效文件夹绝对物理路径。

  4. 点击 Create Server 完成注册。


提供的可用工具集 (Available Tools)

  • read_file — 读取指定文本或代码文件的完整内容;
  • write_file — 向指定路径写入或覆写文件;
  • list_directory — 列出目标文件夹下的所有子文件夹与文件清单;
  • create_directory — 递归创建全新的文件夹;
  • search_files — 根据文件名通配符模式或关键字模糊搜索文件;
  • move_file — 移动文件至新目录或执行文件重命名;
  • delete_file — 安全移除指定文件。

多目录授权配置方案 (Configuration Options)

若你的自动化工作流需要跨越多个独立的物理存储卷或文件夹,只需在 args 数组中并排追加多个绝对路径参数即可:

{
  "transport": "stdio",
  "command": "npx",
  "args": [
    "-y",
    "@modelcontextprotocol/server-filesystem",
    "/Users/username/Desktop",
    "/Users/username/Downloads",
    "/Users/username/Documents"
  ],
  "env": {},
  "encoding": "utf-8",
  "encoding_error_handler": "strict"
}

在 Windows 操作系统中,请确保使用规范的斜杠路径(如 "C:/Users/username/Projects")。


官方资源与仓库链接