text_file_read_and_refactor_mcp
Text File Read And Refactor MCP
Servidor MCP eficiente en tokens basado en Python stdio que expone herramientas seguras de búsqueda, lectura y refactorización de archivos de texto. Las herramientas resuelven automáticamente la marca BOM y la página de códigos del archivo; las herramientas de edición guardan los archivos con su codificación y BOM originales.
Glama.AI
Repositorio de Github
El repositorio de Github es un espejo público curado del proyecto. El desarrollo activo (incluyendo código experimental y notas de investigación privadas) ocurre en un repositorio privado; las instantáneas seleccionadas se publican aquí periódicamente.
Instalación
Instalar
uv: https://docs.astral.sh/uv/getting-started/installation/Configurar tu cliente MCP para ejecutar el servidor a través de
uvx:
{
"mcpServers": {
"text-file-read-and-refactor": {
"command": "uvx",
"args": [
"text-file-read-and-refactor-mcp"
]
}
}
}Related MCP server: MCP File Context Server
Herramientas
Concepto Slice: un análogo de slice(start: integer, stop: integer) – almacena los índices de inicio y fin de un rango.
Concepto Boundary: un análogo de Boundary(text: string, type: Enum[text, word, dev_word, regex])
Concepto Span: un análogo de Span(left_boundary: Boundary, right_boundary: Boundary). Permite operaciones de búsqueda/reemplazo como «dame el texto entre "my_config_param:" y ";"» o «reemplaza el texto entre "%my_regex_1%" y "%my_regex_2%" con "my_text"».
Herramientas de solo lectura:
text_file__list_allowed_directories– en pseudocódigo:"text\_file\_\_list\_allowed\_directories() -> List\[directory\_path]"text_file__file_content_length– en pseudocódigo:"text\_file\_\_file\_content\_length() -> integer\_characters\_num"text_file__read_slice– en pseudocódigo:"text\_file\_\_read\_slice(characters\_slice) -> text"text_file__file_lines_num– en pseudocódigo:"text\_file\_\_file\_lines\_num() -> integer\_lines\_num"text_file__read_content_by_line_range– en pseudocódigo:"text\_file\_\_read\_content\_by\_line\_range(lines\_slice) -> text"text_file__find_text– en pseudocódigo:"text\_file\_\_find\_text(text, type: Enum\[text, word, dev\_word, regex]) -> {found, result?: {slice, lines, text}}"text_file__find_all_text_occurrences– en pseudocódigo:"text\_file\_\_find\_all\_text\_occurrences(text, type: Enum\[text, word, dev\_word, regex], result\_index\_start, result\_index\_stop) -> List\[{found, result: {slice, lines, text}}]"text_file__expand_slice_to_lines– en pseudocódigo:"text\_file\_\_expand\_slice\_to\_lines(characters\_slice) -> lines\_slice"text_file__find_span_boundaries– en pseudocódigo:"text\_file\_\_find\_span\_boundaries(left\_boundary, right\_boundary) -> Tuple\[left\_boundary\_characters\_slice, right\_boundary\_characters\_slice]"text_file__find_span_between_boundaries– en pseudocódigo:"text\_file\_\_find\_span\_between\_boundaries(left\_boundary, right\_boundary) -> text". Ejemplo:text_file__find_span_between_boundaries("my_config_param:", ";")devolverá la cadena " my_value".text_file__find_span_with_boundaries– en pseudocódigo:"text\_file\_\_find\_span\_with\_boundaries(left\_boundary, right\_boundary) -> text". Ejemplo:text_file__find_span_with_boundaries("my_config_param:", ";")devolverá la cadena "my_config_param: my_value;".
Herramientas de edición:
text_file__replace_content_by_line_range– en pseudocódigo:"text\_file\_\_replace\_content\_by\_line\_range(text, lines\_slice)"text_file__replace_slice– en pseudocódigo:"text\_file\_\_replace\_slice(text, characters\_slice)"text_file__replace_text– en pseudocódigo:"text\_file\_\_replace\_slice(old\_text, new\_text)"text_file__replace_span_between_boundaries– en pseudocódigo:"text\_file\_\_replace\_span\_between\_boundaries(text, left\_boundary, right\_boundary)".text_file__replace_span_with_boundaries– en pseudocódigo:"text\_file\_\_replace\_span\_with\_boundaries(text, left\_boundary, right\_boundary)".text_file__patch_spans_by_boundary_patterns– en pseudocódigo:"text\_file\_\_patch\_spans\_by\_boundary\_patterns(List\[Tuple\[text, left\_boundary, right\_boundary]])".
Cengal
Basado en Cengal
Proyectos que usan Cengal
InterProcessPyObjects – Paquete de alto rendimiento que ofrece una comunicación entre procesos ultrarrápida a través de memoria compartida, permitiendo compartir objetos de Python entre procesos con una eficiencia excepcional.
cengal_app_dir_path_finder – Módulo de Python que ofrece una API unificada para obtener fácilmente directorios de aplicaciones específicos del sistema operativo, mejorando la gestión de datos en Windows, Linux y macOS.
cengal_cpu_info – Información extendida y almacenada en caché de la CPU con un formato de salida consistente.
cengal_memory_barriers – Barreras de memoria multiplataforma rápidas para Python.
flet_async – envoltorio que hace que Flet sea asíncrono y trae tanto Cengal.coroutines como asyncio a Flet (interfaz de usuario basada en Flutter).
justpy_containers – envoltorio alrededor de JustPy para aportar más seguridad y características necesarias en producción a JustPy (interfaz de usuario basada en VueJS).
Bensbach – descompilador de bytecode de Unreal Engine 3 a un script similar a Lisp y compilador de vuelta a bytecode de Unreal Engine 3. Creado con fines de modding de juegos.
Realistic-Damage-Model-mod-for-Long-War – Mod tanto para el XCOM:EW original como para el mod Long War. Fue creado con Bensbach, que a su vez se creó con Cengal.
SmartCATaloguer.com – Catálogo basado en TagDB de imágenes (etiquetas), álbumes de música (etiquetas de género) y aplicaciones (categorías).
Licencia
Copyright © 2026 ButenkoMS. Todos los derechos reservados.
Licenciado bajo la Licencia Apache, Versión 2.0.
Available Tools
16 toolstext_file__expand_slice_to_linesA
Opens the text file, automatically resolving the BOM and codepage. Expands a character slice to cover complete lines and returns both the expanded character slice and selected line-number slice. Provide slices as JSON objects matching Python slice(start, stop, step); omit fields for None, and never use step 0. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: place (required), source_file_path (required).
text_file__file_content_lengthA
Opens the text file, automatically resolving the BOM and codepage. Returns the number of characters in the decoded file content. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: source_file_path (required).
text_file__file_lines_numA
Opens the text file, automatically resolving the BOM and codepage. Returns the number of lines in the decoded file content. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: source_file_path (required).
text_file__find_span_between_boundariesB
Opens the text file, automatically resolving the BOM and codepage. Finds content between matching boundary markers described by the boundary_span object and returns the inner slice, or null if not found. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: boundary_span (required), source_file_path (required), stop, start, +2 more.
text_file__find_span_boundariesA
Opens the text file, automatically resolving the BOM and codepage. Finds matching left and right boundary markers described by the boundary_span object and returns their slices. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: boundary_span (required), source_file_path (required), stop, start, +2 more.
text_file__find_span_with_boundariesB
Opens the text file, automatically resolving the BOM and codepage. Finds content plus its surrounding matching boundary markers and returns the full slice, or null if not found. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: boundary_span (required), source_file_path (required), stop, start, +2 more.
text_file__find_textA
Opens the text file, automatically resolving the BOM and codepage. Finds the first or last exact text, whole-word, or identifier-style word match within optional start/stop character offsets and returns its slice, or null if not found. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: text (required), source_file_path (required), stop, type, +7 more.
text_file__list_allowed_directoriesA
Returns the filesystem directories this server is allowed to access. File paths used by other tools must be inside one of these directories. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: no named parameters.
text_file__patch_spans_by_boundary_patternsB
Opens the text file, automatically resolving the BOM and codepage. Applies one boundary-span replacement or an ordered list of boundary-span replacements, then writes the modified content back. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: source_file_path (required), text, count, patch, +1 more.
text_file__read_content_by_line_rangeA
Opens the text file, automatically resolving the BOM and codepage. Reads complete lines selected by a Python-style line-number slice. Provide slices as JSON objects matching Python slice(start, stop, step); omit fields for None, and never use step 0. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: line_range (required), source_file_path (required).
text_file__read_sliceA
Opens the text file, automatically resolving the BOM and codepage. Allows you to read any section of the file content (or the entire content) using Python-style slicing. Provide slices as JSON objects matching Python slice(start, stop, step); omit fields for None, and never use step 0. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context.
Inputs: slice (required), source_file_path (required).
text_file__replace_content_by_line_rangeA
Opens the text file, automatically resolving the BOM and codepage. Replaces complete lines selected by a Python-style line-number slice, then writes the modified content back. Provide slices as JSON objects matching Python slice(start, stop, step); omit fields for None, and never use step 0. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: text (required), line_range (required), source_file_path (required).
text_file__replace_sliceA
Opens the text file, automatically resolving the BOM and codepage. Replaces the content selected by a Python-style character slice, then writes the modified content back. Provide slices as JSON objects matching Python slice(start, stop, step); omit fields for None, and never use step 0. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: text (required), place (required), source_file_path (required).
text_file__replace_span_between_boundariesA
Opens the text file, automatically resolving the BOM and codepage. Replaces only the content between matching boundary markers, preserves the boundary markers, then writes the modified content back. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: text (required), boundary_span (required), source_file_path (required), count.
text_file__replace_span_with_boundariesB
Opens the text file, automatically resolving the BOM and codepage. Replaces matching boundary markers together with the content between them, then writes the modified content back. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: text (required), boundary_span (required), source_file_path (required), count.
text_file__replace_textA
Opens the text file, automatically resolving the BOM and codepage. Replaces exact substring, whole-word, or identifier-style word matches within optional start/stop character offsets, then writes the modified content back. Token-efficient: targets specific file content or returns compact structured results to reduce unnecessary context. The file is saved with its original encoding and BOM.
Inputs: new_text (required), old_text (required), source_file_path (required), stop, +8 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, but some pairs like find_span_between_boundaries and find_span_with_boundaries could be confused. Descriptions help disambiguate.
All tools follow a consistent `text_file__verb_phrase` pattern with snake_case, making the naming predictable and uniform.
With 16 tools, the set is well-scoped for reading and refactoring text files, covering various operations without being overwhelming.
Core operations like reading, finding, and replacing are covered. However, missing tools for creating or deleting files limit full lifecycle management.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
Related MCP Servers
- AlicenseAqualityCmaintenanceA line-oriented text file editor. Optimized for LLM tools with efficient partial file access to minimize token usage.6202MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.639MIT
- AlicenseBqualityDmaintenanceAn open source implementation of the Claude built-in text editor tool versions: text\_editor\_20241022 (Claude 3.5 Sonnet) text\_editor\_20250124 (Claude 3.7 Sonnet)136 npm36MIT
- AlicenseAqualityDmaintenanceEnables comprehensive file operations including reading, writing, searching, and editing files with advanced features like regex-based replacements, line-specific modifications, and directory-wide search capabilities. Provides 8 robust tools for safe file manipulation with content verification and detailed error handling.810 npm2MIT