MCP Text Editor Server logo

MCP Text Editor Server

by nathanonn

The MCP Text Editor Server implements Anthropic's text editor tool functionality, allowing Claude and other MCP clients to read and modify files within a specified directory. It provides a secure and versatile way to interact with files programmatically.

View on GitHub

Last updated: N/A

What is MCP Text Editor Server?

The MCP Text Editor Server is a Model Context Protocol (MCP) server that emulates Anthropic's text editor tool, enabling AI models like Claude to interact with and manipulate files within a designated directory. It provides a set of commands for viewing, editing, creating, and managing files.

How to use MCP Text Editor Server?

To use the server, you need to install the necessary dependencies (Node.js, TypeScript), compile the TypeScript code, and then run the server, specifying the working directory. You can then integrate it with Claude for Desktop by adding the server's configuration to the Claude configuration file. The server can then be used via commands from Claude.

Key features of MCP Text Editor Server

  • View file content and directory listings

  • Precise text replacements

  • Edit blocks of code by line numbers

  • Insert new content at specific line numbers

  • Create new files or overwrite existing ones

  • Restore files from backups

  • Path validation for security

  • Automatic backups before modifications

Use cases of MCP Text Editor Server

  • Automated code refactoring

  • Programmatic file editing and manipulation

  • AI-assisted code debugging

  • Generating configuration files

  • Updating documentation

  • Content creation and management

FAQ from MCP Text Editor Server

What is the default working directory if I don't specify one?

If you don't specify a directory, it defaults to ./texteditor-data.

How do I revert changes made to a file?

Use the undo_edit command with the file path to restore the file to its state before the last modification.

What security measures are in place?

The server includes path validation to ensure operations stay within the base directory, automatic backups before modifying files, and clear error messages for failed operations.

Can I use this server with other MCP clients besides Claude?

Yes, the server is designed to work with any MCP client that supports the specified commands.

How do I specify a line range to view in a file?

Use the view_range parameter with an array of two integers specifying the start and end line numbers (1-indexed). Use -1 for the end line to read to the end of the file.