Codepage Bridge MCP
This server provides encoding-transparent file operations for legacy codebases, automatically converting between on-disk legacy encodings (GBK, Big5, Shift-JIS, Windows codepages, UTF-16, etc.) and Unicode for the LLM, based on project-level .encoding-rules files.
Read: Read files from the local filesystem with automatic encoding conversion. Supports text files, images (PNG, JPG, GIF, WebP), PDFs (with page range selection), and Jupyter Notebooks. Supports
offsetandlimitfor partial reads of large files.Grep: Regex-based search across files/directories with legacy encoding transparency. Supports glob/type filters, case-insensitive and multiline matching, context lines, multiple output modes (
content,files_with_matches,count), line numbers, and pagination.Edit: Exact string replacements with read-before-write protection, stale-write detection, and preservation of original encoding, BOM, and line endings. Supports
replace_allfor global replacements.Write: Create new files or fully rewrite existing ones using the encoding defined by
.encoding-rules. Requires a prior read for existing files to prevent unintended overwrites. Fails safely if content cannot be represented in the target encoding, preventing silent data corruption.
Click on "Install 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., "@Codepage Bridge MCPSearch for 'deprecated' in all .cpp 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.
Codepage Bridge MCP
Encoding-transparent file tools for Claude Code and other MCP clients.
Codepage Bridge exposes Read, Grep, Edit, and Write over MCP while transparently converting project files between their on-disk legacy encoding and Unicode text for the LLM. The model sees normal Unicode text; files are written back in the encoding selected by the nearest .encoding-rules.
It is designed for legacy codebases that still use GBK/GB2312/GB18030, Big5, Shift-JIS, EUC-KR, Windows codepages, UTF-16, and other non-UTF-8 encodings.
Recommended install
This is now the single recommended installation path for end users.
Windows
# Remove an older install with the same name first, if one exists.
claude mcp remove codepage-bridge -s user
# Register the npm package once, at user scope. `cmd` is required on Windows.
claude mcp add --scope user codepage-bridge -- cmd /d /s /c "npx -y codepage-bridge-mcp"
claude mcp get codepage-bridgemacOS / Linux
# Remove an older install with the same name first, if one exists.
claude mcp remove codepage-bridge -s user
# Register the npm package once, at user scope.
claude mcp add --scope user codepage-bridge -- npx -y codepage-bridge-mcp
claude mcp get codepage-bridgeWhat this requires locally:
claudenode
What it does not require:
git clonenpm installnpm run builddownloading a GitHub Release package first
Avoid duplicate MCP registrations
Register codepage-bridge in only one scope. Claude Code treats the same server name with different commands as a configuration conflict—for example, an older user-scoped local build and this repository's project-scoped .mcp.json npm command.
Run claude mcp list to diagnose duplicates. Keep the endpoint you want, then remove the other registration:
# Keep the npm command from the user-scoped installation.
claude mcp remove codepage-bridge -s project
# Or keep a project-local configuration and remove a previous user installation.
claude mcp remove codepage-bridge -s userAfter removing a registration, run claude mcp get codepage-bridge again. It must report one endpoint with status Connected.
Large text files
Read and Grep allow individual text files up to 32 MiB by default. To use a different limit, set CODEPAGE_BRIDGE_MAX_TEXT_FILE_MIB to a positive integer before starting Claude Code:
setx CODEPAGE_BRIDGE_MAX_TEXT_FILE_MIB 64Restart Claude Code after changing the variable. Larger files require proportionally more Node.js memory while decoding, splitting lines, and matching regular expressions.
Related MCP server: vulcan-file-ops
Why
Claude Code built-in file tools assume UTF-8 for normal text reads. In legacy projects this can lead to:
unreadable C/C++ comments and string literals;
searches that silently miss text;
edits that corrupt the original codepage;
accidental UTF-8 rewrites of GBK or other legacy files.
Codepage Bridge keeps encoding conversion below the model boundary:
legacy bytes on disk -> decode by .encoding-rules -> Unicode for the LLM
Unicode from the LLM -> strict encode by .encoding-rules -> legacy bytes on diskIf new text cannot be represented in the target encoding, the write fails instead of silently replacing characters with ?.
Required Claude Code configuration
Installing the MCP is not sufficient by itself.
Claude Code may still choose its built-in:
ReadGrepEditWriteNotebookEdit
Those tools bypass .encoding-rules.
Step 1 — merge settings.fragment.json
Merge this into your existing ~/.claude/settings.json:
{
"permissions": {
"allow": [
"mcp__codepage-bridge__Read",
"mcp__codepage-bridge__Grep",
"mcp__codepage-bridge__Edit",
"mcp__codepage-bridge__Write"
],
"deny": [
"Read",
"Grep",
"Edit",
"Write",
"NotebookEdit"
]
}
}Template file:
examples/claude-config/settings.fragment.json
Do not replace your whole settings file unless it is empty. Merge these arrays into your existing configuration.
Step 2 — add a CLAUDE.md policy
Add this to the project CLAUDE.md, or to ~/.claude/CLAUDE.md for a global policy:
## File encoding policy
Use Codepage Bridge for all project file content operations:
- Read with `mcp__codepage-bridge__Read`.
- Search with `mcp__codepage-bridge__Grep`.
- Edit with `mcp__codepage-bridge__Edit`.
- Create or completely rewrite with `mcp__codepage-bridge__Write`.
Do not use built-in Read, Grep, Edit, Write, NotebookEdit, shell commands,
PowerShell commands, or scripts as substitutes for project file content access.
Glob may only be used to discover paths.
Do not manually transcode files or normalize line endings. `.encoding-rules`
is the source of truth.Template file:
examples/minimal-project/CLAUDE.md
Step 3 — add .encoding-rules
.encoding-rules is optional. When it is absent, Codepage Bridge treats the target file's directory as the allowed root and reads/writes using strict UTF-8. Add a rules file whenever the project contains legacy-encoded files or needs a shared project root.
Example:
# Last matching rule wins
*.c gbk
*.cpp gbk
*.h gbk
legacy/**/*.txt windows-1251
assets/**/*.csv shift_jis
**/*.json utf8
# Cancel earlier matches and return to strict UTF-8
!SourceCode/generated/**Template file:
examples/minimal-project/.encoding-rules
Rules:
Empty lines and lines beginning with
#are ignored.*,**, and?use glob semantics.Patterns without
/, such as*.cpp, match basenames at every directory depth.Patterns containing
/are relative to the.encoding-rulesdirectory.The last matching rule wins.
!patterncancels previous matches and selects strict UTF-8.Files with no matching rule use strict UTF-8.
The nearest
.encoding-rulesis used; its directory is the allowed project root.
Verify the setup
1. Check the MCP is connected
claude mcp get codepage-bridgeExpected:
name:
codepage-bridgestatus:
Connected
2. Start a fresh Claude Code session in a legacy project
3. Ask Claude to read or search a legacy-encoded file
Examples:
Read SourceCode/Main.cpp and show the first 10 lines.Search SourceCode for the string 错误码.4. Confirm the model uses Codepage Bridge tools
In a verbose / print-mode session, the tool call should be one of:
mcp__codepage-bridge__Readmcp__codepage-bridge__Grepmcp__codepage-bridge__Editmcp__codepage-bridge__Write
It should not call built-in Read, Grep, Edit, or Write.
Features
Encoding-aware
Read,Grep,Edit, andWritetools.Project-level
.encoding-ruleswith gitignore-like glob behavior.The nearest
.encoding-rulesdefines both the project root and active rules.Last matching rule wins;
!patternresets matching files to strict UTF-8.Basename patterns such as
*.cppmatch at every directory depth.Strict UTF-8 fallback for files not matched by a rule.
GBK/GB2312/GB18030, Big5, Shift-JIS, EUC-KR, Windows codepages, UTF-8, and UTF-16 support.
BOM and dominant line-ending preservation for edits.
Read-before-write protection and stale-write detection using byte hashes.
Atomic temporary-file writes and per-path write locks.
Symlink and project-root boundary checks.
Image, PDF, and Jupyter Notebook reading.
Grep output modes, context lines, glob/type filters, regex flags, and pagination.
Large-file partial edit authorization: the model only needs to read the target lines it wants to edit, not the entire file.
Development
npm install
npm run check
npm test
npm run build
npm startLicense
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.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | The absolute path to the file to modify | |
| new_string | Yes | The text to replace it with (must be different from old_string) | |
| old_string | Yes | The text to replace | |
| replace_all | No | Replace all occurrences of old_string (default false) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description covers key behavioral traits: edit will fail if old_string not unique, errors without prior read, and replace_all behavior. It could enhance by explicitly stating it's a mutation (destructive) action, but overall transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with purpose and provides detailed bullet points. While slightly lengthy, every sentence adds value. Could be tightened without losing clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema, the description sufficiently explains behavior and constraints (reading before editing, uniqueness failure). It addresses common pitfalls, making it complete for a string replacement tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 100% coverage, but the description adds valuable context: uniqueness constraint for old_string, difference from replace_all, and emphasis on exact matching (indentation). This goes beyond the schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Performs exact string replacements in files.' with a specific verb ('replace') and resource ('files'). It distinguishes from siblings: Grep (search), Read (read), Write (write).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage guidance: must read file before editing, preserve exact indentation, prefer editing existing files, avoid emojis, uniqueness requirement for old_string, and when to use replace_all. It also tells when not to use (e.g., avoiding unnecessary new files).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
Results are limited to 250 entries by default; use head_limit and offset for pagination.
Every file is decoded according to its nearest project .encoding-rules, so legacy encoded content is searched as Unicode transparently.
| Name | Required | Description | Default |
|---|---|---|---|
| -A | No | Show lines after each match | |
| -B | No | Show lines before each match | |
| -C | No | Show lines before and after each match | |
| -i | No | Case-insensitive search | |
| -n | No | Show line numbers in content mode. Defaults to true. | |
| -o | No | Print only matching non-empty parts of each line | |
| glob | No | Glob pattern used to filter files, for example *.js or **/*.ts | |
| path | No | File or directory to search. Defaults to the current working directory. | |
| type | No | File type filter such as js, ts, py, rust, go, or java | |
| offset | No | Skip the first N result lines or entries | |
| context | No | Alias for -C | |
| pattern | Yes | The regular expression pattern to search for in file contents | |
| multiline | No | Enable multiline matching where dot also matches newlines | |
| head_limit | No | Limit returned lines or entries. Defaults to 250; 0 means unlimited. | |
| output_mode | No | Output mode. Defaults to files_with_matches. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, but the description fully discloses behavior: result limits (250), pagination via head_limit and offset, encoding handling, default modes, and line numbers. It implicitly indicates read-only nature.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections and bullet points. It is concise yet covers all necessary usage details without repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description covers essential aspects: usage, parameters, defaults, encoding, and pagination. It is sufficient for an agent to invoke the tool correctly, though it could mention that output is textual.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 100% coverage, so baseline is 3. The description adds value by explaining the purpose of output modes, the default for line numbers, and the effect of head_limit=0. This extra guidance justifies a 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it is a search tool for file contents using regular expressions, and explicitly differentiates from sibling tools (Edit, Read, Write) by stating it should be used for search tasks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit usage instructions: 'ALWAYS use Grep for search tasks. NEVER invoke grep or rg as a Bash command.' Also explains when to use different output modes (content, files_with_matches, count) and pagination.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | The number of lines to read. Only provide if the file is too large to read at once. | |
| pages | No | Page range for PDF files (e.g., "1-5", "3", "10-20"). Only applicable to PDF files. Maximum 20 pages per request. | |
| offset | No | The line number to start reading from. Only provide if the file is too large to read at once | |
| file_path | Yes | The absolute path to the file to read |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It comprehensively discloses behaviors: default 2000 lines, 256KB limit, cat -n output, multimodal for images, PDF pagination rules, notebook handling, directory exclusion, and empty file warning.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured with a clear opening and bullet points. Every sentence serves a purpose, but the description is somewhat lengthy. Front-loaded with the main purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity and no output schema, the description is remarkably complete. It covers all parameters, edge cases (empty file, directory, screenshots), and special file types (images, PDF, notebooks). No gaps identified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds significant value beyond schema: file_path must be absolute, limit only for large files, pages only for PDF, offset as line number. It also provides context like defaults and error conditions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it reads files from the local filesystem, with specific verb and resource. It distinguishes from sibling tools (Edit, Grep, Write) by focusing solely on reading. The title and description are aligned.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Extensive guidelines are provided: absolute path requirement, default line limit, file size handling, PDF and notebook specifics, and directory exclusion. However, it does not explicitly state when to use this tool over alternatives, though the sibling names imply differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content to write to the file | |
| file_path | Yes | The absolute path to the file to write (must be absolute, not relative) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description bears full burden. It discloses overwrite behavior, the read-first requirement (and that failure occurs otherwise), and preference for Edit. Could mention directory creation or error handling, but covers key behavioral traits well.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One clear introductory sentence followed by bullet points with zero redundancy. Every sentence contributes meaningful guidance. Front-loaded with purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema exists, but no return value explanation needed. Description covers prerequisites (read first), alternatives (Edit), and prohibitions (markdown/emojis). Complete for a file-write tool of moderate complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers 100% of parameters with descriptions. The tool description adds no additional meaning beyond the schema (e.g., no format constraints or examples). Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description begins with 'Writes a file to the local filesystem,' a clear verb+resource statement. It distinguishes from siblings by specifying when to use Write vs Edit (modifications) and Read (must read first for existing files).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly states when to use (create new files or complete rewrites), when to avoid (prefer Edit for modifications), and prerequisites (must read file first if existing). Also includes prohibitions on markdown and emojis unless requested.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose: Edit for replacement, Grep for search, Read for viewing, Write for creation. No functional overlap.
All tool names are single imperative verbs (Edit, Grep, Read, Write), following a consistent and predictable pattern.
With 4 tools, the set is small but covers the core file operations. Slightly thin for a full file editing server, but reasonable for its stated purpose.
Covers read, edit, search, and write, but missing common operations like delete, rename, or directory listing. The implied encoding handling is also not exposed as direct tools.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Path-scoped team memories, rules and skills for Claude Code, Cursor, Codex and other MCP clients.
No-data MCP handoff for local Claude Code to Codex harness moves. $49 lifetime.
Brainfile memory layer for Claude Code over MCP: free starter files + weekly freshness feed.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Related MCP Servers
- FlicenseBqualityDmaintenanceMulti-mode MCP server supporting both Claude Desktop (STDIO) and OpenAI (HTTP/SSE) integrations with file operations including read, write, delete, and search capabilities.3
- AlicenseAqualityDmaintenanceMCP server that gives Claude Desktop and other desktop MCP clients filesystem powers—read, write, edit, and manage files like AI coding assistants.17869MIT
- AlicenseAqualityAmaintenanceMCP server for file operations with non-UTF-8/Unicode encoding: Cyrillic, CP1251, CP1252, ISO-8859, KOI8 auto-detection42021GPL 3.0

ellmos-clatcher-mcpofficial
AlicenseBqualityAmaintenanceUtility-first MCP server that extends Claude Code with file-maintenance capabilities beyond built-in tools. Supports encoding repair, format conversion, duplicate detection, batch renaming, and archive utilities.12731MIT
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/skyispainted/codepage-bridge-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server