Hash-anchored file editing with surgical precision over file editing and ironclad control of access
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
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.
Unlike traditional line-number-based editing that breaks when files change, Hashfile uses content-anchored operations:
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 contextsecrets/**, **/*.env)π Full AGENTS.md Documentation | π Proposal Spec
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| Feature | Benefit |
|---|---|
| Hash-Anchored Editing | Edits survive file changes β no more "line 42 doesn't match" errors |
| Content Verification | 6-character file hashing prevents race conditions |
| AGENTS.md Support | Declarative access control β protect secrets, lock schemas, hide noise |
| Fuzzy Line Matching | Finds the right line even after insertions/deletions |
| 9 MCP Tools | 3 hashline tools + 6 standard filesystem tools |
| Zero Dependencies | Pure Rust, compiles to a single binary |
The binary will be at target/release/hashfile-mcp.
Add to Claude Desktop or your MCP client config:
Create AGENTS.md in your project root:
The AI can now:
.env filesnode_modules or build artifactsTraditional line-number editing fails when files change:
Content-anchored editing with hash verification:
42:a3|const x = 1;"anchor": "42:a3"read_text_fileReturns content with hash-tagged lines for reliable editing:
edit_text_fileApply hash-anchored operations:
Operation types: replace, insert_after, insert_before, delete
write_text_fileWrite content and get back hashline-tagged verification
list_directorydirectory_treeSupports exclude_patterns for filtering (e.g., ["**/node_modules/**", "**/.git/**"])
create_directory, move_file, write_file, read_multiple_filesStandard filesystem operations with AGENTS.md enforcement
| Constraint | Effect | Use Case |
|---|---|---|
forbidden | Block all access | Secrets, credentials, private keys |
read_only | Allow reads, block writes | Schemas, lock files, generated configs |
ignore | Hide from AI context | Dependencies, build artifacts, noise |
Hashfile MCP automatically respects .gitignore files in your project:
.gitignore files.gitignore patterns (basename, directory, path)Pattern conversion:
Precedence: AGENTS.md ignore patterns take precedence over .gitignore.
Place AGENTS.md files at any level:
The nearest AGENTS.md in the directory hierarchy applies.
rmcp, serde, serde_json, serde_yaml, globset, anyhow, fnvENABLE_FILESYSTEM_TOOLS=true)ENABLE_LIST_DIRECTORY=true, etc.)get_file_info, search_files, list_directory_with_sizesSee LICENSE file for details.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/hashfile-mcp)<a href="https://allmcps.com/mcp/hashfile-mcp"><img src="https://allmcps.com/api/badge/hashfile-mcp?style=directory" alt="Hashfile MCP on AllMCPs" /></a>