MCP Filesystem Server
:bookmark: について
**MCPファイルシステムサーバーは、**モデルコンテキストプロトコルを通じてAIモデルに安全なファイルシステムアクセスを提供します。厳格なパス検証を実施し、事前定義されたディレクトリへのアクセスのみを許可します。
Related MCP server: MCP Filesystem Server
:コンピュータ: テクノロジー
:wrench: ツール
:package: インストール
:heavy_check_mark:前提条件
次のソフトウェアをインストールする必要があります:
Node.js (>=18.0.0)
pnpm (>=8.0.0)
Docker (オプション)
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.jsonNPMパッケージの使用
# 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.jsonDockerの使用
# 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.jsonDocker 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使用するように設定できます。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-filesystemNPXの使用
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@gabrielmaialva33/mcp-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}Dockerの使用
注: Docker ro使用する場合、すべてのディレクトリはデフォルトで/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 : 外部 API への HTTP リクエストを実行する (v1.2.0 で導入予定)
curl_request ツールの使用 (v1.2.0 で登場)
curl_requestツールを使用すると、外部 API に HTTP リクエストを送信できます。
// 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.10MIT
- 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.1082 npm55Apache 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.16MIT