Readedit
MCP ReadEdit
Why?
Every time an AI coding assistant edits a file, it normally needs two tool calls: one to Read the file, then one to Edit it. Refactoring across 5 files? That's 10 calls. Refactoring across 20? That's 40 calls — each one burning tokens on JSON overhead, waiting for round-trips, and filling up context.
MCP ReadEdit collapses those pairs into single calls. Read+Edit in one shot. Batch edits across many files in one call. The result: 80–95% fewer tool calls, faster completions, and significantly lower token usage.
Combine Read+Edit into single tool calls — 80-95% fewer tool calls for multi-file refactoring.
An MCP server that gives any AI coding assistant batch file operations. Instead of separate Read → Edit calls per file, do it all in one shot.
Related MCP server: agent-lsp
Requirements
Node.js 20+ (recommended: latest LTS)
Quick Start
No install needed — run directly with npx:
npx mcp-readeditOr install globally for faster startup:
npm install -g mcp-readeditThen add it to your MCP client (see Client Setup below).
Client Setup
Claude Desktop
Add to ~/.claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"readedit": {
"command": "npx",
"args": ["mcp-readedit"]
}
}
}Claude Code
claude mcp add readedit -- npx mcp-readeditCursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"readedit": {
"command": "npx",
"args": ["mcp-readedit"]
}
}
}Windsurf
Go to Settings → MCP Servers and add:
{
"readedit": {
"command": "npx",
"args": ["mcp-readedit"]
}
}Cline (VS Code Extension)
In Cline settings, add to MCP Servers:
{
"readedit": {
"command": "npx",
"args": ["mcp-readedit"]
}
}Continue
Add to .continue/config.yaml:
mcpServers:
- name: readedit
command: npx
args:
- mcp-readeditZed
Add to your Zed settings.json:
{
"context_servers": {
"readedit": {
"command": "npx",
"args": ["mcp-readedit"]
}
}
}Tools
Tool | What it does |
| Read a file, optionally edit it — 1 call instead of 2 |
| Edit multiple files at once |
| Read + optionally edit multiple files — the powerhouse |
| Show your token savings statistics |
read_edit — Single file read + optional edit
Read a file and optionally replace text in one call. Returns file content.
{
"file_path": "/absolute/path/to/file.ts",
"old_string": "text to replace",
"new_string": "replacement text"
}Options: use_regex (boolean), replace_all (boolean), offset (line number), limit (line count). Omit old_string/new_string to just read.
multi_edit — Edit multiple files
Batch edits across files in a single call. Use when you already have the file contents.
{
"edits": [
{ "file_path": "/path/a.ts", "old_string": "foo", "new_string": "bar" },
{ "file_path": "/path/b.ts", "old_string": "baz", "new_string": "qux", "replace_all": true }
]
}multi_read_edit — Read + edit multiple files
The most powerful tool. Read and optionally edit any number of files in one call.
{
"operations": [
{ "file_path": "/path/a.ts" },
{ "file_path": "/path/b.ts", "old_string": "old", "new_string": "new" },
{ "file_path": "/path/c.ts", "old_string": "\\d+", "new_string": "0", "use_regex": true }
]
}Options: include_content (boolean, default false) and include_original (boolean, default false) control what's returned.
get_gain — Token savings stats
{ "breakdown": "summary" }Breakdown types: summary (default), daily, recent, all.
Before / After
Refactoring a feature across 9 files:
Without MCP ReadEdit — 52 tool calls:
Read file1 → Edit file1 → Read file2 → Edit file2 → ... → Read file9 → Edit file9
28 Edit + 19 Read + 5 Write = 52 callsWith MCP ReadEdit — 4 tool calls:
multi_read_edit (files 1-3) → multi_read_edit (files 4-6) → multi_read_edit (files 7-9) → multi_edit (final batch)Result: 48 calls saved (~9,600 tokens)
How Gain Tracking Works
Each tool call is recorded to a local SQLite database. The tracker calculates what it would have taken with standard Read+Edit calls:
read_editwith edit: 2 standard calls → 1 optimized callmulti_edit(N files): 2N standard calls → 1 optimized callmulti_read_edit(N files): 2N standard calls → 1 optimized call
Token savings are estimated at ~200 tokens per avoided call (JSON overhead, tool result wrapping). The database auto-creates on first use.
CLI Usage
If installed globally (npm install -g mcp-readedit), the readedit command gives terminal access to gain stats:
readedit gain # Summary
readedit gain --daily # Day-by-day breakdown
readedit gain --recent 20 # Last 20 operations
readedit gain --all # All breakdowns
readedit gain --format json # JSON export
readedit gain --reset # Reset statisticsWorks with npx too: npx mcp-readedit starts the server, readedit gain runs the CLI.
AGENTS.md / CLAUDE.md Integration
Add these instructions to your project's CLAUDE.md, AGENTS.md, or .cursorrules to make your AI coding assistant automatically use ReadEdit tools:
## File Operations — MCP ReadEdit
When reading or editing files, ALWAYS prefer MCP ReadEdit tools over separate Read + Edit calls.
### Tool Selection
- **multi_read_edit**: Read and/or edit multiple files (most common — use for any multi-file task)
- **multi_edit**: Edit multiple files when you already have their contents
- **read_edit**: Single file read-only or read+edit
- **get_gain**: Check token savings statistics
### Rules
1. NEVER use separate Read then Edit calls when ReadEdit tools are available
2. Batch file operations: group related files into a single multi_read_edit call
3. Use `use_regex: true` for pattern-based replacements
4. Read-only operations in multi_read_edit always return file content — no need to separately read files first
5. When refactoring across multiple files, plan all edits first, then execute in one multi_read_edit callFor global usage (all projects), add to ~/.claude/AGENTS.md instead.
Contributing
git clone https://github.com/abnersajr/mcp-readedit.git
cd mcp-readedit
npm install
npm testIssues and PRs welcome at github.com/abnersajr/mcp-readedit.
License
MIT
Available Tools
3 toolsmulti_editA
Edit multiple files when you already have their contents in context. ALWAYS use this instead of multiple separate edit calls. Each edit uses exact string or regex replacement. For read+edit combos, use multi_read_edit instead.
Inputs: edits (required).
multi_read_editA
Read and optionally edit multiple files in one call. ALWAYS batch multi-file operations here instead of separate read_file/edit calls. Read-only ops return file content. Edit ops return compact results by default (no content) to save tokens — set include_content=true to get post-edit content, include_original=true for diffing.
Inputs: operations (required), include_content, include_original.
read_editA
Read a file and optionally edit it in one call. For single-file tasks, use this instead of separate read_file + edit calls. Returns file content. Edit params (old_string, new_string) are optional — omit them for read-only.
Inputs: file_path (required), old_string, new_string, use_regex, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: multi_edit for editing multiple files (no reading), multi_read_edit for reading and optionally editing multiple files, and read_edit for single-file read+edit. No overlap.
All tools follow a consistent verb_noun pattern in snake_case: multi_edit, multi_read_edit, read_edit. The naming clearly communicates the function (edit vs read_edit) and scope (multi vs single).
With only 3 tools, the set is minimal but well-scoped for the server's focused purpose of reading and editing files. It's slightly on the low end but still reasonable.
The tool set covers all expected operations: reading, editing, single-file, multi-file, and combined read+edit. No obvious gaps for the stated domain of file editing.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP Server for persistent code indexing. Gives AI assistants (Claude, Gemini, Copilot, Cursor) instant access to your codebase. 50x less context than grep.22500 npm48MIT
- AlicenseAqualityAmaintenanceMCP server that keeps language server sessions warm and routes multiple languages through one process. Agents get persistent cross-file awareness, speculative execution (simulate edits before writing to disk), and 20 skills that encode correct multi-step operations like safe rename, blast-radius analysis, and end-to-end refactoring. Single Go binary, no runtime dependencies.50180MIT
- AlicenseAqualityBmaintenanceMCP server that reduces token consumption in AI coding assistants by up to 90% via structural reads, PreToolUse hooks, and tp-\* subagents.25280 npm5MIT
- AlicenseBqualityBmaintenanceAgent-optimized MCP server that replaces built-in file, search, exec, and git tools with compact, structured JSON equivalents. Benchmarked 20–45% token savings for AI coding agents.203MIT