增强型文件系统MCP服务器
一种改进的文件系统MCP服务器 人类参照实施 添加了命名路径和模糊搜索功能。
特性
- 命名路径:配置路径别名,如
notes:/home/user/notes所以你可以说“查看我的笔记”,而不是记住完整的路径 - 模糊文件搜索:通过近似名称匹配查找文件(例如,搜索“meeting”找到“meeting-notes-2024.md”)
- 模糊内容搜索:使用模糊匹配在文件内容中搜索
- 完全参考兼容性:来自原始Anthropic文件系统MCP服务器的所有14个工具
安装
npm install
npm run build配置
命名路径
通过CLI参数或配置文件配置路径别名。CLI参数优先。
CLI:
node dist/index.js --path notes:/home/user/notes --path projects:/home/user/code配置文件 (~/.filesystem-mcp.json):
{
"paths": {
"notes": "/home/user/notes",
"projects": "/home/user/code"
}
}使用Claude Desktop
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": [
"/path/to/filesystem-mcp/dist/index.js",
"--path", "notes:/home/user/notes",
"--path", "projects:/home/user/code",
"--path", "documents:/Users/luke/My Documents"
]
}
}
}注: 完全支持带空格的路径。配置文件中不需要额外的引用。
使用Claude代码
添加到您的Claude Code MCP配置中:
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": [
"/path/to/filesystem-mcp/dist/index.js",
"--path", "notes:/home/user/notes",
"--path", "mydocs:/Users/luke/My Documents/Work Files"
]
}
}
}工具
新工具
| 工具 | 说明 |
|---|---|
list_named_paths | 列出所有已配置的命名路径别名 |
fuzzy_search_files | 使用模糊匹配按名称搜索文件 |
fuzzy_search_content | 使用模糊匹配在文件内容中搜索 |
标准工具(参考)
| 工具 | 说明 |
|---|---|
read_file | 读取文件内容(已弃用,请使用 read_text_file) |
read_text_file | 以文本形式读取文件内容 |
read_media_file | 以base64格式读取图像/音频文件 |
read_multiple_files | 一次读取多个文件 |
write_file | 创建或覆盖文件 |
edit_file | 使用diff输出进行基于行的编辑 |
create_directory | 创建目录(递归) |
list_directory | 列出目录内容 |
list_directory_with_sizes | 列出包含文件大小的目录 |
directory_tree | 获取JSON格式的递归树 |
move_file | 移动或重命名文件 |
search_files | 使用球形图案搜索 |
get_file_info | 获取文件元数据 |
list_allowed_directories | 列出可访问的目录 |
所有标准工具都支持命名路径前缀(例如。, notes/docs/file.md).
例子
配置后,您可以与Claude一起使用自然语言:
- “在我的笔记中查找有关会议的任何信息”
- “在我的项目中查找自述文件”
- “更新我的待办事项列表以添加新项目”
- “在我的笔记中搜索有关API设计的内容”
Claude将使用命名路径和模糊搜索来定位文件,而不需要精确的路径。
发展
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run watch
# Run tests
npm test许可证
麻省理工学院
