mergelock
Use this MCP server to check branch merge safety and inspect claimed work areas before starting.
Run
checkto compare a branch with another branch (or the configured target/current branch) for textual and semantic merge conflicts.Get actionable findings for issues such as add/add conflicts, modify/delete conflicts, changed signatures with invalid callers, deleted symbols still used, and duplicate definitions.
Review verdict details including severity, confidence, suggested actions, involved paths/symbols, call sites, signatures, duplicates, language coverage, and stats.
Run
claimsto list live work-scope claims fromrefs/mergelock/claims, newest first, so an agent can choose an area no other agent is working in.Inspect claim metadata such as branch, paths, symbols, agent/session, intent, creation time, TTL, and mode; claims are read-only in v0.1.
Analyzes git repositories to detect merge conflicts before branches are merged. Runs mergelock check on two branches, using git merge-tree and tree-sitter parsers to report textual conflicts, add/add, modify/delete, signature/caller mismatches, and duplicate definitions, without ever touching the working tree.
mergelock
A git-native merge gate. mergelock check compares two branches before
they meet and reports the conflicts git itself won't tell you about: a
function whose signature changed on one branch while the other branch
added calls to the old signature, a symbol deleted on one side but still
used on the other, the same function written twice.

It never touches your working tree. Everything is computed from commits
with git merge-tree and tree-sitter parsers, so it is safe to run in a
pre-push hook, in CI, or from an AI coding agent over MCP.
What it detects
Rule | Reports | Severity |
| Ordinary git content conflicts | error |
| Both branches add a file at the same path | error |
| One branch edits a file or symbol the other deletes, or still calls a deleted symbol | error |
| A signature changed on one branch; the other adds calls that no longer fit | error |
| Both branches add the same function, by name or by near-identical body | warning |
Semantic rules understand TypeScript, JavaScript (incl. TSX/JSX) and Python. Files in other languages still get the textual, add/add and modify/delete checks.
Related MCP server: Simple Merge Review MCP
Install
mergelock needs git 2.38 or newer (for git merge-tree --write-tree).
Homebrew (macOS and Linux):
brew install sadayamuthu/tap/mergelockDebian / Ubuntu (.deb, amd64 and arm64; needs a distribution with git
2.38+, such as Debian 12 or Ubuntu 24.04):
VERSION=0.1.5 # latest release, without the v
curl -fLO "https://github.com/sadayamuthu/mergelock/releases/download/v${VERSION}/mergelock_${VERSION}_$(dpkg --print-architecture).deb"
sudo apt install "./mergelock_${VERSION}_$(dpkg --print-architecture).deb"Fedora / RHEL (.rpm, x86_64 and aarch64):
VERSION=0.1.5
sudo dnf install "https://github.com/sadayamuthu/mergelock/releases/download/v${VERSION}/mergelock-${VERSION}-1.$(uname -m).rpm"Docker (linux/amd64 and linux/arm64; mount the repository at /repo):
docker run --rm -v "$PWD":/repo ghcr.io/sadayamuthu/mergelock check my-branch main --format text
docker run -i --rm -v "$PWD":/repo ghcr.io/sadayamuthu/mergelock # MCP server on stdioGitHub Actions (checks each pull request against its base branch; see In CI):
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: sadayamuthu/mergelock@v0Prebuilt binary (macOS and Linux, amd64 and arm64): download the archive
for your platform from the
latest release,
then put mergelock on your PATH:
tar -xzf mergelock_*_$(uname -s | tr A-Z a-z)_*.tar.gz
sudo mv mergelock /usr/local/bin/On macOS, a binary from an archive downloaded in a browser is blocked by Gatekeeper because it isn't signed yet (Homebrew installs aren't affected). Clear the quarantine flag once:
xattr -d com.apple.quarantine /usr/local/bin/mergelockWith Go (needs Go 1.25 or newer and a C compiler, since cgo is used for
tree-sitter; on macOS install the Xcode command-line tools, on
Debian/Ubuntu build-essential):
go install github.com/sadayamuthu/mergelock/cmd/mergelock@latestOr build from source:
git clone https://github.com/sadayamuthu/mergelock.git
cd mergelock
go build -ldflags "-X main.version=$(git describe --tags --always)" -o mergelock ./cmd/mergelockCheck it works:
mergelock versionQuick start
Run inside any git repository:
# Is my branch safe to merge into main?
mergelock check my-feature main
# Compare against the configured target (main by default)
mergelock check my-feature
# Will two in-flight branches collide with each other?
mergelock check feat-a feat-b --format textExit codes make it easy to script:
Code | Result |
0 |
|
1 |
|
2 |
|
3 | operational error (bad branch name, not a git repo, invalid config…) |
See USAGE.md for the full command reference, the
.mergelock.yml config, the JSON output schema, CI and git-hook recipes,
and how to connect it to an AI agent over MCP.
To report a missed conflict or add a language, see
CONTRIBUTING.md; for a security problem, see
SECURITY.md.
Development
go test ./... # full suite, incl. fixture gate and 5,000-file perf test
go test -short ./... # skips the perf test
go vet ./...
gofmt -l .Rule behaviour is pinned by branch-pair fixtures in testdata/fixtures/*.txtar;
each one is a tiny repo with a base, two branches and the expected findings.
License
Available Tools
2 toolscheckA
Check a branch against another for textual and semantic merge conflicts. Returns a mergelock verdict (schema v1) with findings an agent can act on.
Inputs: branch, against. Returns: base, notes, stats, result, +4 more
claimsA
List live claims (declared work scopes) from refs/mergelock/claims, newest first, so you can pick an area no other agent is working in. Read-only in v0.1.
Returns: claims
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: check runs a merge-conflict analysis on branches, while claims lists declared work scopes. An agent can easily tell which to use in a given situation with no overlap.
Both names are single lowercase words, but one is a verb (check) and the other a noun (claims), so there is no predictable verb_noun convention. It is readable but not a consistent pattern.
With only 2 tools the surface feels thin for a merge-lock/claim coordination system. It is defensible for a v0.1, but limited.
The claims tool is explicitly read-only in v0.1, so there is no way to declare or release a claim, and only a single conflict-check operation exists. Notable lifecycle gaps remain, though the descriptions acknowledge the v0.1 scope.
Maintenance
Related MCP Connectors
Check a lockfile for known vulnerabilities and risky licences, and get alerted when new ones appear.
Freeze and unfreeze merges across a GitHub organization, with an audit trail.
Diff two npm/PyPI versions or lockfiles: new install scripts, network/shell/eval calls, new deps.
Diff gatekeeper, pre-merge review, unicode safety, SMT prover, dependency advisor.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server that detects semantic (non-textual) merge conflicts between Git branches using AST-level analysis. Catches incompatible changes that Git merges cleanly — signature changes, removed exports, parameter changes, interface breaks, and cross-file dependency conflicts.445 npmMIT
- AlicenseAqualityDmaintenanceProvides lightweight Git merge analysis with quick overviews of changes, file lists, and branch status without complex conflict checks.34MIT
- AlicenseAqualityCmaintenanceFast pre-commit dependency gate for AI-assisted code changes. Answers "is this safe to commit?" with a PASS/WARN/BLOCK verdict in seconds, so you can catch risky blast radius before a bad commit, not after it. No database, no heavy setup.5153 npm1MIT
- FlicenseNot gradedqualityDmaintenanceChecks cross-branch compatibility for merge conflicts by detecting function signature changes, route conflicts, and schema mismatches across 15+ languages using AST analysis.-