tu

tumf/mcp-text-editor

๐Ÿ ๐Ÿ  A line-oriented text file editor. Optimized for LLM tools with efficient partial file access to minimize token usage.

#text editor#LLM tools#file access
Publishertumf/mcp-text-editor
Submitted date4/19/2025

MCP Text Editor Server Overview

Title

MCP Text Editor Server

A Model Context Protocol (MCP) server optimized for line-oriented text file editing, designed for seamless integration with LLM tools and efficient partial file access.

How to Use

Quick Start for Claude.app Users

Add the server configuration to your Claude.app settings:

{ "mcpServers": { "text-editor": { "command": "uvx", "args": ["mcp-text-editor"] } } }

For Docker:

{ "mcpServers": { "text-editor": { "command": "docker", "args": ["run", "-i", "--rm", "--mount", "type=bind,src=/some/path/src,dst=/some/path/dst", "mcp/text-editor"] } } }

Installation

  1. Requirements: Python 3.13+, POSIX/Windows OS, file system permissions.
  2. Install via UVX:
    uvx mcp-text-editor
  3. Manual Installation:
    pyenv install 3.13.0 uv venv uv pip install -e ".[dev]"
  4. Docker:
    docker build --network=host -t mcp/text-editor .

Running the Server

  • Standard:
    python -m mcp_text_editor
  • Docker:
    docker run -i --rm --mount "type=bind,src=/some/path/src,dst=/some/path/dst" mcp/text-editor

Key Features

  • Line-Based Editing: Efficient partial file access with line-range specifications to minimize token usage in LLM applications.
  • Concurrent Editing: Safe multi-user operations with hash-based conflict detection.
  • Multi-File Support: Read/edit multiple files or ranges in a single request.
  • Encoding Support: UTF-8, Shift_JIS, Latin1, and more.
  • Atomic Operations: Reliable batch edits with proper line-shift handling.

Use Cases

  • LLM Tool Integration: Optimized for AI-assisted coding/editing with minimal token overhead.
  • Collaborative Editing: Safe concurrent modifications for team-based workflows.
  • Automated Text Processing: Scriptable line-level file manipulations.
  • Large File Handling: Memory-efficient processing of big text files.

Key Tools

  1. get_text_file_contents: Fetch specific line ranges from files.
  2. patch_text_file_contents: Apply edits with conflict detection.

Example Request (Partial Read):

{ "file_path": "file.txt", "line_start": 1, "line_end": 10 }

Example Request (Multi-File Edit):

{ "files": [{ "file_path": "file1.txt", "hash": "sha256-hash-from-get-contents", "patches": [{ "start": 5, "end": 8, "contents": "New content\n" }] }] }

For detailed API specs, error handling, and advanced usage, refer to the full documentation.


Badges:
codecov
smithery badge

Visit More

View All