mcp-file-tools
MCP server for file operations with non-UTF-8/Unicode encoding: Cyrillic, CP1251, CP1252, ISO-8859, KOI8 auto-detection
README
MCP File Tools
Non-UTF-8 file encoding server: Cyrillic (CP1251, KOI8), Windows-1250-1258, ISO-8859 with auto-detection and Unicode conversion. Lets AI assistants read and write files in legacy encodings that would otherwise corrupt data.
Perfect for: Delphi/Pascal projects, legacy VB6 apps, old PHP/HTML sites, config files with non-UTF-8 text.
What It Does
Provides 19 tools for file operations with automatic encoding conversion:
read_text_file- Read files with encoding auto-detection and conversionread_multiple_files- Read multiple files concurrently with encoding supportwrite_file- Write files in specific encodingsedit_file- Line-based edits with diff preview and whitespace-flexible matchingcopy_file- Copy a file to a new locationdelete_file- Delete a filelist_directory- Browse directories with pattern filteringtree- Compact indented tree view (85% fewer tokens than JSON)directory_tree- Get recursive tree view as JSON (deprecated, usetree)search_files- Recursively search for files matching glob patternsgrep_text_files- Regex search in file contents with encoding supportdetect_encoding- Auto-detect file encoding with confidence scoreconvert_encoding- Convert file between encodingsdetect_line_endings- Detect line ending style (CRLF/LF/mixed)list_encodings- Show all supported encodingsget_file_info- Get file/directory metadatacreate_directory- Create directories recursively (mkdir -p)move_file- Move or rename files and directorieslist_allowed_directories- Show accessible directories
Supported encodings (22 total):
- Unicode: UTF-8, UTF-16 LE, UTF-16 BE (with BOM detection for UTF-16 and UTF-32)
- Cyrillic: Windows-1251, KOI8-R, KOI8-U, CP866, ISO-8859-5
- Western European: Windows-1252, ISO-8859-1, ISO-8859-15
- Central European: Windows-1250, ISO-8859-2
- Greek: Windows-1253, ISO-8859-7
- Turkish: Windows-1254, ISO-8859-9
- Other: Hebrew (1255), Arabic (1256), Baltic (1257), Vietnamese (1258), Thai (874)
See TOOLS.md for detailed parameters and examples.
Security: All operations restricted to allowed directories only.
Installation
MCP Registry
This server is listed in the Official MCP Registry for discovery.
Windows x64
# Download
mkdir -Force "$env:LOCALAPPDATA\Programs\mcp-file-tools"
iwr "https://github.com/dimitar-grigorov/mcp-file-tools/releases/latest/download/mcp-file-tools_windows_amd64.exe" -OutFile "$env:LOCALAPPDATA\Programs\mcp-file-tools\mcp-file-tools.exe"
# Install with Claude Code
claude mcp add file-tools "$env:LOCALAPPDATA\Programs\mcp-file-tools\mcp-file-tools.exe"
Linux x64
# Download
mkdir -p ~/.local/bin
curl -L "https://github.com/dimitar-grigorov/mcp-file-tools/releases/latest/download/mcp-file-tools_linux_amd64" -o ~/.local/bin/mcp-file-tools
chmod +x ~/.local/bin/mcp-file-tools
# Install with Claude Code
claude mcp add file-tools ~/.local/bin/mcp-file-tools
macOS ARM64
# Download
mkdir -p ~/.local/bin
curl -L "https://github.com/dimitar-grigorov/mcp-file-tools/releases/latest/download/mcp-file-tools_darwin_arm64" -o ~/.local/bin/mcp-file-tools
chmod +x ~/.local/bin/mcp-file-tools
# Install with Claude Code
claude mcp add file-tools ~/.local/bin/mcp-file-tools
Go Install (All Platforms)
# Install with Go (requires Go 1.23+)
go install github.com/dimitar-grigorov/mcp-file-tools/cmd/mcp-file-tools@latest
# Add to Claude Code (Linux/macOS)
claude mcp add file-tools $(go env GOPATH)/bin/mcp-file-tools
# Add to Claude Code (Windows PowerShell)
claude mcp add file-tools "$(go env GOPATH)\bin\mcp-file-tools.exe"
Other Clients
For Claude Desktop, VSCode, or Cursor, use the downloaded binary path in your config:
Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"file-tools": {
"command": "/path/to/mcp-file-tools"
}
}
}
VSCode / Cursor - Two options:
Option 1: Global config (recommended) - Available in all projects
CLI command (easiest):
claude mcp add --scope user file-tools -- "%LOCALAPPDATA%\Programs\mcp-file-tools\mcp-file-tools.exe" "D:\Projects"
Or manually edit %USERPROFILE%\.claude.json:
{
"mcpServers": {
"file-tools": {
"type": "stdio",
"command": "C:\\Users\\YOUR_NAME\\AppData\\Local\\Programs\\mcp-file-tools\\mcp-file-tools.exe",
"args": ["D:\\Projects"]
}
}
}
Option 2: Per-project config - Create .mcp.json in project root:
{
"mcpServers": {
"file-tools": {
"type": "stdio",
"command": "C:\\Users\\YOUR_NAME\\AppData\\Local\\Programs\\mcp-file-tools\\mcp-file-tools.exe",
"args": ["D:\\Projects", "D:\\Other\\Directory"]
}
}
}
Note: The type: "stdio" field is required. The args array specifies allowed directories - the VSCode extension does not automatically add the workspace directory, so you must list all directories you want to access.
How to Use
Once installed, just ask Claude:
- "List all .pas files in this directory"
- "Read config.ini and detect its encoding"
- "Show all supported encodings"
- "Read MainForm.dfm using CP1251 encoding"
Security: The server only accesses directories you explicitly allow:
- Automatic: Claude Desktop/Code provide workspace directories automatically
- Manual: Specify directories in config
args: ["/path/to/project"]
Configuration
The server can be configured via environment variables:
| Variable | Description | Default |
|---|---|---|
MCP_DEFAULT_ENCODING |
Default encoding for write_file when none specified |
cp1251 |
MCP_MEMORY_THRESHOLD |
Memory threshold in bytes. Files smaller are loaded into memory for faster I/O; larger files use streaming. Also affects encoding detection mode. | 67108864 (64MB) |
Example (Claude Desktop config):
{
"mcpServers": {
"file-tools": {
"command": "/path/to/mcp-file-tools",
"env": {
"MCP_DEFAULT_ENCODING": "utf-8"
}
}
}
}
Use Cases
Legacy Codebases
Many legacy projects use non-UTF-8 encodings that AI assistants can't handle natively:
- Delphi/Pascal (Windows-1251): Source files with Cyrillic UI text
- Visual Basic 6 (Windows-1252): Forms and config files with Western European characters
- Legacy PHP/HTML (CP1251, ISO-8859-1): Web apps with localized content
- Old config files (Various): INI, properties, registry files with legacy encodings
How it works:
User: Read config.ini and change the title to "Настройки"
Assistant: [read_text_file with cp1251] → [modify UTF-8] → [write_file with cp1251]
The original encoding is preserved - files remain compatible with legacy tools.
Development
Prerequisites: Go 1.23+
# Run tests
go test ./...
# Build
go build -o mcp-file-tools ./cmd/mcp-file-tools
Debugging with MCP Inspector
MCP Inspector provides a web UI for testing MCP servers.
Prerequisites: Node.js v18+
# Run with allowed directory (required)
npx @modelcontextprotocol/inspector go run ./cmd/mcp-file-tools -- /path/to/allowed/dir
# Or with built binary
npx @modelcontextprotocol/inspector ./mcp-file-tools.exe C:\Projects
Opens a browser where you can view tools, call them with custom arguments, and inspect responses.
Manual Debugging
Run the server with an allowed directory and send JSON-RPC commands via stdin:
# Specify allowed directory
go run ./cmd/mcp-file-tools /path/to/project
Example commands (paste into terminal):
{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_directory","arguments":{"path":"/path/to/project","pattern":"*.go"}}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"read_text_file","arguments":{"path":"/path/to/project/main.pas","encoding":"cp1251"}}}
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"detect_encoding","arguments":{"path":"/path/to/project/file.txt"}}}
License
GPL-3.0 - see LICENSE
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。