MCP SmallEdit
Allows processing and editing JavaScript files with targeted modifications using tools like sed and awk, supporting operations such as version bumping, import path updates, and debug code removal.
Supports package.json management for npm packages, particularly for version bumping and dependency updates through targeted text replacement.
Enables precise editing of TypeScript files including modifying imports, fixing formatting, and updating configuration values without rewriting entire files.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP SmallEdit replace all occurrences of 'localhost' with 'production.server.com' in config.json"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP SmallEdit
A Model Context Protocol (MCP) server that provides tools for making small, targeted edits to files using stream editors like sed and awk.
Why SmallEdit?
When making minor changes to files (fixing typos, updating version numbers, changing config values), using full file replacement is inefficient. SmallEdit provides targeted editing capabilities that:
Save tokens by only specifying what to change
Reduce errors by not rewriting entire files
Enable bulk operations across multiple files
Provide preview capabilities before applying changes
Related MCP server: MCP File Editor Server
Installation
npm install -g @bard/mcp-smalleditTools Available
1. sed_edit
Make small edits using sed patterns.
Examples:
// Replace all occurrences
sed_edit({
file: "package.json",
pattern: "s/0.1.0/0.2.0/g"
})
// Delete lines containing pattern
sed_edit({
file: "config.ts",
pattern: "/DEBUG_MODE/d"
})
// Preview changes first
sed_edit({
file: "index.ts",
pattern: "s/foo/bar/g",
preview: true
})2. sed_multifile
Apply patterns to multiple files.
Examples:
// Update imports across all TypeScript files
sed_multifile({
pattern: "s/'.\\//src\\//g",
filePattern: "*.ts",
directory: "src"
})
// Remove console.log from all JS files
sed_multifile({
pattern: "/console\\.log/d",
filePattern: "*.js"
})3. quick_replace
Simple find and replace without regex.
Examples:
// Replace text literally
quick_replace({
file: "README.md",
find: "version 1.0",
replace: "version 2.0"
})
// Replace only first occurrence
quick_replace({
file: "config.json",
find: "localhost",
replace: "production.server.com",
all: false
})4. line_edit
Edit specific lines by number.
Examples:
// Replace line 42
line_edit({
file: "index.ts",
lineNumber: 42,
action: "replace",
content: "export const VERSION = '2.0.0';"
})
// Delete lines 10-20
line_edit({
file: "test.ts",
lineRange: "10,20",
action: "delete"
})
// Insert after line 5
line_edit({
file: "imports.ts",
lineNumber: 5,
action: "insert_after",
content: "import { newModule } from './new-module';"
})5. awk_process
Process files with AWK for complex operations.
Examples:
// Sum numbers in second column
awk_process({
file: "data.csv",
script: "{sum += $2} END {print sum}"
})
// Extract specific columns
awk_process({
file: "data.tsv",
script: "{print $1, $3}",
outputFile: "extracted.txt"
})Configuration
Add to your MCP client config:
{
"mcpServers": {
"smalledit": {
"command": "mcp-smalledit"
}
}
}Common Use Cases
Version Bumping
sed_edit({
file: "package.json",
pattern: 's/"version": "[^"]*"/"version": "1.2.3"/g'
})Update Import Paths
sed_multifile({
pattern: "s|'@old/package|'@new/package|g",
filePattern: "*.ts"
})Remove Debug Code
sed_multifile({
pattern: "/\\/\\/\\s*DEBUG:/d",
filePattern: "*.js"
})Fix Formatting
// Add missing semicolons
sed_multifile({
pattern: "s/^\\([^;]*\\)$/\\1;/",
filePattern: "*.ts"
})Safety Features
Automatic Backups: Creates
.bakfiles by defaultPreview Mode: Test patterns before applying
Error Handling: Clear error messages for invalid patterns
File Validation: Checks file existence before editing
Notes
All file paths are relative to the current working directory
Backup files (
.bak) are created by default unless disabledUse preview mode to test complex patterns
Escape special characters appropriately in patterns
License
MIT -e
Known Issues
Pattern Delimiters
When using path replacements, use pipe delimiter instead of forward slash to avoid quoting issues:
// ❌ Problematic with paths
sed_edit({ pattern: "s/old/path/new/path/g" })
// ✅ Works correctly
sed_edit({ pattern: "s|old/path|new/path|g" })Available Tools
10 toolsawk_processC
Process files using AWK for more complex operations like column manipulation, calculations, or conditional processing
Inputs: file (required), script (required), outputFile.
diff_previewC
Preview what changes would be made by showing a diff
Inputs: file (required), command (required), tool.
helpB
Get detailed help and examples for smalledit tools
Inputs: tool.
line_editC
Edit specific lines by number or range
Inputs: file (required), action (required), lineNumber, lineRange, +1 more.
list_backupsC
List all backup files in a directory
Inputs: directory, pattern.
perl_editB
Edit files using Perl one-liners (more powerful than sed, better cross-platform support)
Inputs: file (required), script (required), backup, multiline.
quick_replaceA
Simple find and replace across a file without regex
Inputs: file (required), find (required), replace (required), all.
restore_backupC
Restore a file from its most recent backup (.bak)
Inputs: file (required), keepBackup.
sed_editB
Make small edits to files using sed patterns. Efficient for single-line changes, pattern replacements, and simple text transformations.
Inputs: file (required), pattern (required), backup, preview.
sed_multifileC
Apply sed pattern to multiple files matching a glob pattern
Inputs: pattern (required), filePattern (required), directory, backup.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have distinct purposes, but there is some overlap between sed_edit and perl_edit as both handle text editing with different engines, and awk_process also overlaps in processing capabilities. The descriptions help clarify differences, but an agent might occasionally confuse these for similar tasks.
The naming follows a consistent snake_case pattern with clear verb_noun or noun_verb structures, such as awk_process, diff_preview, and line_edit. Minor deviations exist, like 'help' being a single word and 'quick_replace' using an adjective, but overall it's readable and predictable.
With 10 tools, the count is well-scoped for a file editing utility server. Each tool serves a specific function, such as editing, backup management, or help, without redundancy, making it appropriate for the domain's complexity.
The tool set covers core file editing operations, backup management, and help, but there are minor gaps, such as no direct tool for creating or deleting files, which agents might need to work around. However, it supports common workflows like editing, diffing, and restoring backups effectively.
Maintenance
Related MCP Connectors
Exact text tools for AI agents: unified diff, patch apply, regex testing, grapheme counting.
JSON/YAML, regex, diff, JWT, SQL dialects — the keyless millisecond ops an agent needs mid-task.
Edit PDF text in place, fonts and layout kept. Compress, merge, split, convert and translate PDFs.
AI document editing: edits the exact section, leaves the rest. 38 MCP tools; agent self-signup.
Related MCP Servers
- AlicenseAqualityAmaintenanceA line-oriented text file editor. Optimized for LLM tools with efficient partial file access to minimize token usage.6202MIT
- AlicenseAqualityDmaintenanceEnables comprehensive file operations including reading, writing, searching, and editing files with advanced features like regex-based replacements, line-specific modifications, and directory-wide search capabilities. Provides 8 robust tools for safe file manipulation with content verification and detailed error handling.825 npm2MIT
- AlicenseAqualityNot gradedmaintenanceEnables agents to quickly find and edit code in a codebase with surgical precision. Find symbols, edit them everywhere with tools for reading code blocks, searching/replacing text, and making precise line-based modifications.311 npm-
- AlicenseAqualityBmaintenanceEnables reading, creating, and editing files on the local filesystem through operations like view, create, string replacement, and line insertion.4168 npm3MIT