Model Context Protocol (MCP) server that offers line-oriented text-file editing via a standardized API, optimized for LLM tools through token-efficient partial-file access.
https://github.com/tumf/mcp-text-editorStop loading entire files into your LLM context when you only need to edit a few lines. This MCP server gives you surgical file editing with intelligent partial loading that can slash your token usage by 90% while keeping your edits safe from conflicts.
When you're working with LLMs on code or text files, you're probably doing this:
That's 4000+ tokens for what should be a 200-token operation. Plus zero protection against concurrent edits that could overwrite your changes.
Instead of dumping whole files into context, specify exactly what you need:
{
"file_path": "large_config.py",
"line_start": 45,
"line_end": 60,
"encoding": "utf-8"
}
Get back just those 15 lines with metadata you need for safe editing. For a 500-line file, that's ~300 tokens instead of 3000.
Multi-file, multi-range requests let you grab specific sections from multiple files in one operation:
{
"files": [
{
"file_path": "app.py",
"ranges": [
{"start": 1, "end": 20}, // imports
{"start": 100, "end": 150} // specific function
]
},
{
"file_path": "config.py",
"ranges": [{"start": 45, "end": 60}]
}
]
}
Perfect for LLM workflows where you need context from related functions across multiple files without loading everything.
Every file operation uses SHA-256 hashes to detect conflicts before they corrupt your work:
{
"files": [{
"file_path": "app.py",
"hash": "sha256-current-file-hash",
"patches": [{
"start": 45,
"end": 50,
"range_hash": "sha256-hash-of-lines-being-replaced",
"contents": "new code here\n"
}]
}]
}
Patches apply bottom-to-top automatically, so line numbers stay correct even with multiple edits.
Code Reviews: Load just the changed functions from a PR instead of entire files
uvx mcp-text-editor
# Then pull specific line ranges from modified files
Log Analysis: Extract specific time ranges from massive log files without reading everything
{"file_path": "app.log", "line_start": 1500, "line_end": 1600}
Configuration Updates: Edit specific sections of config files while preserving comments and structure
{
"start": 25, "end": 30,
"contents": "# Updated config\nDEBUG=False\nPORT=8080\n"
}
Collaborative Editing: Multiple developers/LLMs can work on different parts of the same file safely
Add to your Claude desktop config and start using immediately:
{
"mcpServers": {
"text-editor": {
"command": "uvx",
"args": ["mcp-text-editor"]
}
}
}
Or install via Smithery: npx -y @smithery/cli install mcp-text-editor --client claude
docker run -i --rm --mount "type=bind,src=/path,dst=/path" mcp/text-editorThe line-oriented approach means you can precisely target specific functions, classes, or configuration blocks instead of working with entire files. Your LLM gets exactly the context it needs, nothing more.
This isn't just another file editor - it's designed specifically for the token economics and safety requirements of LLM-assisted development workflows.