Hledit MCP logo

Hledit MCP

by dabito

Reads and edits local files with line-hash anchors that reject stale changes before writing.

Install Hledit MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "dabito-hledit-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "hledit-mcp"
      ],
      "env": {
        "HLEDIT_BIN": "YOUR_VALUE_HERE",
        "HLEDIT_CWD": "YOUR_VALUE_HERE",
        "HLEDIT_MCP_DIFF": "YOUR_VALUE_HERE",
        "HLEDIT_MCP_DIFF_MAX_LINES": "YOUR_VALUE_HERE",
        "HLEDIT_MCP_DIFF_CONTEXT": "YOUR_VALUE_HERE",
        "HLEDIT_MCP_DIFF_MAX_CELLS": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Automated check passed— started and listed 1 tools correctly ().

Overview

dabito/hledit-mcp MCP server exposes hash-anchored local file editing through one MCP tool. Agents first read annotated lines, then use those anchors for single or batch replacements, insertions, and deletions. The server verifies each anchor against current file contents and returns a stale error without writing when the file has changed. Use it for MCP coding workflows that need explicit stale-context handling instead of blind text replacement.

Use cases

  • Edit local source files with stale-write detection
  • Read targeted file sections with anchored line references
  • Apply multiple file changes in one batch request
  • Retry edits safely after concurrent file changes

Key features

  • Hash-anchored line reads
  • Stale-write rejection
  • Single and batch file edits
  • Substring grep with optional context
  • Optional capped diff output

Tools1

What Hledit MCP lets your agent do. Expand a tool for its parameters.

Verified live~582 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 114d

What it can do

From the 1 tool this server returned when we ran it.

Writes files · 1
Network at startup3 connections
Files written at startupNone
Install scriptsNone
npm provenanceNot published
Package age135 days
Maintainers1

Observed 2026-11-18 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · hledit-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads326Package downloads in the last 30 days.
Last commit4mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed1Callable tools this server registers over MCP.
Directory activity4 viewsConfig copies, upvotes, and views on AllMCPs.

How Hledit MCP works

What dabito/hledit-mcp does

dabito/hledit-mcp provides MCP clients with a file-editing interface backed by the hledit command-line tool. Its single hledit tool supports three operations: read, edit, and batch. Reading a file returns line references containing a line number and short hash, such as 6#M9A. Later write operations use those references rather than relying only on copied text.

The server is intended for local workspace edits. It can read bounded sections of a file, filter reads with substring matching, and apply replacement, insertion, deletion, or range-replacement changes. Batch operations group multiple anchor-based edits into one request.

How it works

A typical workflow with the dabito/hledit-mcp MCP server starts with read. The response includes anchors tied to the file content at the time of reading. An agent then submits an edit or batch request using one or more of those anchors.

Before modifying the file, hledit recalculates the referenced hash. If the relevant line has moved or changed since the read, the operation fails with a stale result and no write occurs. The agent should read the file again to obtain current anchors before retrying. This behavior makes stale context an explicit failure rather than an implicit text-replacement risk.

The server communicates over MCP stdio. It invokes the installed hledit binary, resolving relative paths from the configured working directory. Successful edits return concise summaries; with a recent enough CLI, they can also include line-count deltas. Optional textual diffs can be enabled for successful edits and batches.

Setup and configuration

To run the dabito/hledit-mcp MCP server, install Go 1.21 or later and install the CLI with go install github.com/dabito/hledit@latest. Node.js 18 or later is also required. The MCP client must support stdio servers.

A client can launch the published package with npx -y hledit-mcp. Set HLEDIT_CWD to the workspace that the server should edit. HLEDIT_BIN can point to the CLI when hledit is not available on PATH.

Optional diff settings include HLEDIT_MCP_DIFF, HLEDIT_MCP_DIFF_MAX_LINES, HLEDIT_MCP_DIFF_CONTEXT, and HLEDIT_MCP_DIFF_MAX_CELLS. Diff output is disabled by default. The server uses a default read limit of 2,000 lines when no offset or limit is supplied.

Tools and capabilities

The hledit tool accepts a required op and path. For read, offset, limit, grep, and context control the returned content. Grep reads use two context lines by default, or only matching lines when context is set to zero.

For edit, action selects replace, insert, delete, or replace-range. Range operations use an end_anchor; inserted or replacement text is supplied through content. For batch, the preferred edits value is a structured array containing operations such as replace, delete, and insert. Legacy JSON-string batch input remains accepted.

Limitations and notes

The server does not provide a separate tool for each edit type; all operations are handled through hledit. Anchors are only valid for the file state from which they were read, so edits made by another process can require a fresh read. The working directory should be scoped to the workspace the MCP client is expected to modify.

Older hledit CLI versions remain usable, but versions before 1.2.4 may omit line-delta information from successful edit summaries. The optional diff output is capped by configurable limits and may omit the diff body when a comparison exceeds the configured cell budget.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Hledit MCP

dabito/hledit-mcp is an MCP server that connects MCP-compatible clients to local files through the hledit CLI. Its main tool, hledit, reads hash-anchored lines and performs single or batch replacements, insertions, and deletions while rejecting writes that use stale anchors.

Install the hledit CLI with Go 1.21 or later, then configure your MCP client to run npx -y hledit-mcp. Node.js 18 or later and an MCP-compatible client are also required. Set HLEDIT_CWD to the workspace the client may edit.

Yes, dabito/hledit-mcp works with Cursor because the README identifies Cursor as a standard MCP client for this server. Configure Cursor to launch the stdio command and provide the desired HLEDIT_CWD workspace.

It rejects stale edits before writing. The server recomputes each anchor against the current file, returns a stale result when the content or line position changed, and requires the client to read fresh anchors before retrying.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewHledit MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/dabito-hledit-mcp?style=directory)](https://allmcps.com/mcp/dabito-hledit-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/dabito-hledit-mcp"><img src="https://allmcps.com/api/badge/dabito-hledit-mcp?style=directory" alt="Hledit MCP on AllMCPs" /></a>