# Mergetrain

A local integration queue for parallel agents in Git worktrees. It runs gate checks on combined branch updates before atomic pushes.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6
- Author: yongjip
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/yongjip/mergetrain
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/mergetrain

## What it does

Git worktrees allow multiple agents to modify a project simultaneously, yet coordinating their final landings remains difficult. Mergetrain organizes finished branches into a local queue, merges them inside an isolated integration tree, and executes verification gates against the combined output.

The runner defaults to batch execution. Healthy branch submissions land together while any failing branch returns to its author for corrections. Starting with version 3.6.0, an optional ordered setup processes submissions individually to preserve precise arrival order across retries.

All state and queue artifacts stay entirely on your local machine. Git references update strictly upon explicit operator approval, preventing unattended pushes to upstream remotes.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mergetrain -- uvx mergetrain
```
uvx runs the command named after the package; if the README names another one, use uvx --from mergetrain <command>

### Codex

**Platform CLI**
```bash
codex mcp add mergetrain -- uvx mergetrain
```
uvx runs the command named after the package; if the README names another one, use uvx --from mergetrain <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mergetrain": {
            "command": "uvx",
            "args": [
                "mergetrain"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from mergetrain <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mergetrain": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "mergetrain"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from mergetrain <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add mergetrain uvx mergetrain
```
uvx runs the command named after the package; if the README names another one, use uvx --from mergetrain <command>

## When to use it
- prevent race conditions during simultaneous Git pushes
- validate combined branch changes in an isolated worktree
- ship passing patches while isolating broken tasks for repairs
- coordinate commits across multiple agent worktrees locally

## Example prompts
- Enqueue the current worktree branch into Mergetrain
- Check the integration queue status across active branches
- Run verification gates on the joined branch batch before pushing

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [GitDiagram](https://affpapa.org/en/nevibecode/mcp/gitdiagram.md) — MCP server · ★ 18511
- [Repowise](https://affpapa.org/en/nevibecode/mcp/repowise.md) — MCP server · ★ 7925
- [sem](https://affpapa.org/en/nevibecode/mcp/sem.md) — MCP server · ★ 3427
- [GitLab MCP Server](https://affpapa.org/en/nevibecode/mcp/gitlab-mcp-server.md) — MCP server · ★ 2068
- [Octocode MCP - AI Context Platform](https://affpapa.org/en/nevibecode/mcp/octocode-mcp-ai-context-platform.md) — MCP server · ★ 955

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
