
A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

A Model Context Protocol server offering line-oriented text file reading and editing with partial file access and hash-based conflict detection.
MCP Text Editor Server is cataloged as an MCP server attributed to tumf. A Model Context Protocol server offering line-oriented text file reading and editing with partial file access and hash-based conflict detection. It is categorized under file systems-docs. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MCP Text Editor Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
It validates modifications using SHA-256 file and range hashes, returning a hash mismatch error if the content changed.
No, patches are applied from bottom to top and must not overlap.
README.md · 9176a5012b8f · 采集于 2026-11-13 09:33:53 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
A Model Context Protocol (MCP) server that provides line-oriented text file editing capabilities through a standardized API. Optimized for LLM tools with efficient partial file access to minimize token usage.
To use this editor with Claude.app, add the following configuration to your prompt:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"text-editor": {
"command": "uvx",
"args": [
"mcp-text-editor"
]
}
}
}
MCP Text Editor Server is designed to facilitate safe and efficient line-based text file operations in a client-server architecture. It implements the Model Context Protocol, ensuring reliable file editing with robust conflict detection and resolution. The line-oriented approach makes it ideal for applications requiring synchronized file access, such as collaborative editing tools, automated text processing systems, or any scenario where multiple processes need to modify text files safely. The partial file access capability is particularly valuable for LLM-based tools, as it helps reduce token consumption by loading only the necessary portions of files.
pyenv install 3.11.6
pyenv local 3.11.6
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"
uvx mcp-text-editor
To install Text Editor Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-text-editor --client claude
pyenv install 3.13.0
pyenv local 3.13.0
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"
Start the server:
python -m mcp_text_editor
The server provides several tools for text file manipulation:
Get the contents of one or more text files with line range specification.
Request:
The tool accepts a files array. Each file contains one or more line ranges using
start and end. File paths must be absolute.
{
"files": [
{
"file_path": "/absolute/path/to/file.txt",
"ranges": [
{"start": 1, "end": 10},
{"start": 20, "end": null}
]
}
],
"encoding": "utf-8"
}
Parameters:
file_path: Absolute path to the text filestart: First line to read (1-based)end: Last line to read (inclusive); null reads through end of fileencoding: File encoding for all requested files (default: utf-8)Response:
The top-level object is keyed by absolute file path. file_hash protects the
whole-file state; each range_hash protects the corresponding range.
{
"/absolute/path/to/file.txt": {
"file_hash": "sha256-hash-of-the-file",
"ranges": [
{
"content": "Lines 1-10 content",
"start": 1,
"end": 10,
"range_hash": "sha256-hash-of-this-range",
"total_lines": 50,
"content_size": 512
}
]
}
}
Apply one or more non-overlapping patches to one file. Read the target ranges
first and pass both the current file_hash and each matching range_hash.
Request:
{
"file_path": "/absolute/path/to/file.txt",
"file_hash": "sha256-hash-from-get-response",
"patches": [
{
"start": 5,
"end": 8,
"range_hash": "sha256-hash-of-lines-5-through-8",
"contents": "New content for lines 5-8\n"
}
],
"encoding": "utf-8"
}
Important notes:
get_text_file_contents immediately before editing.start and end; line_start and line_end are not accepted.append_text_file_contents, insert_text_file_contents, or
delete_text_file_contents for those specialized operations.Success response:
{
"result": "ok",
"file_hash": "sha256-hash-of-new-file-contents",
"reason": null,
"suggestion": null,
"hint": null
}
Error response:
{
"result": "error",
"reason": "Content range hash mismatch",
"suggestion": "get",
"hint": "Please run get_text_file_contents first to get current content and hashes"
}
get_text_file_contents for the exact range to replace.file_hash and the range's range_hash from the keyed response.patch_text_file_contents with those hashes and the same range.path = "/absolute/path/to/file.txt"
contents = await get_text_file_contents({
"files": [{
"file_path": path,
"ranges": [{"start": 5, "end": 8}]
}]
})
file_info = contents[path]
selected_range = file_info["ranges"][0]
result = await patch_text_file_contents({
"file_path": path,
"file_hash": file_info["file_hash"],
"patches": [{
"start": 5,
"end": 8,
"range_hash": selected_range["range_hash"],
"contents": "New content\n"
}]
})
The server handles various error cases:
Permission Denied
Hash Mismatch and Range Hash Errors
Encoding Issues
Connection Issues
Performance Issues
uv pip install -e ".[dev]"make allTests are located in the tests directory and can be run with pytest:
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=mcp_text_editor --cov-report=term-missing
# Run specific test file
pytest tests/test_text_editor.py -v
Current test coverage: 90%
mcp-text-editor/
├── mcp_text_editor/
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── models.py # Data models
│ ├── server.py # MCP Server implementation
│ ├── service.py # Core service logic
│ └── text_editor.py # Text editor functionality
├── tests/ # Test files
└── pyproject.toml # Project configuration
MIT
This project uses Python type hints throughout the codebase. Please ensure any contributions maintain this.
All error cases should be handled appropriately and return meaningful error messages. The server should never crash due to invalid input or file operations.
New features should include appropriate tests. Try to maintain or improve the current test coverage.
All code should be formatted with Black and pass Ruff linting. Import sorting should be handled by isort.
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MCP Text Editor Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/mcp-text-editor)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

Hosted MCP server for tabletop RPG worlds that organizes messy notes and documents into a private store and lets MCP apps search lore, read documents, find characters, and optionally generate character or world pictures.

An MCP server that gives AI assistants scoped file system operations inside a project directory, with read-only reference projects plus git and GitHub tools.