# Mergetrain

> Mergetrain is an MCP server for developer tools. Queue parallel-agent Git worktree branches, test them together and push once. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI
- **Repository:** https://github.com/yongjip/mergetrain
- **MCP Registry name:** io.github.yongjip/mergetrain
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-15

## About

Mergetrain is a local merge queue for several coding agents working in Git worktrees on one repository. Each agent commits and enqueues its branch, and a single runner merges branches in order, runs your configured gates on the combined result, and updates refs atomically only after explicit approval. Everything stays on your machine, with no account, hosted control plane or telemetry.

Two modes exist. Batch, the default, lands whatever is queued together, so passing work can land while a failed branch is repaired. Ordered, available from 3.6.0, lands one submission at a time and keeps original order across a retry. Lease tokens fence stale runners, and the README is candid that they cannot stop an agent with push credentials from bypassing the queue; it recommends separate deploy credentials and a protected branch.

Run `uvx mergetrain demo` for a throwaway repository walkthrough. It works with Codex, Claude Code and scripts through the same CLI and JSON contract. For PR-first teams, the README points to GitHub Merge Queue or GitLab Merge Trains.

## Features

- **Durable local queue:** Branches wait in a queue that survives restarts.
- **Combined gates:** Tests run on the merged result, not each branch.
- **Batch or ordered:** Pick landing behaviour per workflow.
- **Atomic push:** Refs update once after explicit approval.
- **Push recovery:** Recovers when a push is interrupted.
- **Demo command:** uvx mergetrain demo runs a disposable repo.

## Good for

- Land branches from several Claude Code sessions safely
- Catch failures that only appear when branches combine
- Stop push races between agents
- Recover from a laptop dying mid-push

## Install

### Claude Code (Terminal)

```sh
claude mcp add mergetrain -- uvx mergetrain
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mergetrain": {
      "command": "uvx",
      "args": [
        "mergetrain"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mergetrain": {
      "command": "uvx",
      "args": [
        "mergetrain"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mergetrain": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mergetrain"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mergetrain": {
      "command": "uvx",
      "args": [
        "mergetrain"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mergetrain": {
      "command": "uvx",
      "args": [
        "mergetrain"
      ]
    }
  }
}
```

## FAQ

### Does Mergetrain need an account?

No account, hosted service, OAuth app or telemetry.

### Does Mergetrain block a direct git push?

Not by itself; use separate credentials and a protected branch.

### Batch or ordered?

Start with batch; use ordered when original submission order must survive a failure.

### When is Mergetrain unnecessary?

When one agent lands one branch at a time or a forge merge queue already covers it.

### How do I add Mergetrain to Claude Code?

Run this command in your terminal: claude mcp add mergetrain -- uvx mergetrain

### What are the best alternatives to Mergetrain?

The closest alternatives to Mergetrain are Git Tools, Cork, Standup Mr, Quorus and Gitwand.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Git Tools](https://ai-powered.com/mcp/git-tools): Git Tools is an open-source MCP server for developer tools.
- [Cork](https://ai-powered.com/mcp/cork-2): Cork is a freemium MCP server for developer tools.
- [Standup Mr](https://ai-powered.com/mcp/standup-mr): Standup Mr is an open-source MCP server for developer tools.
- [Quorus](https://ai-powered.com/mcp/quorus): Quorus is an open-source MCP server for developer tools.
- [Gitwand](https://ai-powered.com/mcp/gitwand): Gitwand is an MCP server for developer tools.
- [Tracetoon](https://ai-powered.com/mcp/tracetoon): Tracetoon is an open-source MCP server for developer tools.
- [graftfork](https://ai-powered.com/mcp/graftfork): graftfork is a freemium MCP server for developer tools.
- [GitWarren](https://ai-powered.com/mcp/gitwarren): GitWarren is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/mergetrain
