tumf/mcp-text-editor logo

tumf/mcp-text-editor

Free

面向行的文本文件编辑器。针对 LLM 工具优化,通过高效的部分文件访问最小化 Token 使用。

FreeFree tier
Inputs: text, fileOutputs: text, file
Type
Open Source

About tumf/mcp-text-editor

MCP Text Editor Server is a Model Context Protocol (MCP) server that provides line-oriented text file editing capabilities through a standardized API. Designed to facilitate safe and efficient line-based text file operations in a client-server architecture, it implements the Model Context Protocol to ensure reliable file editing with robust conflict detection and resolution. The line-oriented approach makes it ideal for applications requiring synchronized file access, such as collaborative editing tools, automated text processing systems, or any scenario where multiple processes need to modify text files safely. Token-efficient partial file access with line-range specifications minimizes token consumption in LLM-based tools. Features include hash-based validation for safe concurrent editing, atomic multi-file operations, comprehensive encoding support (utf-8, shift_jis, latin1, etc.), and memory-efficient processing of large files.

Key Features

Line-oriented text file editing and reading
Smart partial file access with line-range specification to minimize token usage in LLM applications
Read multiple ranges from multiple files in a single operation
Line-based patch application with correct handling of line number shifts
Edit text file contents with conflict detection using hash-based validation
Flexible character encoding support (utf-8, shift_jis, latin1, etc.)
Support for multiple file operations and atomic multi-file operations
Proper handling of concurrent edits with hash-based validation
Memory-efficient processing of large files
Comprehensive error handling with custom error types

Pros & Cons

Pros
  • Token-efficient partial file access reduces LLM token consumption
  • Safe concurrent editing with hash-based conflict detection
  • Atomic multi-file operations ensure consistency
  • Comprehensive encoding support for international text files
  • Memory-efficient, suitable for large files
  • Robust error handling with custom error types
Cons
  • Requires Python 3.13+ and MCP client setup
  • Line-oriented approach may not suit all editing workflows (e.g., binary files)

Best For

Collaborative editing tools requiring synchronized file accessAutomated text processing and batch editing systemsLLM-based tool integration for safe and token-efficient file manipulationMulti-process file editing with conflict detection and resolutionScripting and automation of text file modifications in CI/CD pipelines

FAQ

How do I install MCP Text Editor Server?
Run via uvx: 'uvx mcp-text-editor'. For development, clone the repository and use 'uv pip install -e .[dev]' with Python 3.13+.
How do I use this editor with Claude Desktop?
Add the following configuration to claude_desktop_config.json: { "mcpServers": { "text-editor": { "command": "uvx", "args": ["mcp-text-editor"] } } }
What character encodings are supported?
The editor supports utf-8, shift_jis, latin1, and other common encodings.
Does the editor support concurrent editing?
Yes, it uses hash-based validation to detect and handle concurrent edits safely.