Advanced MCP Text Editor Server
Click on "Install 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., "@Advanced MCP Text Editor Serverreplace 'debug: false' with 'debug: true' 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.
Advanced MCP Text Editor Server
Overview
A comprehensive Model Context Protocol (MCP) Text Editor Server that provides advanced file editing capabilities with enhanced security, backup management, and session isolation. Designed for AI assistants like Claude Code, Cursor Agent CLI, and other development environments.
Key Features
š Enhanced Security: Path validation, directory traversal prevention, system file protection
š¾ Automatic Backup Management: Up to 10 backups per file with timestamp tracking
š Comprehensive File Operations: View, create, edit, insert, replace, and undo
š« Smart Error Handling: Detailed error messages and validation
š File Information: Detailed file stats and metadata
ā” High Performance: Optimized for large files with configurable limits
š Undo Capability: Revert recent changes with full backup restoration
Related MCP server: Files MCP Server
Quick Start
Prerequisites
Node.js 18.0 or higher
TypeScript 5.0 or higher
Installation
# Clone and setup
git clone https://github.com/stat-guy/text-editor.git
cd text-editor
# Install dependencies
npm install
# Build the server (REQUIRED - compiles TypeScript to JavaScript)
npm run build
# Test the installation
npm testImportant: Build Process
This project is written in TypeScript but runs as JavaScript:
Source Code:
src/index.ts(human-readable TypeScript)Executable:
dist/index.js(compiled JavaScript - this is what Node.js runs)Build Command:
npm run buildcompilessrc/ādist/
ā ļø Critical: Always use dist/index.js as the entry point, not src/index.ts
Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"text-editor": {
"command": "node",
"args": ["/absolute/path/to/text-editor/dist/index.js"]
}
}
}Note: The path points to dist/index.js (compiled), not src/index.ts (source).
Tools Available
1. view - View Files and Directories
View file contents or list directory contents with optional line range and character limits.
Parameters:
path(string): File or directory pathview_range(optional): Array of [start_line, end_line] for partial viewingmax_characters(optional): Maximum characters to return (default: 100,000)
Examples:
// View entire file
{ "path": "src/index.ts" }
// View specific lines
{ "path": "src/index.ts", "view_range": [10, 50] }
// Limit output size
{ "path": "large-file.txt", "max_characters": 5000 }2. str_replace - Replace Text
Replace specific text in a file with new content. Ensures exactly one match for safety.
Parameters:
path(string): File path to modifyold_str(string): Exact text to replacenew_str(string): Replacement text
Example:
{
"path": "config.json",
"old_str": "\"debug\": false",
"new_str": "\"debug\": true"
}3. create - Create Files
Create new files with specified content. Automatically creates parent directories.
Parameters:
path(string): Path for new filefile_text(string): File content
Example:
{
"path": "docs/new-feature.md",
"file_text": "# New Feature\n\nThis is a new feature documentation."
}4. insert - Insert Text
Insert text at specific line numbers in existing files.
Parameters:
path(string): File path to modifyinsert_line(number): Line number to insert after (0 for beginning)new_str(string): Text to insert
Example:
{
"path": "src/utils.ts",
"insert_line": 5,
"new_str": "// New utility function\nexport function newUtil() { return true; }"
}5. undo_edit - Revert Changes
Revert the last edit made to a file using automatic backups.
Parameters:
path(string): File path to revert
Example:
{ "path": "src/index.ts" }6. file_info - File Information
Get detailed information about files and directories including size, permissions, and backup status.
Parameters:
path(string): File or directory path
Example:
{ "path": "src/index.ts" }Security Features
Path Validation
Prevents directory traversal attacks (
../patterns)Blocks access to system directories (
/etc,/bin,/proc, etc.)Validates all file paths before operations
File Size Limits
Maximum file size: 50MB (configurable)
Character output limits to prevent memory issues
Early validation to prevent resource exhaustion
Backup Management
Automatic backups before any modification
Up to 10 backups per file with rotation
Timestamped backup tracking
Safe undo operations
Performance Characteristics
File Operations: 0.01-0.1 seconds for typical files
Large Files: Optimized handling up to 50MB
Memory Usage: Efficient streaming for large content
Backup Storage: In-memory with automatic cleanup
Error Handling
The server provides detailed error messages for:
Invalid file paths or access denied
File not found or permission errors
Multiple matches in str_replace operations
Invalid line numbers for insert operations
Missing backups for undo operations
Development
Building
npm run build # Build TypeScript to JavaScript
npm run dev # Watch mode for development
npm run clean # Clean build artifactsTesting
npm test # Run basic functionality test
npm start # Start server directlyArchitecture
Core Components
Server Setup: MCP server with STDIO transport
Tool Registration: Zod-based parameter validation
File Operations: Promise-based async file handling
Backup System: In-memory backup store with rotation
Security Layer: Path validation and access control
Project Structure
/Users/kairi/text-editor/
āāā src/
ā āāā index.ts # TypeScript source code (development)
āāā dist/ # Build output (what actually runs)
ā āāā index.js # ā Compiled JavaScript entry point
āāā package.json # Dependencies and build scripts
āāā tsconfig.json # TypeScript compiler configuration
āāā README.md # This documentation
āāā LICENSE # MIT license
āāā examples/ # Usage examples and config
āāā node_modules/ # Dependencies (after npm install)Key Points:
Development: Edit
src/index.tsExecution: Node.js runs
dist/index.jsBuild Process:
npm run buildcompiles TypeScript ā JavaScriptEntry Point: Always use
dist/index.jsfor MCP configuration
Comparison with Anthropic's Text Editor Tool
Feature | Anthropic Tool | This MCP Server |
Basic file operations | ā | ā |
Undo functionality | Limited | ā Enhanced |
Backup management | None | ā Automatic |
Security validation | Basic | ā Advanced |
File size limits | None | ā Configurable |
Error handling | Basic | ā Comprehensive |
File information | None | ā Detailed stats |
Contributing
Fork the repository
Create a feature branch
Implement your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details.
Support
GitHub Issues: Report bugs or request features
Documentation: Full API documentation in
/docsExamples: Usage examples in
/examples
Roadmap
File watching capabilities
Multi-file operations
Advanced search and replace with regex
File encryption support
Integration with version control systems
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables safe file system operations including reading, writing, updating, and deleting files with built-in security safeguards, automatic backups, and comprehensive error handling. Provides directory listing, file metadata extraction, and protects against operations on system-critical paths.Last updated
- Alicense-qualityCmaintenanceEnables AI agents to safely explore directories, read files, search content by pattern or filename, and edit files with checksum verification and dry-run preview within sandboxed filesystem access.Last updated1374ISC
- Alicense-qualityAmaintenanceEnables AI assistants to perform file system operations within a specified project directory, including reading, writing, editing, and managing files, with optional read-only access to reference projects.Last updated50MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to read, write, and manage files on the local system with security features like path restrictions and optional read-only mode.Last updated92MIT
Related MCP Connectors
Securely search and manage workspace context files for AI agents and teams.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Persistent docs and memory for AI agents ā read, write, organize & search a shared workspace.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/stat-guy/text-editor'
If you have feedback or need assistance with the MCP directory API, please join our Discord server