
MCP服务器用于非UTF-8文本的文件操作:从字节中检测编码,递交模型UTF-8,并以BOM和CRLF/LF完整写回原始编码。
概览
克洛德看到的是Настройки——而不是????或者Íàñòðîêè。 MCP服务器用于非UTF-8文本的文件操作。它通过文件的字节而非扩展名检测编码,交出模型UTF-8,并以原始编码写回——BOM和CRLF/LF完整,仍与拥有该文件的遗留工具兼容字节。 - — 西里尔字母(CP1251,KOI8-R/U,CP866/855),Windows-125x,ISO-8859-x,DOS代码页,MacRoman,UTF-16/UTF-32,CJK(GBK,Big5,Shift_JIS,EUC-JP/KR)(完整列表)—— edit_file、grep_text_files和search_files解码方式相同,而不仅仅是读写—— ——detect_encoding报告字符集、置信度评分和任何物料清单,因此杂乱文本可被诊断——包括UTF-16,在该项目中,简单的字节级重写会损坏文件——所有包含的路径、符号链接和连接目标都会与你允许的目录进行核对 Delphi/Pascal 单元,带有西里尔字母的 UI 文本,VB6 表单,带有本地化内容的遗留 PHP/HTML,以及 INI 或数据文件,这些文件......
概述(AI 翻译)
克劳德看到的是Настройки——而不是????或Íàñòðîéêè。
MCP服务器用于非UTF-8文本的文件操作。它检测来自 文件的字节而非扩展名,将模型 UTF-8 传递给 原始编码——BOM和CRLF/LF保持完整,仍与任何遗留系统兼容字节 工具拥有文件。
- 45 编码,读写 — 西里尔字母(CP1251,KOI8-R/U,CP866/855),Windows-125x,ISO-8859-x,DOS 代码页,MacRoman,UTF-16/UTF-32,CJK(GBK,Big5,Shift_JIS,EUC-JP/KR)(完整列表)
- 在整个工具集中实现编码感知 —
edit_file、grep_text_files和search_files解码方式相同,而不仅仅是读写 - 你可以检查的检测 —
detect_encoding报告字符集、置信度评分和任何物料清单,因此杂乱的文本变得可诊断 - BOM和行尾是一类的——包括UTF-16,在那种情况下,简单的字节级重写会导致文件损坏
- 沙盒化 — 所有路径、符号链接和交汇目标都会与你允许的目录进行核对
** 构建对象:** 带西里尔字母 UI 文本的 Delphi/Pascal 单元,VB6 表单,以及带有
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP File Tools
Claude sees Настройки — not ???? or Íàñòðîéêè.
MCP server for file operations on text that isn’t UTF-8. It detects the encoding from the file’s bytes rather than its extension, hands the model UTF-8, and writes back in the original encoding — BOM and CRLF/LF intact, still byte-compatible with whatever legacy tool owns the file.
- 45 encodings, read and write — Cyrillic (CP1251, KOI8-R/U, CP866/855), Windows-125x, ISO-8859-x, DOS code pages, MacRoman, UTF-16/UTF-32, CJK (GBK, Big5, Shift_JIS, EUC-JP/KR) (full list)
- Encoding-aware across the whole tool set —
edit_file,grep_text_filesandsearch_filesdecode the same way, not just read and write - Detection you can inspect —
detect_encodingreports the charset, a confidence score and any BOM, so garbled text becomes diagnosable - BOM and line endings are first-class — including on UTF-16, where a naive byte-level rewrite corrupts the file
- Sandboxed — every path, symlink and junction targets included, is checked against the directories you allowed
Built for: Delphi/Pascal units with Cyrillic UI text, VB6 forms, legacy PHP/HTML with localized content, and INI or data files whose encoding you can’t tell from the filename.
User: Read config.ini and change the title to "Настройки"
Claude: [read_text_file → cp1251 detected] → [edits UTF-8] → [write_file → back to cp1251]
PRs welcome and merged fast — no CLA, no style review, one-line fixes count. Forked this to fix something? Please send it back instead.
Installation
Claude Code plugin (recommended)
claude plugin marketplace add dimitar-grigorov/mcp-file-tools
claude plugin install mcp-file-tools
Inside a session: /plugin marketplace add … and /plugin install ….
Requires Node.js 18+ on your PATH. The launcher is a Node script
安装
npx @modelcontextprotocol/inspector go run ./cmd/mcp-file-tools -- /path/to/allowed/dir配置
{
"mcpServers": {
"file-tools": {
"command": "C:\\Users\\YOUR_NAME\\AppData\\Local\\Programs\\mcp-file-tools\\mcp-file-tools.exe",
"args": ["D:\\Projects", "C:\\Users\\YOUR_NAME\\Documents"]
}
}
}