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.
# 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
# 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 .
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 .
uv pip install -r uv.lock
After installation, start the Editor MCP server:
# Using the installed script
editor-mcp
# Or using the Python module
python -m text_editor.server
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"
}
}
}
}
Customize the Editor MCP behavior with these environment variables:
set_file
Sets the current file to work with.
Parameters:
filepath
(str): Absolute path to the fileskim
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)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 rangeconfirm
Apply pending changes from the overwrite operation.
cancel
Discard pending changes from the overwrite operation.
delete_file
Delete the currently set file.
new_file
Creates a new file.
Parameters:
absolute_file_path
(str): Path of the new filelistdir
Lists the contents of a directory.
Parameters:
dirpath
(str): Path to the directory to listfind_line
Find lines that match provided text.
Parameters:
search_text
(str): Text to search for in the filefind_function
Find a function or method definition in Python or JavaScript/JSX files.
Parameters:
function_name
(str): Name of the function or method to findIf you encounter issues:
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.
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.
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"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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