跳到主要内容Skip to main content
← Tools

Filesystem MCP ServerFilesystem MCP Server

Model Context Protocol
文件 本地 只读 读写 verified lifecycle: active 核验Checked 2026-10-08

MCP 官方 reference server 里的文件操作实现。它是「白名单目录」式访问:必须显式声明允许目录,不允许静默访问全盘。

The file-operation implementation among MCP's official reference servers, requiring allowed directories to be declared explicitly, with no silent whole-disk access.

适合与不适合When to use it, when not to

让 Agent 在明确指定的目录内读写文本与媒体文件。需要目录边界清晰、 且不需要删除操作时。

不适合需要删除操作、需要跨目录聚合, 或需要任意路径访问的场景——本 server 的设计目标就是收紧这个边界。

Scenarios where an agent must read or write within explicitly declared directories.

Not a fit for open-ended exploration of the filesystem — allowed directories must be declared, there is no silent whole-disk access.

中文生态China availability 国产 / 国内可直接用 / 备案状态 · 快照domestic / direct access / CAC filing · snapshot 2026-10-20

出品属地Origin
国外出品foreign-made 国外主体(网信办公示名单未见对应备案主体)。foreign entity (no matching filing entity in the CAC registry).
国内使用Direct access
大陆可直连direct OK 官网仓库在 GitHub,大陆直连波动(同日实测 200/000 混合);npm / PyPI 安装源实测稳定可达。Hosted on GitHub — direct reachability from mainland fluctuates (200/000 mixed on the same day); npm / PyPI install routes measured stable.
备案状态CAC filing
未见于备案名单not in filing list:未见于网信办公示名单(2026-10-20 检索 13 批附件,https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm);该产品未面向大陆公众提供服务,备案不适用。not in the CAC public registry (13 batch attachments searched 2026-10-20, https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm); the product does not serve the mainland public, so filing does not apply.

备案信息以网信办《生成式人工智能服务已备案信息》公示名单为准(按批次滚动更新,本站只抄编号不解读);「大陆可直连」是本站从大陆网络直连实测的结果,不是厂商承诺。GitHub 类站点当日实测有波动,口径写在依据里。Filing status is quoted from the CAC public registry (updated batch by batch; this site copies the number and does not interpret it). "Direct access" is this site's own reachability measurement from a mainland network, not a vendor promise. GitHub-hosted sites fluctuated on the measurement day — the note says so.

固定坐标系Fixed coordinate system

11 个维度dimensions, 与同分区其他对象逐项可比each comparable item by item against others in the same section.

模型与开放条件Model & openness

本身不调用模型,是被客户端调用的接口实现。

依赖 @modelcontextprotocol/sdk(npm 2026.8.31 实测 ^1.30.0); 协议版本在 initialize 握手时由 SDK 与客户端协商,不绑定单一版本。

运行位置Where it runs

本地 Node.js 子进程,通过 stdio 与客户端通信。 生命周期绑定客户端进程,客户端退出即停止。

本地文件Local files

核心能力。默认不支持无限制访问: 必须通过命令行参数指定允许目录,或客户端支持 Roots 协议动态下发。 若无参数启动且客户端不支持 roots,server 在初始化阶段直接报错。

关机后的任务Tasks after shutdown

不支持。本地 stdio 进程随客户端生死, 无独立守护或云端执行形态。

工具与扩展Tools & extensions

提供 11 个工具:read_text_file、read_media_file、read_multiple_files、

write_file、edit_file、create_directory、list_directory、

list_directory_with_sizes、move_file、search_files、directory_tree。

输出为结构化内容,可直接消费。

上下文与记忆Context & memory

无状态。每次调用独立,不保留会话记忆。 list_allowed_directories 可查询当前生效目录。

权限与限制Permissions & limits

无独立审批机制,权限边界完全由允许目录决定。 全部文件操作限制在允许目录内,越界会被拒绝。

注意:提供 write_file / edit_file / move_file / create_directory, 属可写但无删除工具的组合。

适合什么任务Best for

让 Agent 安全读写指定目录内的文本与媒体文件。 不适合需要删除操作或需要跨目录聚合的场景。

传输方式Transport

仅 stdio。本地 Node.js 进程,通过标准输入输出通信。

官方 README(2026-10-08 全文核验)只给两种本地启动方式。 即 npx 与 Docker。它没有远程传输的官方配置。 目录控制走命令行参数或 MCP Roots(可动态更新)。

