Text Editor MCP server

Provides a secure Python-based text editing interface with two-step verification and syntax validation for collaborative code file manipulation
Back to servers
Setup instructions
Provider
Daniel Podrazka
Release date
Mar 31, 2025
Language
Python
Stats
7 stars

The Editor MCP provides a powerful text editor server that enables AI assistants to effectively read, edit, and manage text files through a standardized API. It uses a unique multi-step approach that significantly improves code editing accuracy and reliability.

Installation

Easy Installation with UVX (Recommended)

# Clone the repository
git clone https://github.com/danielpodrazka/editor-mcp.git
cd editor-mcp

# Run the installation script
chmod +x install.sh
./install.sh

Manual Installation

Using UVX

# Install directly from GitHub
uvx install git+https://github.com/danielpodrazka/mcp-text-editor.git

# Or install from a local clone
git clone https://github.com/danielpodrazka/mcp-text-editor.git
cd mcp-text-editor
uvx install -e .

Using Traditional pip

pip install git+https://github.com/danielpodrazka/mcp-text-editor.git

# Or from a local clone
git clone https://github.com/danielpodrazka/mcp-text-editor.git
cd mcp-text-editor
pip install -e .

Using Requirements (Legacy)

uv pip install -r uv.lock

Usage

Starting the Server

After installation, start the Editor MCP server:

# Using the installed script
editor-mcp

# Or using the Python module
python -m text_editor.server

MCP Configuration

Add the Editor MCP to your MCP configuration file:

{
  "mcpServers": {
     "text-editor": {
       "command": "editor-mcp",
       "env": {
         "MAX_SELECT_LINES": "100",
         "ENABLE_JS_SYNTAX_CHECK": "0",
         "FAIL_ON_PYTHON_SYNTAX_ERROR": "1",
         "FAIL_ON_JS_SYNTAX_ERROR": "0",
         "PROTECTED_PATHS": "*.env,.env*,config*.json,*secret*,/etc/passwd,/home/user/.ssh/id_rsa"
       }
     }
  }
}

Environment Variable Configuration

Customize the Editor MCP behavior with these environment variables:

  • MAX_SELECT_LINES: Maximum number of lines that can be edited in a single operation (default: 50)
  • ENABLE_JS_SYNTAX_CHECK: Enable/disable JavaScript and JSX syntax checking (default: "1" - enabled)
  • FAIL_ON_PYTHON_SYNTAX_ERROR: When enabled, Python syntax errors will automatically cancel the overwrite operation (default: enabled)
  • FAIL_ON_JS_SYNTAX_ERROR: When enabled, JavaScript/JSX syntax errors will automatically cancel the overwrite operation (default: disabled)
  • PROTECTED_PATHS: Comma-separated list of file patterns or paths that cannot be accessed, supporting wildcards

Available Tools

Basic File Operations

set_file

Sets the current file to work with.

Parameters:

  • filepath (str): Absolute path to the file

skim

Reads full text from the current file with line numbers.

Example output:

{
  "lines": [
    [1, "def hello():"],
    [2, "    print(\"Hello, world!\")"],
    [3, ""],
    [4, "hello()"]
  ],
  "total_lines": 4,
  "max_select_lines": 50
}

read

Reads text from specific line range.

Parameters:

  • start (int): Start line number (1-based indexing)
  • end (int): End line number (1-based indexing)

Editing Operations

select

Select a range of lines for editing.

Parameters:

  • start (int): Start line number (1-based)
  • end (int): End line number (1-based)

overwrite

Prepare to overwrite selected lines with new text.

Parameters:

  • new_lines (list): List of new lines to overwrite the selected range

confirm

Apply pending changes from the overwrite operation.

cancel

Discard pending changes from the overwrite operation.

File Management

delete_file

Delete the currently set file.

new_file

Creates a new file.

Parameters:

  • absolute_file_path (str): Path of the new file

listdir

Lists the contents of a directory.

Parameters:

  • dirpath (str): Path to the directory to list

Search and Analysis

find_line

Find lines that match provided text.

Parameters:

  • search_text (str): Text to search for in the file

find_function

Find a function or method definition in Python or JavaScript/JSX files.

Parameters:

  • function_name (str): Name of the function or method to find

Troubleshooting

If you encounter issues:

  1. Check file permissions
  2. Verify that the file paths are absolute
  3. Ensure the environment is using Python 3.7+

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "text-editor" '{"command":"editor-mcp","env":{"MAX_SELECT_LINES":"100","ENABLE_JS_SYNTAX_CHECK":"0","FAIL_ON_PYTHON_SYNTAX_ERROR":"1","FAIL_ON_JS_SYNTAX_ERROR":"0","PROTECTED_PATHS":"*.env,.env*,config*.json,*secret*,/etc/passwd,/home/user/.ssh/id_rsa"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "text-editor": {
            "command": "editor-mcp",
            "env": {
                "MAX_SELECT_LINES": "100",
                "ENABLE_JS_SYNTAX_CHECK": "0",
                "FAIL_ON_PYTHON_SYNTAX_ERROR": "1",
                "FAIL_ON_JS_SYNTAX_ERROR": "0",
                "PROTECTED_PATHS": "*.env,.env*,config*.json,*secret*,/etc/passwd,/home/user/.ssh/id_rsa"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "text-editor": {
            "command": "editor-mcp",
            "env": {
                "MAX_SELECT_LINES": "100",
                "ENABLE_JS_SYNTAX_CHECK": "0",
                "FAIL_ON_PYTHON_SYNTAX_ERROR": "1",
                "FAIL_ON_JS_SYNTAX_ERROR": "0",
                "PROTECTED_PATHS": "*.env,.env*,config*.json,*secret*,/etc/passwd,/home/user/.ssh/id_rsa"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later