---
title: "Filesystem：Claude、Cursor、Codex 配置指南 · DotsAgent"
description: "读取、写入、搜索和移动本地文件；访问范围仅限于启动时传入的目录。 在 13 个 MCP 客户端中配置 Filesystem。"
url: https://dotsagent.io/zh/mcp/servers/filesystem
---

文件 · MCP Steering Group

# 配置 Filesystem

读取、写入、搜索和移动本地文件；访问范围仅限于启动时传入的目录。

- **发布者**: MCP Steering Group 官方
- **本地运行**: `npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir`
- **传输方式**: stdio
- **身份验证**: 无。访问范围仅限通过参数或 roots 指定的目录。
- **可访问内容**: 读取和写入允许目录中的文件。
- **许可证**: MIT (existing) / Apache-2.0 (new contributions)
- **源码**: [github.com/modelcontextprotocol/servers/tree/main/src/filesystem](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem)
- **状态**: 活跃

## 安装

此服务器会在你的本机上作为客户端的子进程运行。你需要安装其命令所用的运行时，例如 npx 需要 Node.js、uvx 需要 uv，或者使用 Docker；还需要设置 Environment 下列出的变量。

### Claude Code

`shell`

```
claude mcp add --scope project filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir
```

### Cursor

`.cursor/mcp.json`

```
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/allowed/dir"
      ]
    }
  }
}
```

### Codex

`~/.codex/config.toml`

```
[mcp_servers.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
```

[其他客户端的配置 →](https://dotsagent.io/zh/mcp/config#add=filesystem)

Agent 可以覆盖或移动你允许访问的目录中的任何内容，因此只列出它需要的目录。

## 来源

1. [github.com](https://github.com/modelcontextprotocol/servers)/modelcontextprotocol/servers
2. [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/develop/connect-local-servers)/docs/develop/connect-local-servers

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
