MCP Filesystem Server
:закладка: О нас
MCP Filesystem Server обеспечивает безопасный доступ к файловой системе для моделей ИИ через Model Context Protocol. Он обеспечивает строгую проверку пути и разрешает доступ только к предопределенным каталогам.
Related MCP server: MCP Filesystem Server
:компьютер: Технологии
:wrench: Инструменты
:пакет: Установка
:heavy_check_mark: Предварительные условия
Необходимо установить следующее программное обеспечение:
Node.js (>=18.0.0)
пнпм (>=8.0.0)
Докер (необязательно)
Docker Compose (необязательно)
:arrow_down: Клонирование репозитория
$ git clone https://github.com/gabrielmaialva33/mcp-filesystem.git
$ cd mcp-filesystem:arrow_forward: Запуск приложения
Местное развитие
# Install dependencies
$ pnpm install
# Build the application
$ pnpm build
# Run the server (specify directory to allow access to)
$ pnpm start /path/to/allowed/directory
# Or use configuration file
$ pnpm start --config=config.jsonИспользование пакета NPM
# Install globally
$ npm install -g @gabrielmaialva33/mcp-filesystem
# Run the server
$ mcp-filesystem /path/to/allowed/directory
# Or use with npx (no installation needed)
$ npx @gabrielmaialva33/mcp-filesystem /path/to/allowed/directory
# Create a sample configuration file
$ npx @gabrielmaialva33/mcp-filesystem --create-config=config.jsonИспользование Докера
# Build the Docker image
$ docker build -t gabrielmaialva33/mcp-filesystem .
# Run using Docker
$ docker run -i --rm -v /path/to/data:/data:ro gabrielmaialva33/mcp-filesystem /data
# Use with config file
$ docker run -i --rm -v /path/to/config.json:/app/config.json -v /path/to/data:/data gabrielmaialva33/mcp-filesystem --config=/app/config.jsonИспользование Docker Compose
# Create a data directory
$ mkdir -p data
# Start the server
$ docker-compose up -d:gear: Использование
Использование с Claude Desktop
Claude Desktop можно настроить на использование этого сервера MCP для доступа к файловой системе. Добавьте следующее в ваш claude_desktop_config.json :
Использование локальной установки (рекомендуется)
{
"mcpServers": {
"filesystem": {
"command": "mcp-filesystem",
"args": [
"/Users/gabrielmaia/Documents",
"/Users/gabrielmaia/Desktop",
"/Users/gabrielmaia/Downloads"
]
}
}
}Обязательно сделайте исполняемый файл доступным глобально:
# Make the binary executable
chmod +x /Users/gabrielmaia/.nvm/versions/node/v22.14.0/bin/mcp-filesystemИспользование NPX
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@gabrielmaialva33/mcp-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}Использование Докера
Примечание: При использовании Docker все каталоги должны быть смонтированы в /projects по умолчанию. Добавление флага ro сделает каталог доступным только для чтения.
{
"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",
"gabrielmaialva33/mcp-filesystem",
"/projects"
]
}
}
}Доступные инструменты
Сервер файловой системы MCP предоставляет следующие инструменты:
Операции файловой системы
read_file : Прочитать содержимое файла
read_multiple_files : Чтение нескольких файлов одновременно
write_file : Создать или перезаписать файл
edit_file : Вносите точные изменения с помощью предварительного просмотра различий
create_directory : Рекурсивное создание каталогов
list_directory : Список содержимого каталога
directory_tree : Получить рекурсивное древовидное представление
move_file : Переместить или переименовать файлы
search_files : Поиск файлов, соответствующих шаблонам
get_file_info : Получить метаданные файла
list_allowed_directories : Просмотреть доступные каталоги
Системные и сетевые операции
get_metrics : Просмотр показателей производительности сервера (v0.3.0+)
execute_command : безопасное выполнение системных команд (v0.3.1+)
curl_request : выполнение HTTP-запросов к внешним API (в версии 1.2.0)
Использование инструмента curl_request (в версии 1.2.0)
Инструмент curl_request позволит вам делать HTTP-запросы к внешним API:
// Example: Making a GET request with authentication
curl_request({
url: 'https://api.example.com/data',
method: 'GET',
headers: {
Authorization: 'Bearer your_token_here',
},
})
// Example: POST request with JSON data
curl_request({
url: 'https://api.example.com/create',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: '{"name":"Example","value":123}',
})Более подробные примеры смотрите в файле docs/curl-tool-examples.md .
:sparkles: Особенности
Основные характеристики
Безопасный доступ : строгая проверка пути предотвращает несанкционированный доступ.
Операции с файлами : чтение, запись, редактирование и перемещение файлов.
Операции с каталогами : создание, перечисление, получение древовидных представлений и поиск по каталогам.
Доступ к метаданным : просмотр информации о файлах и каталогах
Выполнение команд : безопасное выполнение системных команд со строгой проверкой
Поддержка Docker : простое развертывание с Docker и Docker Compose
Новые возможности в v0.3.0
Структурированное ведение журнала : подробное ведение журнала с различными уровнями (отладка, информация, предупреждение, ошибка)
Показатели производительности : отслеживайте количество операций, ошибок и время выполнения.
Управление конфигурацией : поддержка файлов конфигурации JSON
Кэширование путей : улучшенная производительность для часто используемых путей.
Улучшенная обработка ошибок : специализированные типы ошибок со структурированной информацией
Проверка размера файла : предотвращение загрузки слишком больших файлов.
Улучшения CLI : команды справки, информация о версии и генерация конфигурации
Параметры конфигурации
Вы можете создать файл конфигурации, используя:
$ mcp-filesystem --create-config=config.jsonПример конфигурации:
{
"allowedDirectories": ["/path/to/allowed/dir1", "/path/to/allowed/dir2"],
"logLevel": "info",
"logFile": "/path/to/logs/mcp-filesystem.log",
"serverName": "secure-filesystem-server",
"serverVersion": "0.3.0",
"cache": {
"enabled": true,
"maxSize": 1000,
"ttlMs": 60000
},
"metrics": {
"enabled": true,
"reportIntervalMs": 60000
},
"security": {
"maxFileSize": 10485760,
"allowSymlinks": true,
"validateRealPath": true
}
}:writing_hand: Автор
Лицензия
Available Tools
16 toolsbash_executeB
Execute a Bash command directly with output capture. More flexible than execute_command but still with security restrictions. Allows for direct access to Bash functionality.
Inputs: command (required), env, timeout, workingDir.
bash_pipeB
Execute a sequence of Bash commands piped together. Allows for powerful command combinations with pipes. Results include both stdout and stderr.
Inputs: commands (required), env, timeout, workingDir.
create_directoryA
Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.
Inputs: path (required).
curl_requestB
Execute a curl request to an external HTTP API. Allows specifying URL, method, headers, and data. Useful for integrating with external services via HTTP.
Inputs: url (required), data, followRedirects, headers, +3 more.
directory_treeA
Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.
Inputs: path (required).
edit_fileA
Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
Inputs: edits (required), path (required), dryRun.
execute_commandB
Execute a system command with security restrictions. Validates commands for safety and provides detailed output. Limited to basic system operations with security checks.
Inputs: command (required), captureOutput, timeout, workingDir.
get_file_infoA
Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.
Inputs: path (required).
get_metricsB
Returns performance metrics about server operations. Useful for monitoring and debugging.
Inputs: no named parameters.
list_allowed_directoriesA
Returns the list of directories that this server is allowed to access. Use this to understand which directories are available before trying to access files.
Inputs: no named parameters.
list_directoryA
Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
Inputs: path (required).
move_fileA
Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.
Inputs: destination (required), source (required).
read_fileA
Read the complete contents of a file from the file system. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories.
Inputs: path (required), encoding.
read_multiple_filesA
Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.
Inputs: paths (required), encoding.
search_filesA
Recursively search for files and directories matching a pattern. Searches through all subdirectories from the starting path. The search is case-insensitive and matches partial names. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.
Inputs: path (required), pattern (required), excludePatterns.
write_fileA
Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.
Inputs: content (required), path (required), encoding.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, but there is some overlap between bash_execute, bash_pipe, and execute_command, which could cause confusion about when to use each. The descriptions help differentiate them, but the boundaries are not entirely clear, especially between bash_execute and execute_command.
All tool names follow a consistent snake_case pattern with clear verb_noun structures, such as create_directory, read_file, and search_files. There are no deviations in naming conventions, making the set predictable and easy to understand.
With 16 tools, the count is slightly high but reasonable for a filesystem server covering operations like file management, directory handling, and system commands. It includes essential tools without being overly bloated, though some consolidation might improve efficiency.
The tool set provides comprehensive coverage for filesystem operations, including CRUD for files and directories, metadata retrieval, searching, editing, and system command execution. There are no obvious gaps; agents can perform typical filesystem tasks without dead ends.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.10 npm10MIT
- AlicenseAqualityFmaintenanceA Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.2167MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides AI agents with secure access to local filesystem operations, enabling reading, writing, and managing files through a standardized interface.10110 npm54Apache 2.0
- AlicenseAqualityDmaintenanceProvides secure filesystem access for AI models through the Model Context Protocol with strict path validation, file operations, directory management, and system command execution within predefined directories.1681 npmMIT