
Hashfile MCP
io.github.mrorigo由 GitHub 帳號 mrorigo 發布v0.3.0更新於 Oct 24, 2026
Hash-anchored file editing with surgical precision over file editing and ironclad control of access
概覽
本機 MCP 伺服器,提供以雜湊錨點為基礎的檔案編輯與 AGENTS.md 存取控制,讓助理精準且可驗證地讀寫專案檔案。
- 可以做什麼
- 讀取帶雜湊標記行的檔案,並依錨點執行取代、插入、刪除操作,附帶檔案雜湊驗證
- 寫入整個檔案並回傳帶雜湊行的驗證結果
- 瀏覽目錄、產生精簡目錄樹、建立目錄、移動檔案以及批次讀取多個檔案
- 執行 AGENTS.md frontmatter 中的 forbidden、read_only、ignore 規則,並遵循 .gitignore 樣式
- 適用情境
- 適合助理在檔案可能被他人改動的專案中編輯程式碼、依行號編輯經常出錯時使用;也適合希望以宣告式規則阻止代理接觸密鑰、鎖定檔與建置產物的情境。
- 執行需求
- 以本機 stdio 程序執行;README 說明可用 Cargo(Rust)從原始碼建置,或安裝適用於 macOS、Linux、Windows 的預先編譯版本。需在 MCP 用戶端設定該執行檔路徑。未宣告任何帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Hashfile MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Hashfile MCP Server
Fine-Grained Control for AI File Operations — A Model Context Protocol (MCP) server that gives you surgical precision over file editing and ironclad control over file access.
Why Hashfile MCP?
🎯 Surgical File Editing
Unlike traditional line-number-based editing that breaks when files change, Hashfile uses content-anchored operations:
- Hash-Anchored Lines: Every line tagged with a content hash — edits target the right content, not just the right line number
- Fuzzy Matching: Automatically finds moved lines even after insertions/deletions
- Collision Detection: File-level verification prevents editing stale content
- Multi-Operation Edits: Apply multiple precise changes in a single atomic operation
🔒 Ironclad Access Control
Take complete control over what AI agents can touch with AGENTS.md frontmatter:
forbidden: Block access to secrets, credentials, sensitive dataread_only: Allow reading schemas, configs, lock files — prevent modificationsignore: Hide generated code, dependencies, build artifacts from AI context- Hierarchical Discovery: Place AGENTS.md anywhere in your tree — nearest file wins
- Glob Patterns: Fine-tune access with wildcards (
secrets/**,**/*.env)
📖 Full AGENTS.md Documentation | 📋 Proposal Spec
🛠️ Drop-In Filesystem Compatibility
All standard MCP filesystem tools included:
list_directory— Browse with[FILE]/[DIR]prefixesdirectory_tree— Compact tree view (10x more token-efficient than JSON)create_directory— Recursive directory creationmove_file— Rename/move files and directorieswrite_file— Raw UTF-8 writes (non-hashline)read_multiple_files— Batch reads in one operation
Features at a Glance
Installation
The binary will be at target/release/hashfile-mcp.
Quick Start
1. Configure Your MCP Client
Add to Claude Desktop or your MCP client config:
2. (Optional) Add Access Control
Create AGENTS.md in your project root:
3. Start Editing
The AI can now:
- ✅ Read and edit source files with hash-anchored precision
- ✅ Browse directories and create new files
- ❌ Cannot touch your secrets or
.envfiles - ❌ Cannot modify lock files or schemas
- 🙈 Won't see
node_modulesor build artifacts
How Hashline Works
The Problem
Traditional line-number editing fails when files change:
The Solution
Content-anchored editing with hash verification:
- Read: Each line gets a hash tag →
42:a3|const x = 1; - Edit: Operations reference content, not just position →
"anchor": "42:a3" - Apply: Server finds the line by hash, even if it moved to line 45
- Verify: File hash must match — detects if content changed since read
Reliability Features
- File-Level Verification: 6-character hash prevents editing stale content
- Line-Level Anchoring: 2-character hash identifies specific lines
- Fuzzy Matching: Searches for unique hash match if line number changed
- Conflict Detection: Clear errors if content diverged
Core Tools
Hashline Tools (Precision Editing)
read_text_file
Returns content with hash-tagged lines for reliable editing:
edit_text_file
Apply hash-anchored operations:
Operation types: replace, insert_after, insert_before, delete
write_text_file
Write content and get back hashline-tagged verification
Filesystem Tools (Standard Operations)
list_directory
directory_tree
Supports exclude_patterns for filtering (e.g., ["**/node_modules/**", "**/.git/**"])
create_directory, move_file, write_file, read_multiple_files
Standard filesystem operations with AGENTS.md enforcement
AGENTS.md Access Control
Constraint Types
Automatic .gitignore Support
Hashfile MCP automatically respects .gitignore files in your project:
- Hierarchical: Walks up from target file to find all
.gitignorefiles - Standard syntax: Supports standard
.gitignorepatterns (basename, directory, path) - Combined with AGENTS.md: Patterns from both sources are merged
- Zero config: Works out of the box with existing projects
Pattern conversion:
Precedence: AGENTS.md ignore patterns take precedence over .gitignore.
Example: Protect a Monorepo
Hierarchical Control
Place AGENTS.md files at any level:
The nearest AGENTS.md in the directory hierarchy applies.
Development
Run Tests
Project Structure
Technical Details
- Language: Rust (edition 2021)
- MCP SDK: rmcp 0.15.0
- Line Hashing: FNV-1a (2 hex chars, 256 buckets)
- File Hashing: FNV-1a (6 hex chars, 16M buckets)
- Transport: stdio
- Dependencies:
rmcp,serde,serde_json,serde_yaml,globset,anyhow,fnv
Roadmap
- Environment variable-based tool enablement (
ENABLE_FILESYSTEM_TOOLS=true) - Granular tool control (
ENABLE_LIST_DIRECTORY=true, etc.) - Additional tools:
get_file_info,search_files,list_directory_with_sizes - Command-line argument support for configuration
License
See LICENSE file for details.
See Also
- The Harness Problem - I Improved 15 LLMs at Coding in One Afternoon. Only the Harness Changed. - Can Bölük Feb 2026
- AGENTS.md Proposal - Frontmatter specification for agent access control
來源:README.md,提交 7fb6099
工具
0版本歷史
1- v0.3.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。