Filesystem MCP Server

文件系统stdiov2026.1.26
代码仓库

通过 Model Context Protocol 安全访问本地文件系统。AI 智能体可以在可配置的访问控制下读取、写入、搜索和管理文件及目录,支持读取文件内容、创建目录、移动文件以及使用 glob 模式搜索。

此描述由机器自动翻译,尚未经过人工审核。

连接

将此配置添加到 .claude/mcp.json

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

工具 (6)

read_file

Read the complete contents of a file from the filesystem. Returns the file content as UTF-8 text.

{
  "type": "object",
  "required": [
    "path"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Absolute path to the file to read"
    }
  }
}

write_file

Write content to a file, creating it if it does not exist or overwriting if it does.

{
  "type": "object",
  "required": [
    "path",
    "content"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Absolute path to the file to write"
    },
    "content": {
      "type": "string",
      "description": "Content to write to the file"
    }
  }
}

list_directory

List the contents of a directory, returning file and subdirectory names.

{
  "type": "object",
  "required": [
    "path"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Absolute path to the directory to list"
    }
  }
}

create_directory

Create a new directory, including any necessary parent directories.

{
  "type": "object",
  "required": [
    "path"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Absolute path of the directory to create"
    }
  }
}

move_file

Move or rename a file or directory from one location to another.

{
  "type": "object",
  "required": [
    "source",
    "destination"
  ],
  "properties": {
    "source": {
      "type": "string",
      "description": "Source path of the file or directory"
    },
    "destination": {
      "type": "string",
      "description": "Destination path"
    }
  }
}

search_files

Search for files matching a glob pattern within a directory tree.

{
  "type": "object",
  "required": [
    "path",
    "pattern"
  ],
  "properties": {
    "path": {
      "type": "string",
      "description": "Base directory to search from"
    },
    "pattern": {
      "type": "string",
      "description": "Glob pattern to match files against"
    }
  }
}

资源 (1)

file:///{path}

Access to files on the local filesystem within allowed directories.

提示词

此服务器未提供任何提示词。

服务器信息

作者
Anthropic (@modelcontextprotocol)
代码仓库
https://github.com/modelcontextprotocol/servers
许可证
Apache-2.0
版本
2026.1.26
星标
86,206
最后更新
2026年1月27日