MCP Text Editor Server provides a Python-based interface for AI assistants to manipulate text files through a structured editing workflow. Built with FastMCP, it implements a two-step edit process with content verification using SHA-256 hashing to prevent conflicts during concurrent edits. The server offers tools for file management, content access, text search, and syntax validation for Python and JavaScript files. It enforces safety through line limits and automatic syntax checking before applying changes, making it ideal for collaborative code editing where multiple agents need controlled access to modify source files.
Nessuna recensione ancora. Sii il primo a recensire!
Accedi per unirti alla conversazione
Sets the current file to work with. Parameters: filepath (str): Absolute path to the file. Returns: Confirmation message with the file path.
Reads full text from the current file. Each line is prefixed with its line number. Returns: Dictionary containing lines with their line numbers, total number of lines, and the max edit lines setting.
Reads text from the current file from start line to end line. Parameters: start (int): Start line number (1-based indexing), end (int): End line number (1-based indexing). Returns: Dictionary containing lines with their line numbers as keys, along with start and end line information.
Select a range of lines from the current file for subsequent overwrite operation. Parameters: start (int): Start line number (1-based), end (int): End line number (1-based). Returns: Dictionary containing the selected lines, line range, and ID for verification.
Prepare to overwrite a range of lines in the current file with new text. Parameters: new_lines (list): List of new lines to overwrite the selected range. Returns: Diff preview showing the proposed changes.
Apply pending changes from the overwrite operation. Returns: Operation result with status and message.
Discard pending changes from the overwrite operation. Returns: Operation result with status and message.
Delete the currently set file. Returns: Operation result with status and message.
Creates a new file and automatically sets it as the current file for subsequent operations. Parameters: filepath (str): Path of the new file. Returns: Operation result with status, message, and selection info.
Find lines that match provided text in the current file. Parameters: search_text (str): Text to search for in the file. Returns: Dictionary containing matching lines with their line numbers and total matches.
Find a function or method definition in the current Python or JavaScript/JSX file. Parameters: function_name (str): Name of the function or method to find. Returns: Dictionary containing the function lines with their line numbers, start_line, and end_line.
Lists the contents of a directory. Parameters: dirpath (str): Path to the directory to list. Returns: Dictionary containing list of filenames and the path queried.
Run Python tests with pytest.
Configure the Python environment path for proper module resolution.