Text File Read And Refactor MCP logo

Text File Read And Refactor MCP

by FI-Mihej

Reads, searches, and edits text files through a Python stdio MCP server while preserving each file's encoding and BOM.

Install Text File Read And Refactor MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "fi-mihej-text-file-read-and-refactor-mcp": {
      "command": "uvx",
      "args": [
        "text-file-read-and-refactor-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

FI-Mihej/text_file_read_and_refactor_mcp exposes local text-file inspection, search, and replacement operations through a Python stdio MCP server. It supports character slices, line ranges, literal and pattern-based searches, and boundary-defined spans for targeted edits. Files are read with automatic BOM and codepage detection, while edits retain the original encoding and BOM. Reach for it when an agent needs token-efficient access to text files without loading entire files for every operation.

Use cases

  • Read only the relevant lines from a large text file
  • Find literal, word, development-word, or regex matches
  • Replace configuration values between known boundaries
  • Patch several boundary-defined spans in one operation
  • Preserve a file's original encoding and BOM during edits

Key features

  • Character-slice and line-range reading
  • Literal and pattern-based text search
  • Boundary-based span inspection and replacement
  • Batch patching of boundary-defined spans
  • Automatic BOM and codepage detection
  • Original encoding and BOM preservation on edits

Tools17

What Text File Read And Refactor MCP lets your agent do. Expand a tool for its parameters.

Self-reported~595 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 113d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · text-file-read-and-refactor-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Tools exposed17Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Text File Read And Refactor MCP works

What FI-Mihej/text_file_read_and_refactor_mcp does

FI-Mihej/text_file_read_and_refactor_mcp gives an MCP client tools for inspecting and modifying text files. Its read operations can report file size in characters and line count, return selected character or line ranges, search for text, and identify the locations of matches. The server also exposes the directories it permits for file operations.

Search results can include character slices, line ranges, and matched text. Search modes are defined as text, word, dev_word, or regex, allowing callers to choose between literal and pattern-oriented matching.

Editing operations cover several levels of precision. An agent can replace a line range, replace a character slice, substitute text, or update content located between two boundaries. A batch patch operation accepts multiple boundary-based replacements.

How it works

The server runs as a Python process using MCP's stdio transport. The client starts it and communicates with it over standard input and output. The documented launch command is the uvx entry point text-file-read-and-refactor-mcp.

The tool model uses three concepts. A slice represents a start and end character index. A boundary describes text to locate and includes a matching type such as literal text, a word, a development-style word, or a regular expression. A span combines a left and right boundary, so an operation can retrieve or replace the content between them, or include the boundaries themselves.

For example, span tools can locate the value between a configuration label and a terminator, or return the complete text including those surrounding markers. The server resolves a file's BOM and codepage when reading. Replacement tools write the result using the file's original encoding and BOM.

Setup and configuration

Install uv using its official installation instructions, then add an MCP server entry to the client configuration:

config.json
{
  "mcpServers": {
    "text-file-read-and-refactor": {
      "command": "uvx",
      "args": [
        "text-file-read-and-refactor-mcp"
      ]
    }
  }
}

No environment variables are documented for this setup. The README identifies Linux, Windows, and macOS support, with x86_64 and ARM64 wheels listed. The project is a stdio server rather than an HTTP service, so the MCP client is responsible for launching the command.

Tools and capabilities

The read-only tool group includes:

  • Listing allowed directories.
  • Measuring character length and line count.
  • Reading by character slice or line range.
  • Finding one match or a selected range of all occurrences.
  • Expanding a character slice to its containing line range.
  • Finding boundary positions and retrieving spans with or without the boundary text.

The edit group includes line-range replacement, slice replacement, direct text replacement, replacement between boundaries, replacement including boundaries, and patching several boundary-defined spans in one call. These operations are suited to focused changes where the caller already knows the relevant offsets, lines, text, or boundary patterns.

Limitations and notes

The repository is described as a curated public mirror, with active development and private research notes maintained elsewhere. Its stated license is Apache License 2.0.

FI-Mihej/text_file_read_and_refactor_mcp is appropriate when an MCP client needs structured reads and targeted text edits. Choose the slice, line, or boundary tool according to how stable the target location is, and use the search tools first when the location must be discovered from file content.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Text File Read And Refactor MCP

FI-Mihej/text_file_read_and_refactor_mcp is an MCP server that connects MCP clients to local text files through Python stdio. Its main tools read character slices and line ranges, search literal or pattern-based text, inspect boundary-defined spans, and replace content while preserving the file's original encoding and BOM.

Install `uv`, then configure the MCP client to run `uvx text-file-read-and-refactor-mcp`. The README provides a JSON entry using `uvx` as the command and `text-file-read-and-refactor-mcp` as its argument; no environment variables are documented.

Yes, it can be used with Cursor through its standard stdio MCP configuration. Add the documented `uvx` command and `text-file-read-and-refactor-mcp` argument to Cursor's MCP server configuration.

Yes, edit tools save files with their original encoding and BOM. The server automatically resolves the file's BOM and codepage when handling text, then retains those properties when writing edits.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewText File Read And Refactor MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/fi-mihej-text-file-read-and-refactor-mcp?style=directory)](https://allmcps.com/mcp/fi-mihej-text-file-read-and-refactor-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/fi-mihej-text-file-read-and-refactor-mcp"><img src="https://allmcps.com/api/badge/fi-mihej-text-file-read-and-refactor-mcp?style=directory" alt="Text File Read And Refactor MCP on AllMCPs" /></a>