home / mcp / mcp text editor server

MCP Text Editor Server

Provides line-based text file editing via MCP with safe concurrency, hash validation, and token-efficient partial access.

Installation
Add the following to your MCP client configuration file.

Configuration

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

You can run a dedicated MCP server that exposes safe, line-based text editing capabilities. It enables efficient partial-file access and robust conflict handling, making it ideal for tools and automated workflows that manipulate text files through a standardized API.

How to use

To use the MCP Text Editor Server with an MCP client, run the local server and configure your client to connect via the provided stdio interface. The server exposes a set of text-editing tools that let you read and modify text files line by line, with hash-based validation to prevent conflicts.

Configure your MCP client to connect using the following stdio configuration snippet. This runs the editor via a local command and arguments so your tool can interact with the server directly.

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

Usage patterns you can perform with the server

Get the contents of a text file or multiple ranges to load only the parts you need, using a simple request that specifies file paths, line ranges, and encodings.

Patch content of one or more files with robust conflict detection. You first read the current hash of the range you want to modify, then submit patches with the corresponding range hashes. Patches are applied from bottom to top to avoid shifting line numbers in subsequent edits.

All edits use SHA-256 hashes to guarantee that you are editing the latest version of the file, preventing race conditions when multiple processes modify the same file.

Start and run flow

Start the server in your environment when you are ready to accept requests from your MCP clients.

uvx mcp-text-editor

Available tools

get_text_file_contents

Retrieve text file contents with line ranges and encoding, supporting single or multiple ranges across one or more files.

patch_text_file_contents

Apply patches to one or more text files with range hashes, ensuring conflict detection and correct handling of line-number shifts.

edit_text_file_contents

Edit file contents by submitting patches after validating current content hashes; handles multiple files in a single operation and reports detailed errors.