# 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. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Add to your `.mcp.json`: ```json { "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"] } } } ``` The last argument is the root directory — the agent can only access files within it. Restart Claude Code. --- ## Intro Filesystem MCP is the official Model Context Protocol server for local file access with 4,000+ GitHub stars. 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 — it is sandboxed by design. Best for workflows where agents need to manage files outside the current project directory, like config files, data directories, or multi-repo setups. Works with: Claude Code, Cursor, any MCP client. Setup time: under 1 minute. --- ## Available Tools ### `read_file` ``` "Read the contents of ~/projects/shared/config.yaml" ``` ### `write_file` ``` "Save this JSON data to ~/projects/data/output.json" ``` ### `list_directory` ``` "Show all files in ~/projects/backend/src/" ``` ### `search_files` ``` "Find all .env files under ~/projects/" "Search for files containing 'DATABASE_URL'" ``` ### `create_directory` ``` "Create a new directory ~/projects/backups/2026-04-07" ``` ### `move_file` ``` "Rename old-config.yaml to config.yaml.bak" ``` ### `get_file_info` ``` "Show the size and modification date of package.json" ``` ## Security Model ### Scoped Root The agent can ONLY access files under the specified root: ```json "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"] ``` - Access `/Users/you/projects/app/src/` — allowed - Access `/Users/you/.ssh/` — blocked - Access `/etc/passwd` — blocked ### Multiple Roots Allow access to multiple directories: ```json "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects", "/Users/you/documents"] ``` ### Read-Only Mode For safety, restrict to read-only: ```json "args": ["-y", "@modelcontextprotocol/server-filesystem", "--read-only", "/path"] ``` ### Key Stats - 4,000+ GitHub stars - Official MCP server - Sandboxed root directory - Read, write, search, move - Read-only mode available ### FAQ **Q: What is Filesystem MCP?** A: The official MCP server for local file access, giving AI agents scoped read/write access to files within a specified root directory. **Q: Is it safe?** A: Yes, the agent cannot access files outside the specified root directory. Use read-only mode for extra safety. **Q: How is this different from Claude Code's built-in file access?** A: Claude Code accesses the current project directory. Filesystem MCP lets you grant access to additional directories outside the project. --- ## Source & Thanks > Part of [MCP Servers](https://github.com/modelcontextprotocol/servers). Licensed under MIT. > > [server-filesystem](https://github.com/modelcontextprotocol/servers) — stars 4,000+ --- ## 快速使用 将以下配置添加到 `.mcp.json`: ```json { "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/你的/项目/路径"] } } } ``` --- ## 简介 Filesystem MCP 是官方本地文件访问 MCP 服务器,GitHub 4,000+ stars。在指定根目录范围内安全地读写、搜索和管理文件。Agent 无法访问根目录之外的文件。支持只读模式。 --- ## 来源与感谢 > Part of [MCP Servers](https://github.com/modelcontextprotocol/servers). Licensed under MIT. --- Source: https://tokrepo.com/en/workflows/92b8baf2-3780-401c-aeba-62c0b6842922 Author: MCP Hub