
MCP File Tools
io.github.dimitar-grigorov由 GitHub 帳號 dimitar-grigorov 發布v4.6.2更新於 Oct 31, 2026
Non-UTF-8 files: CP1251, CP1252, KOI8, ISO-8859, UTF-16, GBK auto-detected and preserved
概覽
本機 MCP 伺服器,用來讀取、編輯與寫入非 UTF-8 編碼的文字檔,依位元組偵測編碼並在寫回時保留原編碼。
- 可以做什麼
- 讀取檔案並自動偵測編碼,可一次讀取多個檔案,並查看偵測到的字元集、信心分數與 BOM
- 以指定編碼寫入與編輯檔案,支援以行為單位的編輯與差異預覽,以及複製、移動、重新命名與刪除檔案
- 瀏覽與搜尋檔案系統:列出目錄、顯示樹狀結構、依萬用字元尋找檔案、以正規表示式搜尋檔案內容
- 轉換編碼、管理換行字元與 BOM,並列出支援的編碼
- 查看檔案中繼資料、建立目錄,並列出伺服器可存取的目錄
- 適用情境
- 適合需要處理非 UTF-8 的舊式或在地化文字檔,例如 Delphi/Pascal 單元、VB6 表單、舊版 PHP 或 HTML 頁面,以及無法從檔名判斷編碼的 INI 或資料檔,且編輯後須保持位元組相容。
- 執行需求
- 以本機程序方式在桌面執行。外掛啟動器需要 PATH 中有 Node.js 18+;手動安裝需下載對應平台的二進位檔,或使用 Go 1.27+ 從原始碼建置。可存取的目錄以參數傳入或由 MCP_FILE_TOOLS_ALLOWED_DIRS 設定。未宣告需要帳號或 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 MCP File Tools,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP File Tools
[Release] [Downloads] [Test] [OpenSSF Scorecard] [License: GPL-3.0] [MCP Registry] [Glama score]
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.
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)
Inside a session: /plugin marketplace add … and /plugin install ….
Requires Node.js 18+ on your PATH. The launcher is a Node script
and Claude Code does not bundle Node; without it /mcp shows the server as not connected.
First launch downloads the binary for your OS at a pinned version, verifies its SHA-256 and caches it. It is scoped to the folder you have open, so there is nothing to configure. For directories outside the workspace, or a machine without Node, use a manual install.
Coming from a manual install
Tool names change too: mcp__file-tools__* becomes
mcp__plugin_mcp-file-tools_file-tools__*, so update your permission rules, see
Auto-approve tools.
Updating the plugin
Use the full plugin@marketplace id, not the bare name, or turn on auto-update in
/plugin → Marketplaces.
Registries and directories
This server is listed in the Official MCP Registry for discovery by any MCP client, and indexed on Glama, which scores it A for license, quality and maintenance.
Manual install (other MCP clients, or access outside your workspace)
Download the binary for your platform, then register it with the directories it may access.
Windows (PowerShell, not CMD):
Linux / macOS (swap the asset name from the table for your platform):
Go install (all platforms)
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):
Windows:
macOS / Linux:
args lists the directories the server may access — as many as you need.
VSCode / Cursor (Claude Code extension)
If you already ran claude mcp add --scope user from the installation steps above, the server is already available in VSCode — no extra config needed.
To configure separately for VSCode only:
Alternatively, create a per-project config by adding .mcp.json to your project root:
Note: type: "stdio" is required here. The VSCode extension does not add the workspace
directory by itself, so args must list every directory you want reachable. Adding one
later means re-running claude mcp add with the full list — it overwrites the previous
config rather than appending.
OpenAI Codex CLI
Codex takes a direct MCP command, so no manual TOML editing is needed.
Windows (PowerShell):
Run codex mcp list to verify it, then start a new Codex session. Add more directory
arguments to grant access outside the current project.
Auto-approve tools (Claude Code)
To skip the permission prompts, add to .claude/settings.local.json in your project root:
That prefix is the plugin install; a manual one registered as file-tools is
mcp__file-tools__* instead, and a rule with the wrong prefix matches nothing and fails
quietly. Which modes the rules affect, and keeping delete_file / move_file behind a
prompt, are in docs/extra.md.
Update
The server checks for updates automatically and notifies you through tool responses when a newer version is available; the notice carries the steps for your install. Plugin installs update through Updating the plugin — a re-downloaded binary is ignored there.
For a manual install, re-download the binary over the existing one — the registration does not need repeating:
- Close all Claude Code sessions (the binary is locked while running)
- Re-download:
To disable update checks, set the environment variable MCP_NO_UPDATE_CHECK=1.
Verify & Uninstall
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 reaches only the directories you allowed. It takes them from
args: ["/path/to/project"] first, then MCP_FILE_TOOLS_ALLOWED_DIRS, and failing both
from the directory it was started in — the workspace, when a client launches it there.
Clients that still speak the MCP roots protocol add their roots on top. A drive root or
your home directory is never granted by that last fallback; name it explicitly instead.
Paths are resolved before the check, so a symlink or Windows junction pointing outside is
rejected rather than followed.
Tools
20 tools — every one that touches text content is encoding-aware:
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, optionally annotated with each file's encodingsearch_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 encodingsmanage_line_endings- Detect or convert line endings (CRLF/LF/mixed)manage_bom- Detect, strip, or add Unicode BOMlist_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 directoriescheck_for_updates- Check whether a newer release is available
Plus three prompts — audit_encodings, fix_mojibake,
migrate_to_utf8 — surfaced by clients as user commands.
See TOOLS.md for detailed parameters and examples. Calls shaped like Claude Code's built-in Read/Write/Edit/Grep are accepted too — the alias layer translates them where the semantics match exactly, so a model's habits don't fail the call.
Out of scope: binary/media reading (read_media_file). This is a text
tool; agents read images with their built-in tools.
Supported encodings
Every one below reads and writes. Name one explicitly via the encoding parameter, or
leave it to auto-detection.
Common aliases are accepted (cp1251, latin1, gb2312, tis-620, …) —
list_encodings prints the whole table with aliases.
Auto-detection never guesses MacRoman, the DOS pages or the rarer ISO tables; name them explicitly. UTF-32 is found only by its BOM.
Configuration
The server can be configured via environment variables:
Set them with an env block in your config (Claude Desktop example):
Pinning the encodings
Detection is a guess, and guesses have blind spots: Spanish CP1252 like MÓDULO FÍSICAMENTE ÚNICO is plausible GBK — every uppercase accent before an ASCII letter is a
valid hanzi pair — so it reads back as Chinese and edits fail with "gbk cannot represent
2 characters". If you know what the repo contains, say so:
A BOM still wins. A guess inside the list keeps its confidence; one outside it is dropped
and the listed encoding that reads most like text takes over, list order breaking ties. A
file that fits none of them is read as the default and reported as an ODD ENCODING
in read_text_file's hint, so a stray file gets said out loud rather than
guessed at. Unlisted encodings stop appearing in detect_encoding's candidates too. UTF-16/32 are named only by a BOM
or the structural classifier, so listing them cannot make them a catch-all.
Legacy teams (pre-2.0.0 behaviour)
Before 2.0.0 new files defaulted to cp1251; they now default to utf-8. Existing files
are unaffected — their encoding is detected and preserved — so this only matters if your
team creates new non-UTF-8 files, e.g. new Delphi units with Cyrillic literals. To keep
the old behaviour:
Commit that in the legacy repo's .mcp.json rather than setting it per machine, and
everyone working in that repo gets the right default with no local setup.
Delphi 2007 and older read UTF-8 only when it carries a BOM, so a UTF-8 file without one
is silently treated as ANSI. Set cp1251 (or your own ANSI code page) for such a repo and
new Cyrillic literals land in the encoding the IDE expects. Files that already exist keep
their own encoding either way, and no tool adds a BOM to them.
Development
Prerequisites: Go 1.27+
scripts/smoke-test starts the server over stdio and calls the read-only tools, run by CI on each push:
Debugging
MCP Inspector gives a web UI for calling tools and inspecting responses (needs Node.js 18+):
Or pipe JSON-RPC straight to stdin:
Contributing
If it fits the scope and works, it gets merged. Don't ask first — just send the PR.
No CLA, no style review: make test and make lint passing is enough, and tests are
welcome but never required. One-line fixes and half-finished features behind a flag both
count. Out of scope, or breaking a tool contract other people's agents rely on, gets a
comment rather than a close. Not writing the fix yourself?
Open an issue with the file,
its encoding, and what the tool did.
Details in CONTRIBUTING.md. Found a way out of an allowed directory? That one goes to SECURITY.md, privately, not to an issue.
Forking
Forks are welcome; that is what GPL-3.0 is for. If you distribute one (a public repo, a release binary, a registry listing, a product), the license asks you to:
- Keep GPL-3.0, LICENSE and the copyright notices (§4, §5c)
- Say what you changed and when (§5a)
- Give the source to everyone who gets the binary (§6)
Removing the license or the notice, relicensing, or shipping only a binary breaks the license and ends the rights it grants (§8). Unsure whether what you ship complies? Ask in an issue.
Beyond that, please keep a line such as "Fork of mcp-file-tools" so readers know where it came from, and give your fork its own name, so its bugs don't land here. Fixed something? A PR saves you the merge conflicts and puts your name on the commit.
Credits
Ideas that started in someone else's fork and were reimplemented here:
- @skyispainted - GBK/GB18030, JSON-string array args,
edit_fileretry hint - @haobiao - GBK/GB18030, independently
- Hugo Rosário - merging MCP roots with CLI allowed dirs
- @zoster81 - UTF-16 line endings and grep, path containment fixes, write durability, BOM policy, ordered concurrency
- Mario Rial - pinning detection to known encodings, multi-pattern grep
A PR gets your name on the commit instead of this list.
License
GPL-3.0 - see LICENSE
Copyright (C) 2026 Dimitar Grigorov. Free software, distributed WITHOUT ANY WARRANTY.
來源:README.md,提交 f6328bb
工具
0版本歷史
6- v4.6.2最新Oct 31, 2026
- v4.6.0Oct 31, 2026
- v4.5.2Oct 16, 2026
- v4.5.1Oct 14, 2026
- v4.5.0Sep 28, 2026
- v4.4.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分