mcedit: Model Context Protocol File Editor
March 16, 2025 · View on GitHub
⚠️ This project is experimental. Features may change without notice. Use with caution! ⚠️
mcedit is a powerful command-line tool that enables AI assistants to edit files and analyze projects through the Model Context Protocol (MCP). It provides a secure bridge between AI models and your local filesystem.
🎮 Demo
See mcedit in action with Claude Desktop:

- Reading and writing any text file
- Analyzing project structures
- Searching and modifying file content
- Creating and managing files and directories
- Applying suggested edits from AI models
🎉 Latest Release
The first stable release of mcedit (v0.1.1) is now available on Crates.io! You can easily install it using Cargo:
cargo install mcedit
Features
-
📝 Universal File Editing Works with any text-based files in any programming language or format.
-
📄 MCP Server Capabilities Runs as a Model Context Protocol server, allowing AI assistants to safely access and modify your files.
-
🔍 Project Analysis Analyzes project structure to provide AI assistants with better context for suggestions.
-
⚡️ Blazing Fast High-speed processing powered by the Rust ecosystem.
-
🔄 Diff Generation Creates and applies diffs to visualize and control changes.
-
🛡️ Built-in Safety Automatic backups before modifications and strict path validation for security.
Installation
From Source
# Clone the repository
git clone https://github.com/yourusername/mcedit
cd mcedit
# Build and install
cargo install --path .
From Crates.io
cargo install mcedit
Requirements
- Rust (edition 2021)
- Claude Desktop or any MCP-compatible AI assistant
Zed File Context Server
This extension provides a Model Context Server for file operations, for use with the Zed AI assistant.
It adds several slash commands to the Assistant Panel to help you work with files and analyze projects.
Configuration
To use the extension, you can optionally set a project directory in your Zed settings.json:
{
"context_servers": {
"file-context-server": {
"settings": {
"project_directory": "/path/to/your/project"
}
}
}
}
If no project directory is specified, the current working directory will be used.
Usage
$ mcedit --help
✨ A CLI tool for smart file editing with AI assistance through the Model Context Protocol (MCP).
Usage: mcedit [OPTIONS] [COMMAND]
Commands:
mcp Launch mcedit as an MCP server
edit Edit a file with the given content
list List files in the project
analyze Analyze the project structure
search Search for text in project files
help Print this message or the help of the given subcommand(s)
Options:
-c, --config <PATH> Path to the configuration file
-d, --dir <PATH> Project directory to work with
-V, --version Print version
-h, --help Print help
Integrating with Claude Desktop
To use mcedit with Claude Desktop:
- If you haven't already, install mcedit:
cargo install mcedit
- Find the path to your installed mcedit executable:
which mcedit
- Add the following configuration to
~/Library/Application\ Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mcedit": {
"command": "/path/to/your/mcedit", // Replace with the actual path from step 2
"args": ["mcp"],
"env": {
"HOME": "/Users/yourusername", // Replace with your username
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"PROJECT_DIR": "/path/to/your/project" // Optional: specify your project directory
}
}
}
}
-
Restart Claude Desktop and enable the mcedit tool.
-
mcedit will automatically create a sample README.md file in
~/projectif no project exists, ensuring Claude can start working with files right away.
Logs and Troubleshooting
The mcedit server logs are available at:
~/Library/Logs/Claude/mcp-server-mcedit.log
Environment Variables
PROJECT_DIR: Set this to specify your project directory. If not set, mcedit will use the directory provided by command line arguments, configuration files, or fall back to~/project. You can also change the project directory at runtime using thechange_directorytool.MCEDIT_LOG_LEVEL: Set todebug,info,warn, orerrorto control logging verbosity.
Security Considerations
When using mcedit, please be aware of the following security considerations:
- mcedit creates automatic backups before modifying files
- Path validation prevents access to files outside the specified project directory
- Review code changes suggested by AI before applying them
- Sensitive information in your files might be accessible to AI assistants
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Attribution
This project is derived from tfmcp, originally developed by nwiizo, under the MIT License.
License
This project is licensed under the MIT License - see the LICENSE file for details.