encoding-bridge
Encoding Bridge is an MCP server that gives Claude encoding-transparent file tools, so legacy non-UTF-8 files can be read, searched, and edited without corruption.
Read files by absolute path (offset/limit, ~2000 lines default, >256KB needs paging), including images, PDFs (max 20 pages via
pages), and Jupyter notebooks.Edit files with exact string replacements; requires a prior Read, enforces uniqueness, supports
replace_all.Write files (creates new or full rewrites); requires reading an existing file first.
Grep with full regex, glob/type filters, context lines (
-A/-B/-C), case-insensitivity, multiline, and output modes (content,files_with_matches,count) with head_limit/offset pagination.Encoding detection for GBK/GB2312/GB18030, Big5, Shift-JIS, EUC-KR, Windows codepages, UTF-8 and UTF-16; disk bytes are decoded to Unicode for the model and re-encoded back to the original codepage on write.
Strict writes that fail instead of substituting unrepresentable characters with
?, preserving legacy files.BOM and dominant line-ending preservation, plus read-before-write protection and stale-write detection.
Encoding-aware search: ASCII patterns run in one ripgrep pass; non-ASCII patterns are grouped and searched per detected encoding.
Local encoding index built in the background on first use, with multi-root workspace support via
ENCODING_BRIDGE_ROOTS.
Allows reading Jupyter Notebook files, exposing their contents to the model while preserving the original on-disk encoding.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@encoding-bridge search for 'TODO' in the GBK source files"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Encoding Bridge MCP
Claude Code's built-in file tools assume UTF-8, so non-UTF-8 files show garbled text. Encoding Bridge auto-detects the file encoding and writes back in the original encoding.
What it's for
Projects that need to read and write non-UTF-8 files.
Related MCP server: Code Editor MCP Server
Install
npm install -g encoding-bridge-mcpIn a project that handles legacy encodings (GBK/GB2312, etc.), add a
.mcp.json in the project root and set ENCODING_BRIDGE_ROOTS to the
workspaces Encoding Bridge should handle:
{
"mcpServers": {
"encoding-bridge": {
"type": "stdio",
"command": "encoding-bridge-mcp",
"args": [],
"env": {
"ENCODING_BRIDGE_ROOTS": "E:/path/to/project-a;E:/path/to/project-b"
}
}
}
}ENCODING_BRIDGE_ROOTS is the list of workspaces to handle; separate multiple
entries with ; (Windows) or : (Unix).
The .mcp.json lives in the first workspace folder VS Code opens; putting it
in a workspace folder added later has no effect.
Allow the tools in a project
Encoding Bridge uses project-scoped permissions. In each project you want it to
handle, create or edit that project's .claude/settings.json to allow the MCP
tools and deny the built-in file tools:
{
"permissions": {
"allow": [
"mcp__encoding-bridge__Read",
"mcp__encoding-bridge__Grep",
"mcp__encoding-bridge__Edit",
"mcp__encoding-bridge__Write"
],
"deny": ["Read", "Grep", "Edit", "Write", "NotebookEdit"]
}
}Verify it works
Start (or reload) a Claude Code session and ask it to read or search a legacy
file. The tool calls should be mcp__encoding-bridge__Read / Grep / Edit /
Write, not the built-in tools. A configured ENCODING_BRIDGE_ROOTS directory
will get a .encoding-bridge/encoding-index.json, confirming it is enabled.
License
MIT. See LICENSE.
Available Tools
4 toolsEditPerforms exact string replacements in files.A
Performs exact string replacements in files.
Usage:
You must use your
Readtool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + tab. Everything after that is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
The edit will FAIL if
old_stringis not unique in the file. Either provide a larger string with more surrounding context to make it unique or usereplace_allto change every instance ofold_string.Use
replace_allfor replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
Inputs: file_path (required), new_string (required), old_string (required), replace_all.
GrepA powerful search tool built on regular expressions.A
A powerful search tool for file contents.
Usage:
ALWAYS use Grep for search tasks. NEVER invoke grep or rg as a Bash command.
Supports full regular expressions, file glob filters, file type filters, context lines, match-only output, multiline matching, pagination, file lists, and per-file counts.
Use output_mode=files_with_matches when you only need file paths; this is the default.
Use output_mode=content to see matching lines. Line numbers are included by default.
Use output_mode=count to see match counts per file.
scan_mode=exact is the default: pagination never stops scanning, so counts are exact when scanComplete is true. scan_mode=fast is opt-in and only valid for files_with_matches; it stops each matching file at its first match and reports countsExact=false.
Results are limited to 250 entries by default; use head_limit and offset for pagination. Check structuredContent scanComplete, truncationReason, and outputTruncated whenever a search is resource-limited.
ASCII patterns are searched once with ripgrep and ignore file encoding.
Non-ASCII patterns (Chinese, etc.) are grouped by detected file encoding and searched with rg --encoding per group.
Inputs: pattern (required), -A, -B, -C, +12 more.
ReadRead a file from the local filesystem.A
Reads a file from the local filesystem. You can access any file directly by using this tool. Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
Usage:
The file_path parameter must be an absolute path, not a relative path
By default, it reads up to 2000 lines starting from the beginning of the file. Files larger than 256KB will return an error; use offset and limit for larger files
When you already know which part of the file you need, only read that part. This can be important for larger files.
Results are returned using cat -n format, with line numbers starting at 1
This tool allows Claude Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Claude Code is a multimodal LLM.
This tool can read PDF files (.pdf). For large PDFs (more than 10 pages), you MUST provide the pages parameter to read specific page ranges (e.g., pages: "1-5"). Reading a large PDF without the pages parameter will fail. Maximum 20 pages per request.
This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
This tool can only read files, not directories. To read a directory, use an ls command via the Bash tool.
You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
Inputs: file_path (required), limit, pages, offset.
WriteWrite a file to the local filesystem.A
Writes a file to the local filesystem.
Usage:
This tool will overwrite the existing file if there is one at the provided path.
If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
Prefer the Edit tool for modifying existing files — it only sends the diff. Only use this tool to create new files or for complete rewrites.
NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
Inputs: content (required), file_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clear, non-overlapping purpose: Read retrieves file contents, Edit performs targeted string replacements, Write creates or overwrites files, and Grep searches file contents. There is no ambiguity in choosing which tool to use for a given task.
All tool names are single-word verbs (Read, Edit, Write, Grep) that directly describe their actions. The naming is consistent and predictable, though it does not follow a verb_noun pattern.
With 4 tools covering file reading, editing, writing, and searching, the count is well-scoped for a file manipulation server. Each tool is essential and there is no redundancy.
The tool surface covers the primary file operations (read, write, edit, search) but lacks delete, move, copy, and directory listing. These gaps are minor and can be worked around, but a file delete tool would make the set more complete.
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Manage files and folders directly from your workspace. Read and write files, list directories, cre…
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables creation and management of UTF-8 with BOM encoded files optimized for Windows build environments. Provides file encoding conversion, detection, and template support for C++ and PowerShell files to prevent Korean character encoding issues.41MIT
- AlicenseAqualityDmaintenanceEnables safe, concurrent file system operations with sandboxed directory access control, automatic encoding detection, optimistic locking, and precise code editing capabilities including search-replace and batch operations.105MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to read and write non-UTF-8 files (e.g., GBK, GB18030) on Windows by automatically detecting and converting encodings, preventing garbled text.7-
- AlicenseNot gradedqualityDmaintenanceEnables writing and editing files in ISO-8859-1 encoding, automatically converting UTF-8 content to ISO-8859-1 for legacy codebases.199 npm2MIT