LockRe
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LockRelock docs/guide.md for editing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LockRe
File lock + surgical revert for multi-agent collaboration. Stop AI agents from clobbering each other's edits, and undo any single agent's changes line-by-line without touching anyone else's work.
Exposed over MCP (for AI agents) and a plain HTTP API. Pun intended: Lock + Revert (≈ Rock Lee 🥋).
zero dependencies · ~1,280 lines · ~997-token MCP footprint · Node ≥ 22Why
When several AI agents (or sub-agents) edit the same repository at once, two things go wrong:
Lost updates — two agents read, edit, and write the same file; one silently overwrites the other.
No clean undo — when one agent's contribution turns out wrong, you want to remove just its lines, not roll back everyone.
LockRe solves both with one tiny standalone service:
Lock / unlock / queue — an agent reserves a file before editing. Others queue (FIFO) and are served in order.
Contribution tracking + surgical revert — every edit is attributed by line. Reverting an agent removes only the lines it added, leaving other agents' work intact.
Related MCP server: Shift MCP Server
Design principle: the AI decides, LockRe never silently corrupts
When a revert hits a conflict (another agent built on top of the line you're removing), LockRe does not guess. It returns a structured report — who conflicts, where, and the resolution options — and lets the agent choose. If there's no conflict, the revert just proceeds.
Features
Lock model — acquire / release / FIFO queue, per-lock token for safe unlock correlation.
Blocking + poll — an agent can hold the request open until granted, or get a
waitingreply (with queue position) and go do other work, then come back and re-check. No external notifier required.Surgical revert — remove one agent's added lines across one file or all its files in a single call.
4-mode conflict resolution —
force/partial1/partial2/abort, chosen by the agent from the conflict report.Restore — undo a revert (guarded: refuses if the file changed since, or is locked).
Safety nets — revert respects active locks (won't clobber an agent mid-edit); stale-lock sweep (max-hold + file-mtime); startup clears stale locks; optional FIFO retention to bound the DB.
Heads-up — locking a recently-reverted file warns the next editor to review it.
Zero dependencies — pure Node built-ins (
node:http,node:sqlite,node:crypto).
Install & run
Requires Node ≥ 22 (uses the built-in node:sqlite).
git clone https://github.com/crsxmd/LockRe-mcp.git
cd LockRe-mcp
node server.js # starts the HTTP service on 127.0.0.1:8766Wire it into an MCP client (e.g. Claude Code)
{
"mcpServers": {
"lockre": {
"command": "node",
"args": ["/absolute/path/to/LockRe-mcp/mcp-stdio.js"],
"env": { "AGENTLOCK_BLOCKING": "1" }
}
}
}The MCP bridge talks to the same HTTP service, so run server.js once and point every agent's bridge at it.
MCP tools (7)
tool | purpose |
| Reserve a file before editing (acquire / queue / wait). |
| Release a file (records the contribution diff). |
| Remove one agent's added lines; returns a conflict report + modes when needed. |
| Undo a revert by |
| See, in time order, what each agent changed in a file. |
| List agents that edited, most-recent first. |
| One agent's full edit journey (every file, + / − per edit). |
HTTP API
POST /lock · POST /unlock · POST /revert · POST /restore · GET /contributions · GET /agents · GET /status · GET /health
Conflict model
A conflict exists only when another agent's surviving line incorporates (embeds) a line you're reverting — e.g. you wrote return a, they changed it to return a + b. Pure additions and independent rewrites are not conflicts.
On conflict, revert_agent returns the report and four modes:
force— remove all of the agent's lines, including the conflict zone (may corrupt; use when leftovers are safe to strip).partial1— revert only the non-conflicted files; leave conflicted files for you to fix.partial2— also revert conflict-free lines inside conflicted files, keeping the conflict-tied line.abort— change nothing.
Known limit (by design): detection is line-level, not semantic. A revert can be clean line-wise yet break at runtime if another agent's surviving code references a symbol the removed lines defined (e.g. a function/variable). LockRe surfaces a
verifyhint and aheads_upon the next lock so the agent checks — it does not run your code.
Configuration (env)
Env vars use the
AGENTLOCK_prefix (the project's original internal name).
var | default | meaning |
|
| HTTP port (binds |
|
| SQLite file. |
| off | Hold |
|
| Per-chunk wait before returning a |
|
| Absolute cap on any lock (leaked-lock backstop). |
|
| Auto-release a file lock unmodified this long. |
|
| Idle-holder grace. |
|
| FIFO retention cap on stored contributions. |
| cap/5 | Rows evicted (oldest first) when over the cap. |
Security
LockRe binds to 127.0.0.1 and has no authentication — it is designed for local, single-machine multi-agent use. Do not expose the port to a public network.
Quality & testing
LockRe is validated by two independent layers (test files are not shipped in this repo):
Deterministic suite — 100 checks, all green: lock-engine units, revert-mode classification, runtime revert (files actually re-run with
node), the MCP bridge, a concurrency/stress harness (no-lost-update under 50+ concurrent ops, queue fairness, disconnect chaos, revert-respects-lock), and DB retention.Genuine multi-agent re-run — 17 scenarios, all passing: each conflict is created by 2–5 separate real agents (each with its own server-minted id, locking/writing via the service), then reverted by another agent that inspects and decides. Coverage includes 4-agent concurrent no-lost-update, extend / upstream / replace / three-way / deep-chain / cross-agent-duplicate conflicts, all four revert modes, multi-file revert (whole + partial), revert→restore round-trips, the semantic-dependency limit, revert-respects-active-lock, and the post-revert heads-up. Every result cross-verified with
curl/node.
License
MIT — free to use, modify, and distribute.
ภาษาไทย (สรุป)
LockRe = ระบบ ล็อกไฟล์ + ย้อน (revert) แบบ surgical สำหรับงานที่มี AI agent หลายตัวแก้โค้ดพร้อมกัน เปิดผ่าน MCP (สำหรับ agent) และ HTTP ชื่อพ้องเสียง Rock Lee (Lock + Revert)
แก้ 2 ปัญหา: (1) agent หลายตัวแก้ไฟล์เดียวกันแล้วเขียนทับกัน (lost update) (2) อยากย้อนงานของ agent ตัวเดียวโดยไม่กระทบคนอื่น
หลักการ: ตอน revert เจอ conflict ระบบ ไม่ตัดสินแทน — ส่ง report + ตัวเลือก (4 โหมด: force / partial1 / partial2 / abort) ให้ AI เลือกเอง ไม่เคย corrupt เงียบ
เบา: zero dependency, ~1,280 บรรทัด, MCP footprint ~997 tokens, Node ≥ 22
ความปลอดภัย: bind 127.0.0.1 ไม่มี auth — ใช้ภายในเครื่อง ห้าม expose ออกเน็ต
ทดสอบ: deterministic suite 100 เช็ค + genuine multi-agent 17 เคส (แต่ละเคสใช้ agent จริง 2–5 ตัวสร้าง conflict แล้ว revert) ผ่านหมด cross-verify ด้วย curl/node (ไฟล์เทสไม่ได้รวมใน repo นี้)
License: MIT
This server cannot be installed
Maintenance
Related MCP Servers
- Alicense-qualityDmaintenanceA coordination layer for coding agents that provides identities, message threading, and searchable history. It features file reservation leases to prevent agents from overwriting each other's work in multi-agent environments.1MIT
- Alicense-qualityDmaintenanceA lightweight coordination layer for multiple AI agents working on the same codebase, providing check-in and check-out tools via STDIO or Streamable HTTP.581Apache 2.0
- Alicense-qualityCmaintenancePrevents AI coding agents from conflicting by coordinating file claims and resolving conflicts in real-time across multiple sessions.761MIT
- Alicense-qualityCmaintenanceEnables multiple AI agents like Claude and Codex to coordinate on the same project through shared tasks, file locks, and a real-time dashboard, preventing conflicts and streamlining collaborative development.91MIT
Related MCP Connectors
Coding agents from Claude Code, Cursor and Codex claim jobs and lock files on one shared board.
Collective memory for AI agents. One agent solves a bug — every agent gets the fix instantly.
Shared debugging memory for AI coding agents
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/crsxmd/LockRe-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server