mcp-hashline-edit-server
Provides hashline-based file editing using line-addressed edits and content hashes for integrity verification. It enables LLMs to perform precise file modifications while ensuring edits are rejected if the file content has changed since the last read.
README
mcp-hashline-edit-server
MCP server providing hashline-based file editing — line-addressed edits with content hashes for integrity verification.
Based on hashline edit format from oh-my-pi.
What is Hashline?
LLM reads file, every line tagged with short content hash:
1:a3|function hello() {
2:f1| return "world";
3:0e|}
Model references tags when editing — "replace line 2:f1", "replace range 1:a3 through 3:0e", "insert after 3:0e". If file changed since last read, hashes won't match, edit rejected before corruption.
Model doesn't need to reproduce old content/whitespace to identify changes. Benchmarks show hashline matches or beats str_replace for most models, weakest models gain most (up to 10x improvement).
Requirements
Install
npm install mcp-hashline-edit-server
# or
bun add mcp-hashline-edit-server
Usage
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"hashline-edit": {
"command": "bunx",
"args": ["mcp-hashline-edit-server"]
}
}
}
Cursor
Add to .cursor/mcp.json (project root or global):
{
"mcpServers": {
"hashline-edit": {
"command": "bunx",
"args": ["mcp-hashline-edit-server"]
}
}
}
Any MCP client
Server runs over stdio:
bunx mcp-hashline-edit-server
From source
git clone https://github.com/Submerisble/mcp-hashline-edit-server.git
cd mcp-hashline-edit-server
bun install
bun run src/index.ts
Tools
read_file
Read file with hashline-prefixed output (LINE:HASH|content).
| Parameter | Type | Description |
|---|---|---|
path |
string | File path (relative or absolute) |
offset |
number? | Start line (1-indexed) |
limit |
number? | Max lines (default: 2000) |
edit_file
Edit file using hash-verified line references. Four edit variants:
set_line — Replace single line:
{"set_line": {"anchor": "2:f1", "new_text": " return \"universe\";"}}
replace_lines — Replace range:
{"replace_lines": {"start_anchor": "1:a3", "end_anchor": "3:0e", "new_text": "function greet() {\n return \"hi\";\n}"}}
insert_after — Insert after line:
{"insert_after": {"anchor": "1:a3", "text": " // new comment"}}
replace — Fuzzy substring replace (fallback, no hashes needed):
{"replace": {"old_text": "return \"world\"", "new_text": "return \"universe\""}}
| Parameter | Type | Description |
|---|---|---|
path |
string | File path |
edits |
array | Edit operations |
Edits validated atomically against file as last read. Sorted, applied bottom-up automatically.
write_file
Create or overwrite file.
| Parameter | Type | Description |
|---|---|---|
path |
string | File path |
content |
string | Content to write |
grep
Search files with hashline-prefixed results.
| Parameter | Type | Description |
|---|---|---|
pattern |
string | Regex pattern |
path |
string? | File or directory |
glob |
string? | Filter by glob (e.g., *.js) |
type |
string? | Filter by file type |
i |
boolean? | Case-insensitive |
pre |
number? | Context lines before |
post |
number? | Context lines after |
limit |
number? | Max matches (default: 100) |
Requires rg (ripgrep) on system.
How the Hash Works
- Strip trailing
\r - Remove all whitespace
xxHash32on whitespace-stripped string- Modulo 256, encode as 2-char lowercase hex (
00-ff)
Hash whitespace-insensitive — indentation changes don't affect hash, references robust against reformatting.
Error Recovery
Hash mismatch: Error shows updated LINE:HASH refs with >>> markers. Copy new refs, retry.
No-op error: Replacement matches current content. Re-read file for current state.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。