Skip to main content
Glama

Filesystem MCP Server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
list_allowed_directories

List all allowed directory roots for filesystem operations.

Returns: List[str]: Absolute paths of directories the server can read/write

create_file

Create a new file with specified content.

Args: path (str): File path to create (absolute or relative to allowed directories) content (str): UTF-8 text content to write to the file

Returns: str: Success message with created file path, or error message if failed

Note: - Fails if the file already exists - Creates parent directories if they don't exist - Path must be within allowed directory roots

delete_file

Delete a file from the filesystem.

Args: path (str): File path to delete (absolute or relative to allowed directories)

Returns: str: Success message with deleted file path, or error message if failed

Note: - Path must be within allowed directory roots - Fails if file doesn't exist or cannot be deleted

move_file

Move or rename a file from source to destination.

Args: src (str): Source file path (absolute or relative to allowed directories) dst (str): Destination file path (absolute or relative to allowed directories)

Returns: str: Success message with source and destination paths, or error message if failed

Note: - Both paths must be within allowed directory roots - Fails if destination already exists - Creates parent directories for destination if needed

read_text_file

Read the contents of a UTF-8 text file, optionally within a line range.

Args: path (str): File path to read (absolute or relative to allowed directories) fromLine (int, optional): Starting line number (1-indexed, inclusive) toLine (int, optional): Ending line number (1-indexed, inclusive)

Returns: str: File contents as text, or error message if failed

Note: - Path must be within allowed directory roots - Only reads UTF-8 text files (binary files will return error) - If line range specified, returns only those lines - Line numbers are 1-indexed

directory_tree

Generate a recursive JSON tree structure of a directory.

Args: path (str): Directory path to generate tree for (absolute or relative to allowed directories)

Returns: str: JSON representation of directory tree with 2-space indentation, or error message if failed

Note: - Path must be within allowed directory roots - Returns nested structure with 'name', 'type', and 'children' fields - Types are either 'directory' or 'file' - Directories include 'children' array, files do not

create_directory

Create a directory, including any necessary parent directories.

Args: path (str): Directory path to create (absolute or relative to allowed directories)

Returns: str: Success message with created directory path, or error message if failed

Note: - Path must be within allowed directory roots - Creates parent directories if they don't exist - No error if directory already exists

list_directory

List the contents of a directory with type annotations.

Args: path (str): Directory path to list (absolute or relative to allowed directories)

Returns: str: Newline-separated list of entries with '[DIR]' or '[FILE]' prefixes, or error message if failed

Note: - Path must be within allowed directory roots - Fails if path is not a directory - Entries are sorted alphabetically - Format: '[DIR] dirname' or '[FILE] filename'

read_multiple_files

Read multiple UTF-8 text files at once and return a mapping of paths to contents.

Args: paths (List[str]): List of file paths to read (absolute or relative to allowed directories)

Returns: Dict[str, str] | str: Dictionary mapping absolute file paths to their contents, or error message if any file fails

Note: - All paths must be within allowed directory roots - All files must be UTF-8 text files - If any file fails to read, entire operation returns error string - Returns dictionary for successful reads, string for errors

search_files

Search for files by name pattern in a directory recursively.

Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Glob-style pattern to match file names (e.g., '.py', 'test_') exclude (str, optional): Glob-style pattern to exclude file names

Returns: List[str] | str: List of matching absolute file paths, or error message if failed

Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Respects .gitignore files, and ignores hidden files and folders - Returns list for successful searches, string for errors

grep

Search for text patterns inside files using regular expressions.

Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Regular expression pattern to search for in file contents exclude (str, optional): File pattern to exclude from search

Returns: str: Newline-separated matches in format 'path: line', or error message if failed

Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Only searches UTF-8 text files - Respects .gitignore files and skips common lock files - Each match shows file path, line number, and the matching line - Uses Python regular expression syntax

edit_file

Apply multiple text replacements to a file and return a unified diff.

Args: path (str): File path to edit (absolute or relative to allowed directories) edits (List[Dict[str, str]]): List of edit operations, each with 'oldText' and 'newText' keys

Returns: str: Unified diff showing changes made, or error message if failed

Note: - Path must be within allowed directory roots - File must be a UTF-8 text file - Edits are applied sequentially in the order provided - Each 'oldText' must match exactly (first occurrence is replaced) - Returns unified diff format showing before/after changes - File is atomically updated using temporary file - If no changes made, returns 'No changes made.'

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Preston-Harrison/fs-mcp-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server