Skip to main content
Glama
abnersajr
by abnersajr

MCP ReadEdit

npm version CI License: MIT

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-readedit

Or install globally for faster startup:

npm install -g mcp-readedit

Then 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-readedit

Cursor

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-readedit

Zed

Add to your Zed settings.json:

{
  "context_servers": {
    "readedit": {
      "command": "npx",
      "args": ["mcp-readedit"]
    }
  }
}

Tools

Tool

What it does

read_edit

Read a file, optionally edit it — 1 call instead of 2

multi_edit

Edit multiple files at once

multi_read_edit

Read + optionally edit multiple files — the powerhouse

get_gain

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 calls

With 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_edit with edit: 2 standard calls → 1 optimized call

  • multi_edit (N files): 2N standard calls → 1 optimized call

  • multi_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 statistics

Works 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 call

For 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 test

Issues and PRs welcome at github.com/abnersajr/mcp-readedit.

License

MIT

Available Tools

3 tools
multi_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.

ParametersJSON Schema
NameRequiredDescriptionDefault
editsYes

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description must carry the full burden. It mentions exact string/regex replacement but omits critical behavioral details like file existence handling, permissions, atomicity, or success/failure feedback.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences with no redundancy. The first states purpose and precondition, the second gives a strong recommendation, and the third directs to an alternative. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description lacks details on return behavior, error handling, whether edits are sequential or atomic, and how file contexts are managed. Incomplete for an agent to use reliably.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, requiring the description to compensate. It only references regex replacement, ignoring file_path, replace_all, and the array structure of edits, leaving parameter semantics under-explained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool edits multiple files using string/regex replacement, and distinguishes itself from siblings like multi_read_edit by specifying when to use each.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to use when contents are in context and ALWAYS instead of multiple separate edit calls. Also directs to multi_read_edit for read+edit combos, providing clear when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
operationsYes
include_contentNoInclude full file content in edit results (default: false for token savings)
include_originalNoInclude original pre-edit content in edit results (default: false)

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description discloses default token-saving behavior for edit ops, and explains optional parameters for content retrieval. Could mention error handling or auth, but overall good for a tool of this type.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with purpose, then usage rule, then behavioral detail. No wasted words, very efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, usage pattern, return behavior, and optional parameters. Lacks error handling or file path details, but sufficient given schema provides nested param definitions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Adds meaning beyond schema: explains include_content and include_original usage for retrieving content or diffs, and reinforces that read-only ops return content. Operations parameter is explained in context of batching, though schema covers nested fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Read and optionally edit multiple files in one call' with verb+resource, and distinguishes from sibling tools by instructing to batch multi-file operations here instead of separate calls.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'ALWAYS batch multi-file operations here instead of separate read_file/edit calls', providing clear context for use. However, no explicit 'when not to use' guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file
old_stringNoText to replace (exact match or regex if use_regex=true)
new_stringNoText to replace with
use_regexNoTreat old_string as regex (default: false)
replace_allNoReplace all occurrences (default: false)
offsetNoLine number to start reading from (optional)
limitNoNumber of lines to read (optional)

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that the tool can read or edit, and that edit params are optional for read-only use. However, it lacks details on mutation effects (e.g., whether edits are permanent, required permissions, error handling on edit failure), leaving important behavioral aspects undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, consisting of only two sentences that are front-loaded with the core purpose. Every sentence adds unique value without redundancy, making it efficient for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, combination of read and edit operations) and the absence of an output schema, the description is moderately complete. It states that it 'Returns file content' but does not specify the format or behavior when editing fails. More details on error states or return structure would enhance completeness for reliable tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All 7 parameters are fully described in the input schema (100% coverage), so the schema already provides clear semantics. The description adds minimal value by clarifying that old_string and new_string are optional and can be omitted for read-only behavior, which is already implied by the schema's 'required' field. This slight addition does not significantly elevate understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool reads and optionally edits a file in one call, using a specific verb ('Read') and resource ('file'). It distinguishes itself from sibling tools like multi_edit by specifying 'single-file tasks', providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises using this tool for single-file tasks instead of separate read_file and edit calls, offering clear when-to-use guidance. This effectively sets usage context and implies alternatives, making it easy for an AI agent to decide when to select this tool over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv1.3.0
    • First observedmulti_edit
    • First observedmulti_read_edit
    • First observedread_edit

TDQS

A4.2/5.0
Disambiguation5/5

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.

Naming Consistency5/5

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).

Tool Count4/5

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.

Completeness5/5

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

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    MCP 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.
    50
    121
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Agent-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.
    20
    2
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abnersajr/mcp-readedit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server