Operate local deploy trains for coding-agent worktrees with approval-gated deploys.
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.
Safely integrate committed branches from parallel coding agents.
mergetrain is a local-first deploy train for coding-agent worktrees. Agents commit and enqueue their branches; one runner assembles them in order, tests the combined tree, and atomically updates your Git refs only after explicit approval. It is intentionally optimized as an owner-operated local utility, not a hosted team platform.
There is no mergetrain account, hosted control plane, OAuth app, or product telemetry. Queue and runner state stay on your machine; only your configured Git remote and trusted gate or verification commands may contact external services.
Worktrees let several agents edit one repository without sharing a checkout. They do not decide landing order, test the combined result, prevent push races, or tell you what happened if a laptop dies mid-push.
Without an integration boundary, the human becomes that boundary: rebase every finished branch, rerun gates after each merge, resolve cross-branch failures, and decide which session may push. The parallel coding gain disappears at the last mile.
mergetrain makes that last mile a durable protocol:
Use mergetrain when:
It is harness-agnostic: Codex, Claude Code, agy, scripts, and humans all use the same CLI and JSON contract.
You probably do not need mergetrain when:
For PR-first teams, use GitHub Merge Queue or GitLab Merge Trains. mergetrain is for local-agent, worktree-first integration, with or before a PR.
Lease tokens fence concurrent and stale mergetrain runners. They do not
intercept an arbitrary git push from a task agent that has shell access and an
integration-branch credential. To make βone runner owns the pushβ an enforced
property rather than a protocol assumption, use this topology:
Without credential separation and remote protection, mergetrain still provides safe train assembly and recovery semantics, but it cannot prevent a participant from bypassing the queue. See the security boundary.
The demo creates a disposable repository and local bare remote, then runs four
real branches through FIFO merge, a combined-only gate failure, conflict
attribution, and deployment of the compatible train. Use --keep to inspect the
result afterward.
For long-running gates, run mergetrain validate earlier; it never pushes and
leaves one exact train Ready for the later deploy confirmation.
deploy names the configured atomic Git ref update; it does not imply an App
Store, Kubernetes, or other provider release.
mergetrain init also writes agent-facing instructions. The essential rule is
simple: agents commit and enqueue; one runner owns merge β test β push β verify.
Unattended daemons process only jobs that a human explicitly enqueued with
--auto. For manual jobs, daemon --validate-only can run merge and gates in
the background, but it pauses at the validated-train approval boundary and
never pushes.
See the quickstart for configuration, dashboard, daemon, and multi-repository Hub setup.
git merge?Worktrees solve parallel editing. mergetrain solves serialized integration.
| Integration concern | Worktrees + manual merge | mergetrain |
|---|---|---|
| Landing order | A person or agent decides repeatedly | Durable FIFO queue |
| Combined validation | Rerun manually after each merge | Gates run over the exact assembled train |
| Cross-branch failure | Diagnose by hand | Isolation runs identify the conflicting pair |
| Push ownership | Every session can race the ref | One lease-fenced runner owns the push |
| Approval | Shell convention | Explicit validate/deploy intent; --auto is opt-in |
| Crash recovery | Infer from local logs | Reconcile SQLite evidence against remote refs |
Plain worktrees remain the execution lanes. mergetrain is the spine that joins their results without turning the operator into a merge coordinator.
They solve a related problem for a different operating model.
| Forge-native queue | mergetrain | |
|---|---|---|
| Primary unit | Pull/merge request | Committed local task branch |
| Validation | Forge merge group + remote CI | Local assembled train + shell gates |
| Review | Built-in conversation and approvals | No code-review UI |
| Infrastructure | Forge integration and hosted services | Local SQLite, Git worktrees, any Git remote |
| Best fit | PR-first teams and distributed review | High-throughput local agent integration |
The models can coexist: push a validated train to a review branch and open one PR, or reserve individual PRs for changes that need discussion. The PR workflow guide covers direct, one-PR, split-PR, and validation-only patterns.
refs/mergetrain/deploys/<sha> recovery ref update together.reconcile determine whether a killed push landed, without replaying
a successful deploy or calling a missing one shipped.--auto jobs whose destination and gate/reuse/verify policy
still match, and MCP deploy still requires attributable human confirmation.status projects internal detail into Waiting,
Running, Ready, Attention, and Done, and returns the next safe command.
inspect supplies job-level evidence only when it is needed.Queue state, locking, train assembly, and gates stay local. Your configured Git remote and post-push verification may still use external services. Gate and verify commands are trusted code; review the security boundary before enabling unattended jobs.
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/mergetrain)<a href="https://allmcps.com/mcp/mergetrain"><img src="https://allmcps.com/api/badge/mergetrain?style=directory" alt="Mergetrain on AllMCPs" /></a>