mcp-server-filesystem-ro

v0.1.2
@adpharm/mcp-server-filesystem-ro Checked 2 days ago Published 6 months ago

Read-only MCP server for filesystem access (fork of @modelcontextprotocol/server-filesystem)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

read_file Read File (Deprecated)

Read the complete contents of a file as text. DEPRECATED: Use read_text_file instead.

ParameterTypeDescription
path *string
headnumberIf provided, returns only the first N lines of the file
tailnumberIf provided, returns only the last N lines of the file

read_text_file Read Text File

Read the complete contents of a file from the file system as text. 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. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.

ParameterTypeDescription
path *string
headnumberIf provided, returns only the first N lines of the file
tailnumberIf provided, returns only the last N lines of the file

read_media_file Read Media File

Read an image or audio file. Returns the base64 encoded data and MIME type. Only works within allowed directories.

ParameterTypeDescription
path *string

read_multiple_files Read Multiple Files

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.

ParameterTypeDescription
paths *arrayArray of file paths to read. Each path must be a string pointing to a valid file within allowed directories.

list_directory List Directory

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.

ParameterTypeDescription
path *string

list_directory_with_sizes List Directory with Sizes

Get a detailed listing of all files and directories in a specified path, including sizes. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is useful for understanding directory structure and finding specific files within a directory. Only works within allowed directories.

ParameterTypeDescription
path *string
sortBystringSort entries by name or size

directory_tree Directory Tree

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.

ParameterTypeDescription
path *string
excludePatternsarray

search_files Search Files

Recursively search for files and directories matching a pattern. The patterns should be glob-style patterns that match paths relative to the working directory. Use pattern like '*.ext' to match files in current directory, and '**/*.ext' to match files in all subdirectories. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.

ParameterTypeDescription
path *string
pattern *string
excludePatternsarray

get_file_info Get File Info

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.

ParameterTypeDescription
path *string

list_allowed_directories List Allowed Directories

Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested paths are available before trying to access files.