这是一个基于FastMCP框架构建的文件系统管理服务器,能提供全面的文件和目录操作功能,像复制、移动、删除文件等,还支持获取系统信息。目前在Windows平台上功能最为完善。
git clone https://github.com/yourusername/file-system-server.git
cd file-system-server
pip install -r requirements.txt
根据示例修改claude_desktop_config.json以指向正确的Python解释器和服务器文件路径。
pip install -r requirements.txt
# 以下为使用文件操作功能的示例代码
from fs_server import copy_file, move_file, delete_file
# 复制文件
copy_file('source_file.txt', 'destination_file.txt', backup=True)
# 移动文件
move_file('old_location.txt', 'new_location.txt', backup=True)
# 删除文件
delete_file('file_to_delete.txt')
# 以下为获取系统信息的示例代码
from fs_server import get_system_info, get_disk_info
# 获取系统基本信息
system_info = get_system_info()
print(system_info)
# 查询磁盘使用情况
disk_info = get_disk_info()
print(disk_info)
file-system-server/
├── fs_server.py # 主要实现文件系统服务
├── windows_utils.py # Windows平台特定的功能模块
├── requirements.txt # 依赖项列表
└── claude_desktop_config.json # Claude桌面配置示例
copy_file:复制文件,可选备份。move_file:移动文件,可选备份。delete_file:安全删除文件。read_file:读取文件内容。write_file:写入文件内容。get_file_info:获取文件详细信息。search_files:按名称搜索文件。list_directory:列出目录内容。create_directory:创建新目录。delete_directory:删除目录。list_directory_recursively:递归显示目录结构。search_directories:按名称搜索目录。get_system_info:获取系统基本信息。get_disk_info:查询磁盘使用情况。该项目基于FastMCP框架构建,在Windows平台上能充分利用windows_utils.py模块实现特定功能,而在macOS/Linux上则主要聚焦于基本的文件和目录操作。所有文件操作都包含路径验证,以确保操作的安全性,同时在进行破坏性操作前会创建备份文件。
本项目遵循MIT License协议,具体见LICENSE文件。