|
|
6 сар өмнө | |
|---|---|---|
| .. | ||
| README.cn.md | 6 сар өмнө | |
| README.md | 6 сар өмнө | |
| init.go | 6 сар өмнө | |
https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem
实现模型上下文协议 (MCP) 的 Node.js 服务器,用于文件系统操作。
注意:服务器只允许在通过 args 指定的目录内进行操作。
file://system:文件系统操作接口read_file
path(字符串)read_multiple_files
paths(字符串数组)write_file
path(字符串):文件位置content(字符串):文件内容edit_file
path(字符串):要编辑的文件edits(数组):编辑操作列表
oldText(字符串):要搜索的文本(可以是子字符串)newText(字符串):要替换的文本dryRun(布尔值):预览更改而不应用(默认:false)create_directory
path(字符串)list_directory
path(字符串)move_file
source(字符串)destination(字符串)search_files
path(字符串):起始目录pattern(字符串):搜索模式excludePatterns(字符串数组):排除模式。支持 Glob 格式。get_file_info
path(字符串)list_allowed_directories
将此内容添加到您的 claude_desktop_config.json:
注意:您可以通过将沙盒目录挂载到 /projects 来为服务器提供沙盒目录。添加 ro 标志将使目录对服务器只读。
注意:默认情况下,所有目录都必须挂载到 /projects。
{
"mcpServers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
"--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
"--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
"mcp/filesystem",
"/projects"
]
}
}
}
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
快速安装,请点击下面的安装按钮...
手动安装时,将以下 JSON 块添加到 VS Code 的用户设置 (JSON) 文件中。您可以按 Ctrl + Shift + P 并输入 Preferences: Open Settings (JSON) 来执行此操作。
可选地,您可以将其添加到工作区中名为 .vscode/mcp.json 的文件中。这将允许您与他人共享配置。
注意在
.vscode/mcp.json文件中不需要mcp键。
您可以通过将沙盒目录挂载到 /projects 来为服务器提供沙盒目录。添加 ro 标志将使目录对服务器只读。
注意:默认情况下,所有目录都必须挂载到 /projects。
{
"mcp": {
"servers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=${workspaceFolder},dst=/projects/workspace",
"mcp/filesystem",
"/projects"
]
}
}
}
}
{
"mcp": {
"servers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"${workspaceFolder}"
]
}
}
}
}
Docker 构建:
docker build -t mcp/filesystem -f src/filesystem/Dockerfile .
此 MCP 服务器根据 MIT 许可证授权。这意味着您可以自由使用、修改和分发软件,但需遵守 MIT 许可证的条款和条件。有关更多详细信息,请参阅项目存储库中的 LICENSE 文件。