SSyncDev

edit-mcp Server

A single C++17 binary that gives agents precise line, range and search-replace file edits, with dry-run diffs.

Local server

What is the edit-mcp Server?

Most agent edit failures are small. A replacement hits the wrong occurrence, indentation drifts, or a second edit shifts the line numbers the third one depended on. The edit-mcp MCP server is a compact answer to those problems: one C++17 binary, no runtime dependencies, offering a handful of tightly specified edit and read operations.

Edits that behave predictably

Coordinates are 1-based and columns count characters, not bytes. On top of that, a few rules do the heavy lifting:

  • Replacing lines carries over the indentation of the line being replaced, while keeping relative indentation inside multi-line content
  • multi_replace measures every coordinate against the file as it was before the call, so batched edits cannot shift each other; overlaps are rejected and each file succeeds or fails as a whole
  • Every write tool accepts dryRun and returns a before-and-after diff
  • Writes are atomic through a temp file and rename, CRLF and BOM are preserved, and binary or non-UTF-8 files are refused

Regex replacements use ECMAScript syntax with capture references, match per line by default, and can span lines with the s flag.

Tool set

Tool Purpose
replace_content Literal or regex search-and-replace, all matches or a chosen occurrence
replace_lines / delete_lines Rewrite or remove a line span
replace_range Replace by line and column positions; zero length inserts
multi_replace Mixed edits across several files in one call
get_content, get_lines, get_range, multi_get Read with coordinates and context

The same operations exist as CLI commands, which helps agents that lack MCP support and must work through a shell.

Building and connecting

Build with make (or CMake), or use the install script, which picks a release binary for Linux x64 and arm64, macOS arm64 or Android arm64 and prints the MCP config. Termux needs the Android build specifically. Run with no arguments, the edit-mcp MCP server speaks stdio. edit-mcp config --agent claude prints a ready config with the absolute path filled in; there are formats for opencode and Codex too.

Sandboxing and the bundled skill

Pass --root with a directory to confine every path to that folder, symlinks resolved. Without it, relative, absolute and home-relative paths all work, so set a root if you want a boundary. An embedded skill file teaching tool choice and indentation rules can be installed for Claude Code and other skill-aware agents.

This is a file editor only; it does not run Git or commands. Pair it with a Git server for history, or browse more version control and developer tools.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
replace_contentSearch and replace, literal by default or ECMAScript regex; all matches unless limited to one occurrence.
replace_linesReplace a line span with new content, applying the original line's indentation automatically.
delete_linesDelete a line span including its newline.
replace_rangeReplace text by line and column positions; a length of zero inserts.
multi_replaceApply many content, line and range edits across files, with coordinates fixed to the pre-call file and per-file all-or-nothing writes.
get_contentFind text and return line:column positions, captures and context lines.
get_linesRead lines with line numbers, or raw.
get_rangeRead a character range with coordinates.
multi_getPerform several reads in one call.

How to install the edit-mcp Server

claude mcp add edit -- /path/to/edit-mcp

Configuration

VariableDescriptionRequired
EDIT_MCP_REPOOverrides the repository install.sh downloads release binaries from.Optional
EDIT_MCP_VERSIONPins the release version install.sh installs.Optional

Frequently asked questions

Yes. Every write tool accepts dryRun and returns a before-and-after diff without changing the file.