MCP Configs2026年4月7日·1 分钟阅读

Filesystem MCP — Local File Access for AI Agents

Official MCP server that gives AI agents safe, scoped access to your local filesystem. Read, write, search, and manage files and directories with configurable permissions. 4,000+ stars.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Established
入口
Filesystem MCP — Local File Access for AI Agents
安全暂存命令
npx -y tokrepo@latest install 92b8baf2-3780-401c-aeba-62c0b6842922 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Filesystem MCP gives AI agents sandboxed read/write access to local files via the MCP protocol.
§01

What it is

Filesystem MCP is the official Model Context Protocol server for local file access. It gives AI agents like Claude Code safe, scoped access to read, write, search, and manage files within a specified root directory. The agent cannot escape the root directory, which is enforced by the server as a security boundary.

This server is designed for workflows where agents need to manage files outside the current project directory, such as config files, data directories, or multi-repo setups. It works with any MCP-compatible client and can be set up in under a minute.

§02

How it saves time or tokens

Filesystem MCP eliminates the need to manually copy-paste file contents into chat or write custom file access scripts. The agent can directly read configuration files, write output data, and search across directories. The scoped access model means you grant access once and the agent operates within those bounds without repeated permission prompts. At an estimated 2,400 tokens per workflow interaction, the MCP protocol overhead is minimal compared to the manual alternative.

§03

How to use

  1. Add the filesystem server to your MCP configuration:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
    }
  }
}
  1. The last argument is the root directory. The agent can only access files within this path.
  1. Restart your MCP client (Claude Code, Cursor, etc.) and the filesystem tools become available.
§04

Example

Common operations after configuring the filesystem MCP server:

# Agent can now perform these operations via MCP tools:

# read_file - Read any file within the root
'Read the contents of ~/projects/shared/config.yaml'

# write_file - Create or overwrite files
'Save this JSON data to ~/projects/data/output.json'

# list_directory - Browse directory contents
'Show all files in ~/projects/backend/src/'

# search_files - Find files by name or content
'Find all .env files under ~/projects/'
'Search for files containing DATABASE_URL'

# create_directory - Make new directories
'Create ~/projects/backups/2026-04-15'

# move_file - Rename or relocate files
'Rename old-config.yaml to config.yaml.bak'
§05

Related on TokRepo

§06

Common pitfalls

  • Setting the root directory too broadly (e.g., the home directory) exposes more files than necessary. Scope it to the specific project or data directory the agent needs.
  • The server does not support symlinks that point outside the root directory. If your project relies on symlinks, verify they resolve within the allowed path.
  • Running multiple filesystem MCP servers with overlapping root directories can cause file conflict issues. Use a single server with the broadest necessary scope instead.

常见问题

Is the filesystem MCP server safe to use?+

Yes. The server enforces a root directory boundary. The agent cannot read, write, or list files outside the specified root path. This is a server-side security constraint, not a client-side one.

What MCP clients support the filesystem server?+

Any MCP-compatible client works, including Claude Code, Cursor, and other tools that implement the Model Context Protocol. The server communicates over standard input/output.

Can the agent delete files through the filesystem MCP?+

The filesystem MCP server provides read, write, list, search, move, and create operations. Deletion is not included in the default tool set to prevent accidental data loss.

How do I give access to multiple directories?+

You can specify multiple root directories as additional arguments to the server command, or configure multiple filesystem MCP server instances with different root paths in your MCP configuration.

Does the filesystem MCP server work on Windows?+

Yes. The server works on macOS, Linux, and Windows. File paths should use the operating system's native path format. On Windows, use backslash paths or forward slashes.

引用来源 (3)
🙏

来源与感谢

Part of MCP Servers. Licensed under MIT.

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产