cancel
Cancel action
A text editor for models that edits in steps — select lines, see a diff preview, then confirm or cancel, with syntax checking before anything is written.
LABSCO SUMMARY
Select, preview, confirm turns an edit into something the model has to look at before committing, and the content id means a stale selection fails instead of overwriting the wrong lines. The 50-line default ceiling pushes edits to stay small rather than becoming whole-file rewrites. Two things to decide before connecting it: PROTECTED_PATHS, because a file editor reaches whatever you do not exclude, and whether run_tests should be available at all, since running a project's tests means running its code.
A FastMCP file editor built around a deliberate workflow: set a file, read it, select a line range, propose replacement lines, review the diff, then commit or discard. Selections carry a SHA-256 content id so an edit cannot land on text that changed underneath it, and Python and JavaScript/JSX files are syntax-checked before the write.
set_file, new_fileskim, readfind_line, find_functionselect, overwrite, confirm, cancellistdir, delete_filerun_tests, set_python_pathNo account and no key — it works on your local filesystem. The package is text-editor (version 0.1.0) and installs the text-editor command; it needs Python 3.11 or later. JavaScript and JSX syntax checking additionally wants Node.js with @babel/core, @babel/cli, @babel/preset-env and @babel/preset-react, and can be switched off with ENABLE_JS_SYNTAX_CHECK. MAX_SELECT_LINES raises the per-edit ceiling from its default of 50, and FAIL_ON_PYTHON_SYNTAX_ERROR and FAIL_ON_JS_SYNTAX_ERROR decide whether a syntax error cancels the write. Set PROTECTED_PATHS before you connect it: it takes a comma-separated list of paths and glob patterns that are denied outright, which is what keeps .env files, key material and anything matching *secret* out of reach.
One command — pip install git+https://github.com/danielpodrazka/mcp-text-editor.git
USE CASES
Locate the function by name to get its exact line range, select those lines, propose the replacement, and read the diff before committing.
Skim the file with line numbers to get the shape of it, then read only the region you intend to change.
Look at the diff preview, discard it, and keep the selection so the next attempt starts from the same lines.
Leave the syntax check on so a proposed edit that would not parse cancels itself and leaves the lines selected for another try.
Run the project's pytest suite from the same session, with the Python path set so imports resolve.
Create a file matching a protected pattern and populate it in one pass — once you move to another file, the protection prevents it being read back.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
cancelCancel action
confirmConfirm action
delete_fileDelete current file
find_functionFind a function or method definition in a Python or JS/JSX file. Uses AST parsers.
find_lineFind lines that match provided text in the current file.
listdirnew_fileCreates a new file.
After creating new file, the first line is automatically selected for editing. Automatically creates parent directories if they don't exist.
overwriteOverwrite the selected lines with new text. Amount of new lines can differ from the original selection
readRead lines from the current file from start line to end line, returning them in a dictionary like {"lines":[[1,"text on first line"],[2,"text on second line"]]}. This makes it easier to find the precise lines to select for editing.
run_testsRun pytest tests using the specified Python virtual environment.
selectSelect lines from for subsequent overwrite operation.
set_fileSet the current file to work with.
This is always the first step in the workflow. You must set a file before you can use other tools like read, select etc.
set_python_pathSet it before running tests so the project is correctly recognized
skimRead text from the current file, truncated to the first SKIM_MAX_LINES lines.
Returns: dict: lines, total_lines, max_select_lines
BEFORE YOU INSTALL
14 tools when we connected.
Python 3.11+
The documented client runs the server on your machine.
CONTEXT COST
Rated by the size of the 14 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
pip install git+https://github.com/danielpodrazka/mcp-text-editor.git{
"mcpServers": {
"text-editor": {
"command": "text-editor",
"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/<YOUR_USERNAME>/.ssh/id_rsa"
}
}
}
}