Filesystem MCP Server
ファイルシステムMCPサーバー
包括的な権限制御と強化された機能を備えたファイルシステム操作用のモデル コンテキスト プロトコル (MCP) を実装する Node.js サーバー。
特徴
きめ細かな権限制御(読み取り専用、フルアクセス、または特定の操作権限)
許可されたディレクトリ内での安全なファイル操作
ファイル操作:
ファイルの読み取り/書き込み/変更
ディレクトリの作成/一覧表示/削除
ファイル/ディレクトリを移動する
名前または拡張子でファイルを検索する
ファイルのメタデータを取得する
ディレクトリ操作:
ディレクトリ構造のツリービュー
除外パターンを使用した再帰操作
ユーティリティ関数:
XMLからJSONへの変換
1回の呼び出しで複数のファイル操作
パターンマッチングによる高度なファイル編集
セキュリティ機能:
シンボリックリンク制御
パス検証
サンドボックス化された操作
注意: サーバーは、設定された権限に従って、 argsで指定されたディレクトリ内でのみ操作を許可します。
Related MCP server: MCP Filesystem Server
API
リソース
file://system: ファイルシステム操作インターフェース
ツール
読み取りファイル
ファイルの完全な内容を読み取る
入力:
path(文字列)UTF-8エンコードでファイル内容全体を読み取ります
複数のファイルを読み取る
複数のファイルを同時に読み取る
入力:
paths(文字列[])読み取りに失敗しても操作全体が停止することはない
ファイルの作成
コンテンツを含む新しいファイルを作成する
入力:
path(文字列): ファイルの場所content(文字列): ファイルの内容
ファイルが既に存在する場合は失敗します
create権限が必要です
ファイルの変更
既存のファイルを新しいコンテンツで変更する
入力:
path(文字列): ファイルの場所content(文字列): 新しいファイルの内容
ファイルが存在しない場合は失敗します
edit権限が必要です
編集ファイル
パターンマッチングと書式設定を使用して選択的な編集を行う
特徴:
行ベースおよび複数行のコンテンツマッチング
インデントを保持した空白の正規化
正しい位置で複数の編集を同時に行う
インデントスタイルの検出と保存
コンテキスト付きのGitスタイルのdiff出力
ドライランモードで変更をプレビューする
入力:
path(文字列):編集するファイルedits(配列):編集操作のリストoldText(文字列): 検索するテキスト(完全一致)newText(文字列): 置換するテキスト
dryRun(ブール値): 変更を適用せずにプレビューします (デフォルト: false)
ドライランの詳細な差分を返し、それ以外の場合は変更を適用します
edit権限が必要ですベストプラクティス: 変更をプレビューするには、必ず最初に dryRun を使用してください。
ディレクトリの作成
新しいディレクトリを作成するか、存在することを確認します
入力:
path(文字列)必要に応じて親ディレクトリを作成します
ディレクトリが存在する場合は、何もせずに成功します
create権限が必要です
リストディレクトリ
[FILE]または[DIR]プレフィックスを持つディレクトリの内容を一覧表示します
入力:
path(文字列)ファイルとディレクトリの詳細なリストを返します
ディレクトリツリー
ディレクトリ構造の再帰ツリービューを取得する
入力:
path(文字列)ファイルとディレクトリを含むJSON構造を返します
各エントリには、名前、タイプ、子(ディレクトリの場合)が含まれます。
ファイルの移行
ファイルとディレクトリの移動または名前の変更
入力:
source(文字列): ソースパスdestination(文字列): 宛先パス
宛先が存在する場合は失敗します
ファイルとディレクトリの両方で動作します
move権限が必要です
ファイルを削除
ファイルを削除する
入力:
path(文字列)ファイルが存在しない場合は失敗します
delete権限が必要です
ディレクトリの削除
ディレクトリを削除する
入力:
path(文字列): 削除するディレクトリrecursive(boolean): コンテンツを削除するかどうか (デフォルト: false)
ディレクトリが空でなく、再帰が偽の場合、失敗します
delete権限が必要です
検索ファイル
ファイル/ディレクトリを再帰的に検索する
入力:
path(文字列):開始ディレクトリpattern(文字列): 検索パターンexcludePatterns(string[]): 除外パターン(glob形式をサポート)
大文字と小文字を区別しないマッチング
一致するフルパスを返します
拡張子でファイルを検索する
特定の拡張子を持つすべてのファイルを検索する
入力:
path(文字列):開始ディレクトリextension(文字列):検索するファイル拡張子excludePatterns(string[]): オプションの除外パターン
大文字と小文字を区別しない拡張子のマッチング
一致するファイルへのフルパスを返します
ファイル情報を取得する
詳細なファイル/ディレクトリのメタデータを取得する
入力:
path(文字列)戻り値:
サイズ
作成時間
修正時間
アクセス時間
タイプ(ファイル/ディレクトリ)
権限
権限の取得
現在のサーバー権限を取得する
入力不要
戻り値:
権限フラグ(読み取り専用、フルアクセス、作成、編集、移動、削除)
シンボリックリンクのフォローステータス
許可されるディレクトリの数
許可されたディレクトリの一覧
サーバーがアクセスを許可されているすべてのディレクトリを一覧表示します
入力不要
許可されたディレクトリパスの配列を返します
XMLからJSONへ
XMLファイルをJSON形式に変換する
入力:
xmlPath(文字列): ソースXMLファイルjsonPath(文字列): 宛先JSONファイルoptions(オブジェクト): オプション設定ignoreAttributes(ブール値): XML属性をスキップします(デフォルト: false)preserveOrder(boolean): プロパティの順序を維持する (デフォルト: true)format(ブール値):JSONをきれいに印刷する(デフォルト:true)indentSize(数値): JSONインデント(デフォルト: 2)
XMLファイルの
read権限が必要ですJSONファイルの
createまたはedit権限が必要です
xml_to_json_string
XMLファイルをJSON文字列に変換する
入力:
xmlPath(文字列): ソースXMLファイルoptions(オブジェクト): オプション設定ignoreAttributes(ブール値): XML属性をスキップします(デフォルト: false)preserveOrder(boolean): プロパティの順序を維持する (デフォルト: true)
XMLファイルの
read権限が必要ですJSON文字列表現を返す
xml_クエリ
XPath式を使用してXMLファイルをクエリする
入力:
path(文字列): XMLファイルへのパスquery(文字列、オプション): 実行するXPathクエリstructureOnly(ブール値、オプション):タグ構造のみを返すmaxBytes(数値、オプション):読み取る最大バイト数(デフォルト:1MB)includeAttributes(ブール値、オプション): 属性情報を含める (デフォルト: true)
XPath の例:
すべての要素を取得:
//tagname特定の属性を持つ要素を取得します:
//tagname[@attr="value"]テキストコンテンツを取得:
//tagname/text()
大きなXMLファイルでもメモリ効率が良い
クエリ結果または構造のJSON表現を返します
XML構造
ファイル全体を読み込まずにXML構造を分析
入力:
path(文字列): XMLファイルへのパスdepth(数値、オプション):分析する深さ(デフォルト:2)includeAttributes(ブール値、オプション): 属性分析を含めるmaxBytes(数値、オプション):読み取る最大バイト数(デフォルト:1MB)
要素、属性、構造に関する統計情報を返します
詳細な分析の前に大規模なXMLファイルを理解するのに便利です
権限とセキュリティ
サーバーは、きめ細かな権限制御を備えた包括的なセキュリティ モデルを実装します。
ディレクトリアクセス制御
操作は、起動時に
argsで指定されたディレクトリに厳密に制限されます。すべての操作(シンボリックリンクのターゲットを含む)は許可されたディレクトリ内でのみ実行する必要があります。
パス検証により、ディレクトリトラバーサルや許可されたパス外へのアクセスが防止されます。
権限フラグ
--readonly : 読み取り専用モードを強制し、他のすべての権限フラグを上書きします
--full-access : すべての操作(作成、編集、移動、削除)を有効にします
個別の権限フラグ (--full-access が設定されていない限り、明示的に有効化する必要があります):
--allow-create : 新しいファイルとディレクトリの作成を許可する
--allow-edit : 既存のファイルの変更を許可する
--allow-move : ファイルとディレクトリの移動/名前変更を許可する
--allow-delete : ファイルとディレクトリの削除を許可する
デフォルトの動作:権限フラグが指定されていない場合、サーバーは読み取り専用モードで実行されます。書き込み操作を有効にするには、 --full-accessまたは特定の--allow-*フラグを使用する必要があります。
シンボリックリンクの扱い
デフォルトでは、シンボリックリンクがたどられます(リンクとターゲットの両方が許可されたディレクトリ内にある必要があります)
--no-follow-symlinks : シンボリックリンクの追跡を無効にする(操作はリンク自体に対して行われる)
Claude Desktopとカーソルの使用
claude_desktop_config.json (Claude Desktop の場合) または.cursor/mcp.json (Cursor の場合) に適切な構成を追加します。
カーソルの設定
.cursor/mcp.jsonの場合:
{
"mcpServers": {
"my-filesystem": {
"command": "node",
"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/path/to/allowed/directory",
"--full-access"
]
}
}
}Dockerの設定
Claude Desktop と Docker の場合:
{
"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",
"--readonly", // For read-only access
"--no-follow-symlinks", // Optional: prevent symlink following
"/projects"
]
}
}
}NPX構成
Claude Desktop または NPX 付き Cursor の場合:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"--full-access", // For full read/write access
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}許可フラグの例
さまざまな権限の組み合わせでサーバーを構成できます。
"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/path/to/allowed/directory",
"--readonly" // Read-only mode
]"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/path/to/allowed/directory",
"--full-access", // Full read/write access
"--no-follow-symlinks" // Don't follow symlinks
]"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/path/to/allowed/directory",
"--allow-create", // Selective permissions
"--allow-edit" // Only allow creation and editing
]注意: --readonly他のすべての権限フラグよりも優先され、 --full-access --readonlyが指定されていない限りすべての操作を有効にします。
複数のディレクトリと権限
複数のディレクトリを指定する場合、権限フラグはすべてのディレクトリにグローバルに適用されます。
"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/first/directory", // Both directories have the same
"~/second/directory", // permission settings (read-only)
"--readonly"
]異なるディレクトリに異なる権限レベルが必要な場合は、複数のサーバー構成を作成します。
{
"mcpServers": {
"readonly-filesystem": {
"command": "node",
"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/sensitive/directory",
"--readonly"
]
},
"writeable-filesystem": {
"command": "node",
"args": [
"/path/to/mcp-filesystem/dist/index.js",
"~/sandbox/directory",
"--full-access"
]
}
}
}コマンドラインの例
読み取り専用アクセス:
npx -y @modelcontextprotocol/server-filesystem --readonly /path/to/dirフルアクセス:
npx -y @modelcontextprotocol/server-filesystem --full-access /path/to/dir特定の権限:
npx -y @modelcontextprotocol/server-filesystem --allow-create --allow-edit /path/to/dirシンボリックリンクが続きません:
npx -y @modelcontextprotocol/server-filesystem --full-access --no-follow-symlinks /path/to/dir建てる
Dockerビルド:
docker build -t mcp/filesystem -f src/filesystem/Dockerfile .ライセンス
このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。
Available Tools
21 toolsdirectory_treeA
Get a recursive tree view of files and directories as a JSON structure. Supports depth limiting to control traversal depth and exclusion patterns using glob syntax. 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). Requires maxDepth parameter (default 2) to limit recursion. Use excludePatterns to filter out unwanted files/directories. The output is formatted with 2-space indentation for readability. Only works within allowed directories.
Inputs: maxDepth (required), path (required), excludePatterns.
find_files_by_extensionA
Recursively find all files with a specific extension. Searches through all subdirectories from the starting path. Extension matching is case-insensitive. Returns full paths to all matching files. Requires maxDepth (default 2) and maxResults (default 10) parameters. Perfect for finding all XML, JSON, or other file types in a directory structure. Only searches within allowed directories.
Inputs: extension (required), maxDepth (required), maxResults (required), path (required), +1 more.
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_permissionsA
Returns the current permission state of the server, including which operations are allowed (create, edit, move, delete) and whether the server is in read-only mode or has full access. Use this to understand what operations are permitted before attempting them.
Inputs: no named parameters.
json_filterA
Filter JSON array data using flexible conditions. Supports various comparison operators (equals, greater than, contains, etc.) and can combine multiple conditions with AND/OR logic. Requires maxBytes parameter (default 10KB). Perfect for filtering collections of objects based on their properties. The path must be within allowed directories.
Inputs: conditions (required), maxBytes (required), path (required), arrayPath, +1 more.
json_get_valueA
Get a specific value from a JSON file using a field path. Supports dot notation for accessing nested properties and array indices. Requires maxBytes parameter (default 10KB). Returns the value directly, properly formatted. The path must be within allowed directories.
Inputs: field (required), maxBytes (required), path (required).
json_queryC
Query JSON data using JSONPath expressions. Provides powerful search capabilities for selecting data within JSON structures. Supports standard JSONPath syntax for finding values, arrays, and nested structures. Requires maxBytes parameter (default 10KB). The path must be within allowed directories.
Inputs: maxBytes (required), path (required), query (required).
json_sampleA
Sample JSON data from a JSON file. Requires maxBytes parameter (default 10KB). Returns a random sample of data from the JSON file. The path must be within allowed directories.
Inputs: arrayPath (required), count (required), maxBytes (required), path (required), +1 more.
json_search_kvB
Search for key-value pairs in JSON files within a directory. Requires maxBytes (default 10KB), maxDepth (default 2), and maxResults (default 10) parameters. Returns all key-value pairs that match the search pattern. The path must be within allowed directories.
Inputs: directoryPath (required), key (required), maxBytes (required), maxDepth (required), +4 more.
json_structureA
Get the structure of a JSON file by analyzing its top-level keys and their types. Returns a mapping of key names to their corresponding data types (string, number, array, etc). For arrays, it also indicates the type of the first element if available. This is useful for understanding the shape of large JSON files without loading their entire content. Requires maxBytes (default 10KB) and maxDepth (default 2) parameters. The path must be within allowed directories.
Inputs: maxBytes (required), maxDepth (required), path (required), detailedArrayTypes.
json_transformB
Transform JSON data using a sequence of operations. Supports operations like mapping array elements, grouping by fields, sorting, flattening nested arrays, and picking/omitting fields. Requires maxBytes parameter (default 10KB). Operations are applied in sequence to transform the data structure. The path must be within allowed directories.
Inputs: maxBytes (required), operations (required), path (required).
json_validateA
Validate JSON data against a JSON schema. Requires maxBytes parameter (default 10KB) for the data file. Returns true if the JSON data is valid against the schema, or false if it is not. The path must be within allowed directories.
Inputs: maxBytes (required), path (required), schemaPath (required), allErrors, +1 more.
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).
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. Requires maxBytes parameter. Only works within allowed directories.
Inputs: maxBytes (required), path (required).
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. Requires maxBytesPerFile parameter. Only works within allowed directories.
Inputs: maxBytesPerFile (required), paths (required).
regex_search_contentA
Recursively search file content using a regex pattern. Searches through subdirectories from the starting path. Returns a list of files containing matches, including line numbers and matching lines. Requires regex pattern. Optional: path, filePattern, maxDepth, maxFileSize, maxResults. Only searches within allowed directories.
Inputs: path (required), regex (required), filePattern, maxDepth, +2 more.
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. Requires maxDepth (default 2) and maxResults (default 10) parameters. Great for finding files when you don't know their exact location. Only searches within allowed directories.
Inputs: maxDepth (required), maxResults (required), path (required), pattern (required), +1 more.
xml_queryA
Query XML file using XPath expressions. Provides powerful search capabilities without reading the entire file into memory. Supports standard XPath 1.0 query syntax for finding elements, attributes, and text content. Requires maxBytes parameter (default 10KB). Can be used to extract specific data from large XML files with precise queries. The path must be within allowed directories.
Inputs: maxBytes (required), path (required), includeAttributes, query, +1 more.
xml_structureA
Analyze XML file structure without reading the entire file. Returns statistical information about element counts, attribute usage, namespaces, and hierarchical structure. Useful for understanding the structure of large XML files before performing detailed queries. Requires maxBytes (default 10KB) and maxDepth (default 2) parameters. The path must be within allowed directories.
Inputs: maxBytes (required), maxDepth (required), path (required), includeAttributes.
xml_to_json_stringA
Convert an XML file to a JSON string and return it directly. This is useful for quickly inspecting XML content as JSON without creating a new file. Requires maxBytes parameter (default 10KB). Uses fast-xml-parser for conversion. The input path must be within allowed directories. This tool is fully functional in both readonly and write modes (respecting maxBytes) since it only reads the XML file and returns the parsed data.
Inputs: maxBytes (required), xmlPath (required), options.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
The tool set has clear functional groupings (filesystem navigation, JSON operations, XML operations, file reading/searching), but there is some overlap within groups. For example, directory_tree, list_directory, and search_files all provide directory listings with different formats and search capabilities, which could cause confusion. Similarly, json_query, json_filter, and json_search_kv offer overlapping JSON querying functionalities. Descriptions help differentiate, but an agent might struggle to choose the optimal tool for a given task.
Tool names follow a highly consistent snake_case pattern with clear verb_noun or noun_verb structures (e.g., directory_tree, find_files_by_extension, get_file_info). All tools adhere to this convention, making them predictable and easy to parse. There are no deviations in naming style, which enhances coherence across the set.
With 21 tools, this server feels overloaded for a filesystem domain. Many tools offer similar or overlapping functionalities (e.g., multiple JSON query tools, multiple directory listing tools), suggesting redundancy. A more streamlined set of 10-15 tools could cover the same scope without overwhelming agents, making the current count excessive and potentially confusing.
The server provides comprehensive coverage for filesystem operations, including navigation, metadata retrieval, content reading, and search (both file and content-based). It also includes specialized tools for JSON and XML processing. However, there are minor gaps: no tools for creating, editing, moving, or deleting files/directories (implied by get_permissions indicating possible write modes), which limits full lifecycle management. The allowed directories and permissions tools help agents work around this, but the surface is not fully complete for write operations.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseAqualityBmaintenanceNode.js server implementing Model Context Protocol (MCP) for filesystem operations.70141,222,611 npm92,139-
- AlicenseAqualityDmaintenanceA secure Model Context Protocol server that provides controlled filesystem access within predefined directories, enabling AI models to perform file and directory operations with strict path validation.1695 npm7MIT
- AlicenseNot gradedqualityCmaintenanceNode.js server implementing Model Context Protocol for secure read-only filesystem operations, allowing Claude to read files, list directories, search files, and get file metadata within specified directories.6MIT
- -licenseNot gradedqualityNot gradedmaintenanceNode.js server implementing Model Context Protocol (MCP) for filesystem operations, allowing AI systems to read, write, edit files and manage directories within specified allowed paths.1,222,611 npm-