Labsco
MCP SERVER

Editor MCP

by danielpodrazka

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.

Local Filesystem AccessVerified
Summary
The extra steps are the feature.

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.

What it is

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.

What you get
  • A working file set by absolute path, and a new file created with its parent directories and its first line pre-selected — `set_file`, `new_file`
  • The whole file read with line numbers, or a specific line range, so edits are addressed by number rather than by guessing at matching text — `skim`, `read`
  • Text located by exact match, and a function or method located by name — Python via the AST and tokenize modules including decorators and docstrings, JavaScript and JSX via Babel with a regex fallback — `find_line`, `find_function`
  • The edit itself as four separate steps: select a range, propose new lines and get a git-style diff preview back, then apply or discard — `select`, `overwrite`, `confirm`, `cancel`
  • Directory contents listed, and the current file deleted — `listdir`, `delete_file`
  • Python tests run with pytest and the interpreter path configured for module resolution — `run_tests`, `set_python_path`
Requirements

No account and no key — it works on your local filesystem. The package is `text-editor` (0.1.0 in pyproject) and installs the `editor-mcp` command; Python 3.7+. 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.

Setup effort

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