本项目提供了MCP服务器文件系统工具,可在Claude Desktop中使用,通过特定配置和命令行选项实现对文件系统的操作,并具备多种安全机制保障系统安全。
要在Claude Desktop中使用MCP服务器,请将以下配置添加到claude_desktop_config.json
:
{
"mcpServers": {
"aibd": {
"command": "npx",
"args": [
"-y",
"@gergelyszerovay/mcp-server-aibd-devcontainer",
"--allowedDirectories=/your/allowed/path"
// 如果需要启用shell命令执行工具,请在此处添加"--enableShellExecTool"
]
}
}
}
按照上述快速开始中的步骤,将配置添加到claude_desktop_config.json
文件,即可完成MCP服务器在Claude Desktop中的安装配置。
以下是一些使用MCP服务器的基础命令示例:
# 启用HTTP传输并指定允许访问的目录为当前目录
$ mcp-fs --allowedDirectories=. --enableHttpTransport
# 指定允许访问的目录为/home/user/projects,并设置MCP HTTP服务器端口为3005,REST HTTP服务器端口为3006
$ mcp-fs --allowedDirectories=/home/user/projects --mcpHttpPort=3005 --restHttpPort=3006
# 指定多个允许访问的目录
$ mcp-fs --allowedDirectories=/path/to/dir1 --allowedDirectories=/path/to/dir2
# 设置初始操作模式为mcpPlan
$ mcp-fs --allowedDirectories=. --initialMode=mcpPlan
# 启用shell命令执行工具
$ mcp-fs --allowedDirectories=. --enableShellExecTool
以下是MCP服务器的可用选项:
MCP文件系统工具服务器。
选项:
--enableHttpTransport 启用HTTP传输 [默认: false]
--enableStdioTransport 启用stdio传输 [默认: true]
--enableRestServer 启用REST API服务器 [默认: false]
--enableShellExecTool 启用shell命令执行工具 [默认: false]
--mcpHttpPort=<端口> MCP HTTP服务器的端口 [默认: 3001]
--restHttpPort=<端口> REST HTTP服务器的端口 [默认: 3002]
--allowedDirectories=<路径> 允许访问的目录(多个,必需)
--initialMode=<模式> 初始操作模式:mcpAct或mcpPlan [默认: mcpAct]
--帮助 显示此帮助信息
示例:
$ mcp-fs --allowedDirectories=. --enableHttpTransport
$ mcp-fs --allowedDirectories=/home/user/projects --mcpHttpPort=3005 --restHttpPort=3006
$ mcp-fs --allowedDirectories=/path/to/dir1 --allowedDirectories=/path/to/dir2
$ mcp-fs --allowedDirectories=. --initialMode=mcpPlan
$ mcp-fs --allowedDirectories=. --enableShellExecTool
服务器实现两种操作模式:
所有操作均限制在启动时指定的明确允许目录内。尝试访问这些目录之外的文件将导致错误。
shell命令执行工具默认禁用,必须通过--enableShellExecTool
标志显式启用。启用后提供以下安全功能:
⚠️ 重要提示
启用shell命令执行将授予模型在系统上执行任意命令的能力。始终仔细审查AI生成的命令后再允许其执行。