本项目是一个用 Go 语言实现的模型上下文协议(MCP)文件系统操作服务器,可实现文件与目录的读取、写入、创建、删除、移动、搜索等操作,还能获取文件元数据和生成目录树结构。
go install github.com/mark3labs/mcp-filesystem-server
claude_desktop_config.json在 claude_desktop_config.json 中添加以下内容:
{
"mcpServers": {
"filesystem": {
"command": "mcp-filesystem-server",
"args": [
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
⚠️ 重要提示
该服务器仅允许在
args中指定的目录内执行操作。
file://system:文件系统操作接口read_file
path(字符串)read_multiple_files
paths(字符串数组)write_file
path(字符串):文件路径content(字符串):文件内容create_directory
path(字符串)list_directory
path(字符串)move_file
source(字符串)destination(字符串)search_files
path(字符串):起始目录pattern(字符串):搜索模式get_file_info
path(字符串)tree
path(字符串):要遍历的目录(必需)depth(数字):要遍历的最大深度(默认值:3)follow_symlinks(布尔值):是否要跟随符号链接(默认值:false)list_allowed_directories
此 MCP 服务器根据 MIT License 分发。这意味着您可以自由地使用、修改和分发软件,但需遵守 MIT License 的条款和条件。有关更多详细信息,请参阅项目存储库中的 LICENSE 文件。