Mcp Multi Edit

io.github.eaisdevelopment由 GitHub 账号 eaisdevelopment 发布v0.2.7更新于 Oct 24, 2026

Atomic multi-file find-and-replace by Essential AI Solutions (essentialai.uk)

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让助手在单次原子调用中,对一个或多个文件批量执行多处查找替换编辑。

可以做什么
在单个文件上按顺序原子地执行多处查找替换,支持全部替换、试运行预览,并默认生成 .bak 备份。跨多个文件协调编辑,任一文件失败时自动回滚所有已修改的文件。提交前可用试运行预览具体改动,并在查找文本匹配多处时收到结构化错误码、恢复提示和冲突警告。
适用场景
适合重命名变量、迁移日志调用或跨多个文件重构等场景,此时内置的单次编辑工具需要大量单独调用。它能减少批量编辑的工具调用次数和上下文 token 消耗。
运行要求
通过 npx 从 npm 包 @essentialai/mcp-multi-edit 以 stdio 在本地运行。需要 Node.js 20 或更高版本,以及 Claude Code 或 Claude Desktop。未声明认证、环境变量或请求头。
安装前请注意
它会写入本机文件:编辑会直接修改文件,但默认创建备份,也可用试运行预览改动。它要求绝对路径并会解析符号链接。关闭备份后,失败或误操作的编辑将失去恢复保障。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Multi Edit,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Multi Edit MCP Server

[npm version] [license] [tests] [coverage]

An MCP server that gives Claude the ability to perform multiple find-and-replace operations in a single tool call with guaranteed atomicity -- all edits succeed or none apply.

Built by Essential AI Solutions for Claude Code and Claude Desktop.

Why Multi Edit?

Claude's built-in Edit tool handles one find-and-replace per call. When renaming a variable across a file or refactoring multiple files, that means dozens of individual tool calls -- each consuming context tokens and adding latency.

Multi Edit batches them into a single call:

Without multi_edit:      105 tool calls   |   15,750 tokensWith multi_edit:          21 tool calls   |    7,850 tokens   (-80% calls, -50% tokens)With multi_edit_files:     6 tool calls   |    4,550 tokens   (-94% calls, -71% tokens)

Benchmarks run on realistic scenarios (bulk rename, logging migration, cross-file refactor). See benchmarks/results/BENCHMARK-REPORT.md for full details.

Quick Start

Claude Code

Add .mcp.json to your project root:

json
{  "mcpServers": {    "Multi Edit from Essential AI Solutions (essentialai.uk)": {      "command": "npx",      "args": ["-y", "@essentialai/mcp-multi-edit"]    }  }}

Restart Claude Code. Then add the included CLAUDE.md to your project root so Claude automatically prefers multi_edit over the built-in Edit tool:

markdown
## Editing Files
When making multiple edits to the same file or across multiple files,prefer using the `multi_edit` and `multi_edit_files` MCP tools overthe built-in Edit tool. These batch edits atomically in a single call.

That's it -- Claude will now use multi_edit whenever it's the right tool for the job.

Display name: Claude Code uses the key name in mcpServers as the server's display name. You can change the key to any name you prefer.

Alternative: One-liner via CLI:

bash
claude mcp add --transport stdio multi-edit -- npx -y @essentialai/mcp-multi-edit

Note: The CLI only accepts simple names (letters, numbers, hyphens, underscores). For the full branded display name, use the .mcp.json approach above.

Claude Desktop

Add to your config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

json
{  "mcpServers": {    "Multi Edit from Essential AI Solutions (essentialai.uk)": {      "command": "npx",      "args": ["-y", "@essentialai/mcp-multi-edit"]    }  }}

Restart Claude Desktop.

Full installation guide: docs/installation.md

Tools

multi_edit -- Single file, multiple edits

Batch multiple find-and-replace operations on one file. Edits apply sequentially and atomically.

json
{  "file_path": "/project/src/app.ts",  "edits": [    { "old_string": "const oldName = getValue()", "new_string": "const newName = getValue()" },    { "old_string": "console.log", "new_string": "logger.info", "replace_all": true }  ]}
ParameterTypeDefaultDescription
file_pathstringrequiredAbsolute path to the file
editsarrayrequiredFind-and-replace operations (applied in order)
edits[].old_stringstringrequiredText to find (exact match)
edits[].new_stringstringrequiredReplacement text
edits[].replace_allbooleanfalseReplace all occurrences
dry_runbooleanfalsePreview changes without applying
backupbooleantrueCreate .bak backup before editing

multi_edit_files -- Multiple files, one atomic operation

Coordinate edits across multiple files. If any file fails, all files are rolled back automatically.

json
{  "files": [    {      "file_path": "/project/src/types.ts",      "edits": [        { "old_string": "interface UserData {", "new_string": "interface UserProfile {" }      ]    },    {      "file_path": "/project/src/api.ts",      "edits": [        { "old_string": "UserData", "new_string": "UserProfile", "replace_all": true }      ]    }  ]}
ParameterTypeDefaultDescription
filesarrayrequiredArray of file edit operations
files[].file_pathstringrequiredAbsolute path to the file
files[].editsarrayrequiredEdits for this file (same format as above)
dry_runbooleanfalsePreview changes without applying

Full usage guide with examples: docs/usage.md

Features

  • Atomic operations -- all edits succeed or none apply, no partial state
  • Multi-file rollback -- if any file fails, all previously changed files are restored
  • Dry-run preview -- see exactly what would change before committing
  • Automatic backups -- .bak files created before every edit (disable with backup: false)
  • Structured errors -- machine-readable error codes with recovery hints for automatic retry
  • Conflict detection -- warns when old_string matches multiple locations
  • Path validation -- absolute path enforcement, symlink resolution, existence checks

Error Codes

CodeRetryableDescription
MATCH_NOT_FOUNDYesold_string not found in file
AMBIGUOUS_MATCHYesold_string matches multiple locations
VALIDATION_FAILEDYesInvalid input schema
FILE_NOT_FOUNDNoFile does not exist
PERMISSION_DENIEDNoInsufficient file permissions
BACKUP_FAILEDNoCould not create backup file

When retryable is true, Claude reads the recovery_hints in the response, adjusts the input, and retries automatically.

Troubleshooting guide: docs/troubleshooting.md

Requirements

  • Node.js 20 or later
  • Claude Code or Claude Desktop

Development

bash
npm install           # Install dependenciesnpm run build         # Compile TypeScriptnpm test              # Run 264 testsnpm run test:coverage # Coverage report (90%+)npm run benchmark     # Run benchmark suitenpm run dev           # Watch mode

Project Structure

src/  index.ts              # MCP server entry (stdio transport)  server.ts             # Server factory and tool registration  tools/    multi-edit.ts       # multi_edit tool handler    multi-edit-files.ts # multi_edit_files tool handler  core/    editor.ts           # File editing engine (atomic read-modify-write)    validator.ts        # Zod input validation schemas    reporter.ts         # Result formatting and diff generation    errors.ts           # Error classification and envelope creation  types/    index.ts            # TypeScript type definitions

Documentation

DocumentDescription
Installation GuideAll setup options for Claude Code and Claude Desktop
Usage GuideDetailed tool reference with examples
TroubleshootingCommon issues and solutions
ChangelogVersion history
Benchmark ReportPerformance measurements

License

PolyForm Noncommercial License 1.0.0

Free for personal and non-commercial use. For commercial licensing, contact [email protected].


Built by Essential AI Solutions

来源:README.md,提交 53fb3e7

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.7最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。