认证机制Authentication

无独立认证层。stdio 形态继承启动它的客户端用户的全部文件权限。 权限边界不是认证机制,而是目录白名单。

权限范围Permission scope

默认范围窄且强制显式:必须通过命令行参数指定允许目录, 或客户端支持 Roots 协议动态下发。 无参数且客户端不支持 roots 时,server 初始化即报错。

不提供删除工具;提供写入、编辑、移动、建目录。 可用 list_allowed_directories 查询当前生效目录。

头号误解Top misconception

  • 以为官方仓库的 server 可以直接上生产,README 明确声明仅供参考实现Assuming the official repo's server is production-ready — the README states it is a reference implementation only
  • 不传目录参数就启动,会在初始化阶段报错而不是静默访问全盘Starting it without a directory argument — it errors at initialisation rather than silently touching the whole disk
  • 以为没给 write 类工具就不能改文件,write_file / edit_file 确实可写Assuming that withholding write tools prevents file changes — write_file / edit_file do write

未知项清单Known unknowns

  • 最低协议版本要求(仓库未声明)
  • 是否支持 Streamable HTTP(仓库未声明)
  • 输出结构的具体 schema(需读源码或实测)
  • 各工具在路径不存在时的错误信息质量

证据来源Evidence sources

判断可回到以下一手源复核。本站核验日Every judgement can be rechecked against the primary sources below. Verified on 2026-10-08,内容更新日content updated on 2026-10-08。

类型Type名称Name链接Link
changelogMCP · Servers Releases(2026.8.31 / 2026.8.18 / 2026.7.10)https://github.com/modelcontextprotocol/servers/releases
changelogMCP · Filesystem 目录变更历史https://github.com/modelcontextprotocol/servers/commits/main/src/filesystem
docsMCP · Filesystem Serverhttps://github.com/modelcontextprotocol/servers/tree/main/src/filesystem
repoMCP · Servers 仓库 README(含生产环境免责声明)https://github.com/modelcontextprotocol/servers
docsMCP · 规范https://modelcontextprotocol.io/specification

实测记录Measured runs

本站尚未完成实测。测试协议见 tasks/_protocol.md。

变更记录说明

本对象无独立 changelog 页。变更记录看 MCP servers 仓库的 releases 页。目录级改动看该目录的 commit 历史:

日期类型内容
2026-09-03fix声明 zod 运行时依赖
2026-08-30fix拒绝 POSIX 下的 Windows 路径
2026-08-28fixcreate_directory 不创建父目录

仓库整体 releases:2026.8.31 / 2026.8.18 / 2026.7.10。

注意 08-30 那个修复。它说明 filesystem server 在不同平台路径语义上出过问题。这是实测时值得关注的点。

⚠ 生产环境免责声明(适用于全部官方 reference server)

MCP servers 仓库 README 原文:

The servers in this repository are intended as reference implementations to demonstrate MCP features and SDK usage. They are meant to serve as educational examples for developers building their own MCP servers, not as production-ready solutions. Developers should evaluate their own security requirements and implement appropriate safeguards based on their specific threat model and use case.

翻译:本仓库的 server 是参考实现,用于演示 MCP 特性与 SDK 用法。 它面向正在构建自己 MCP server 的开发者,不是生产就绪方案。 使用者需自行评估安全需求并按自身威胁模型实现防护。

注意:这句话适用于本分区所有官方 reference server, 每个条目的正文都应保留这一提示。

权限设计实测记录

这是本 server 最有价值的设计细节。

场景行为
启动时传目录参数以参数为允许目录
启动时不传参数 + 客户端支持 Roots客户端 roots 完全替换服务端目录
启动时不传参数 + 客户端不支持 Roots初始化阶段报错
运行时客户端 roots 变更通过 roots/list_changed 通知更新,无需重启

"无参数 + 不支持 roots = 启动失败"这个设计值得肯定—— 它把一个潜在的权限失控(无限制文件访问)变成了显式的失败。

工具清单

类别工具
读read_text_file read_media_file read_multiple_files
写write_file edit_file
目录create_directory list_directory list_directory_with_sizes move_file directory_tree
检索search_files

注意:没有删除工具。这是有意的权限收敛设计。

相关条目Related entries

本页由This page is generated from the ai-agent-guide 数据层生成(CC BY 4.0)。data layer (CC BY 4.0). 方法论与坐标系定义见仓库内 METHODOLOGY.md。