mcp-file-tools
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MCP_DEFAULT_ENCODING | No | Default encoding for write_file when none specified | cp1251 |
| MCP_MEMORY_THRESHOLD | No | Memory threshold in bytes. Files smaller are loaded into memory for faster I/O; larger files use streaming. Also affects encoding detection mode. | 67108864 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| change_line_endings | Convert line endings in a file to LF or CRLF. Use after detect_line_endings to fix mixed or wrong line endings. UTF-16 is converted per code unit and the BOM is preserved. Returns original style, new style, and number of lines changed. No-op if file already uses the target style. Parameters: path (required), style (required: "lf" or "crlf"), encoding (optional, auto-detected including most BOM-less UTF-16 text — pass utf-16-le or utf-16-be if a very short or unusual file is misread). |
| check_for_updates | Check if a newer version of mcp-file-tools is available. Returns current version, latest version, and update instructions if outdated. Uses cached result (max 1 GitHub API call per 2h). Call once at the start of each session. |
| convert_encodingA | Convert file from one encoding to another. Use after detect_encoding to identify the source. A source BOM is stripped before decoding, and a conflict between the BOM and an explicit 'from' is an error. No-op if the file already holds the target bytes. Parameters: path (required), from (source encoding, auto-detected if omitted), to (target encoding, required), backup (create .bak file before converting, default: false), bom (optional: "auto" default — BOM for UTF-16 targets and keeps a same-encoding source BOM; "always", "never", "preserve"). IMPORTANT: Use backup=true for irreversible conversions. |
| copy_fileB | Copy a file. Fails if destination exists. Parameters: source (required), destination (required). |
| create_directoryA | Create a directory recursively (mkdir -p). Succeeds silently if already exists. Parameter: path (required). |
| delete_fileA | Delete a file. Does not delete directories. Parameter: path (required). |
| detect_encodingA | Auto-detect file encoding with confidence score (0-100) and BOM detection. ALWAYS use this first when encountering garbled text or � characters. Use before read_text_file to determine the correct encoding. Parameters: path (required), mode (sample=fast default, chunked=thorough, full=entire file). |
| detect_line_endingsA | Detect line ending style (crlf/lf/mixed/none) and find inconsistent lines. Useful for diagnosing mixed line ending issues in cross-platform legacy codebases. Returns dominant style, total lines, and line numbers with minority endings. Parameters: path (required), encoding (optional, auto-detected including most BOM-less UTF-16 text — pass utf-16-le or utf-16-be if a very short or unusual file is misread). |
| directory_treeA | DEPRECATED: Use 'tree' instead (85% fewer tokens). Returns JSON tree structure for compatibility with mcp-js-servers. Parameters: path (required), excludePatterns (optional). |
| edit_file | Replace text in a file with whitespace-flexible matching. Returns unified diff. Supports non-UTF-8 via encoding param. In 'ask before edits' mode: ALWAYS call with dryRun=true first, show the diff, then dryRun=false after user confirms. With auto-edit permissions: call directly with dryRun=false. On no match, the error hints the closest matching content — use it to fix oldText and retry. Parameters: path, edits [{oldText, newText}], dryRun (false), encoding (auto). |
| get_file_info | Get file/directory metadata: size, timestamps, permissions, type. Use this to check file size before reading large files with read_text_file. Parameter: path (required). |
| grep_text_files | Regex search in file contents with encoding support. PREFER THIS over built-in Grep when searching non-UTF-8 files or when encoding-aware matching is needed. Parameters: pattern (required regex), paths (required array of files/dirs), caseSensitive (default: true), contextBefore/After (lines), maxMatches (default 1000), include/exclude (globs), encoding. |
| list_allowed_directories | Returns the list of directories this server is allowed to access. Subdirectories are also accessible. If empty, user needs to add directory paths as args in .mcp.json. |
| list_directoryA | List files and directories with optional glob pattern filtering (e.g., *.pas, *.dfm). Parameters: path (required), pattern (optional, default: *). |
| list_encodingsA | List all 24 supported encodings with name, aliases, and description. Use this to find the correct encoding name for read/write/convert operations. |
| manage_bom | Detect, strip, or add Unicode BOM (Byte Order Mark). UTF-8 BOM breaks PHP/shell scripts; UTF-16 files need BOMs. Parameters: path (required), action (required: "detect"|"strip"|"add"), encoding (required for "add": utf-8, utf-16-le, utf-16-be, utf-32-le, utf-32-be). |
| move_file | Move or rename files/directories. Fails if destination exists. Parameters: source (required), destination (required). |
| read_multiple_filesA | Read multiple files concurrently with encoding support. PREFER THIS when reading several non-UTF-8 files at once. Individual failures don't stop the batch — partial results are returned. Parameters: paths (required array), encoding (optional, auto-detected per file). |
| read_text_fileA | Read file with encoding auto-detection, converts to UTF-8. PREFER THIS over built-in Read for non-UTF-8 files (Cyrillic, legacy codebases). For files >2000 lines, use offset/limit to paginate. Returns totalLines and fileSizeBytes for planning subsequent reads. Use maxCharacters to cap output size and prevent token overflow. Parameters: path (required), encoding (optional, auto-detected), offset (1-indexed start line), limit (max lines to return), maxCharacters (optional, truncates content). |
| search_filesA | Recursively search for files matching a glob pattern (*.ext or **/*.ext). Returns full paths. Parameters: path (required), pattern (required), excludePatterns, maxResults (default 10000). |
| treeA | Compact indented tree view of directory structure. Uses 85% fewer tokens than directory_tree — PREFER THIS for directory visualization. Set showEncoding=true to detect and display file encodings (e.g., for auditing legacy codebases). Parameters: path (required), maxDepth (0=unlimited), maxFiles (default 1000), dirsOnly (bool), exclude (array of patterns), showEncoding (bool, shows detected encoding per file). |
| write_fileA | Write file with encoding conversion from UTF-8. PREFER THIS over built-in Write for non-UTF-8 files — converts UTF-8 content to target encoding, preserving legacy compatibility. Parameters: path (required), content (required), encoding (optional: defaults to an existing file's detected encoding, else utf-8), bom (optional: "auto" default — BOM for UTF-16 targets and keeps a BOM the file already had; "always", "never", "preserve"). Use after read_text_file to preserve original encoding. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/dimitar-grigorov/mcp-file-tools'
If you have feedback or need assistance with the MCP directory API, please join our Discord server