mcp-text-editor

v1.2.2
mcp-text-editor Checked 4 days ago Published 2 months ago

MCP Text Editor Server - Edit text files via MCP protocol

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_text_file_contents

Read text file contents from multiple files and line ranges. Returns file contents with hashes for concurrency control and line numbers for reference. The hashes are used to detect conflicts when editing the files. File paths must be absolute.

ParameterTypeDescription
files *arrayList of files and their line ranges to read
encodingstringText encoding (default: 'utf-8')

patch_text_file_contents

Apply patches to text files with hash-based validation for concurrency control.you need to use get_text_file_contents tool to get the file hash and range hash every time before using this tool. you can use append_text_file_contents tool to append text contents to the file without range hash, start and end. you can use insert_text_file_contents tool to insert text contents to the file without range hash, start and end.

ParameterTypeDescription
file_hash *stringHash of the file contents for concurrency control.
file_path *stringPath to the text file. File path must be absolute.
patches *arrayList of patches to apply
encodingstringText encoding (default: 'utf-8')

create_text_file

Create a new text file with given content. The file must not exist already.

ParameterTypeDescription
contents *stringContent to write to the file
file_path *stringPath to the text file. File path must be absolute.
encodingstringText encoding (default: 'utf-8')

append_text_file_contents

Append content to an existing text file. The file must exist.

ParameterTypeDescription
contents *stringContent to append to the file
file_hash *stringHash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called.
file_path *stringPath to the text file. File path must be absolute.
encodingstringText encoding (default: 'utf-8')

delete_text_file_contents

Delete specified content ranges from a text file. The file must exist. File paths must be absolute. You need to provide the file_hash comes from get_text_file_contents.

ParameterTypeDescription
file_hash *stringHash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called.
file_path *stringPath to the text file. File path must be absolute.
ranges *arrayList of line ranges to delete
encodingstringText encoding (default: 'utf-8')

insert_text_file_contents

Insert content before or after a specific line in a text file. Uses hash-based validation for concurrency control. You need to provide the file_hash comes from get_text_file_contents.

ParameterTypeDescription
contents *stringContent to insert
file_hash *stringHash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called.
file_path *stringPath to the text file. File path must be absolute.
afterintegerLine number after which to insert content (mutually exclusive with 'before')
beforeintegerLine number before which to insert content (mutually exclusive with 'after')
encodingstringText encoding (default: 'utf-8')