MCP integration
Stacked diffs, driven by AI agents.
stkd-mcp is a Model Context Protocol server that exposes every gt command as a
typed tool. Drop it into Claude Code, Cursor, or any MCP-capable agent and the model can structure work
as a stack — natively.
Quickstart
1. Install stkd-mcp
cargo install stkd-mcp 2. Wire it into Claude Code
Add this to ~/.claude.json (or claude_desktop_config.json):
{
"mcpServers": {
"stkd": {
"command": "stkd-mcp"
}
}
} 3. Restart Claude Code
You should see stkd appear in the tools menu with the sub-tools below.
The tool surface
Each tool is a typed function call. JSON Schema input and output. Agents compose them freely.
gt_create Create a branch stacked on top of the current branch.
gt_log Return the current stack as JSON: branches, parents, current pointer, PR numbers.
gt_modify Amend the current branch's tip commit with new changes.
gt_restack Rebase every dependent branch on top of its parent's latest tip.
gt_submit Push branches and create or update PRs / MRs. Supports --stack to submit the whole stack.
gt_sync Fetch origin, detect merged branches, clean up, and restack.
gt_land Merge the bottommost open PR; with --stack, merges every PR in order.
gt_continue Resume an in-progress restack after a conflict has been resolved.
gt_undo Roll back the last stkd mutation. Conservative — it remembers the last clean state.
Safe by default
stkd-mcp can do anything you can do — including pushing code. We assume that's intentional,
but we also ship four guardrails for restricting agent power:
Allow-list tools
"args": ["--tools=gt_log,gt_create"] Only the listed tools are exposed. Useful for "let the agent plan but not act."
Dry-run
"args": ["--dry-run"] Every mutating tool becomes a no-op that reports what would have happened.
Branch pattern lock
"args": ["--branch-pattern=claude/*"] The agent can only create branches matching the pattern. Your protected branches stay protected.
Repo allow-list
"args": ["--repo=~/code/safe/*"] Only repos matching the glob are exposed to the agent.
What agents actually do with it
- Split a big diff into a stack. Agent reads the working tree, identifies cohesive groups, lays out the stack, and submits.
- Sweep restacks. After
mainadvances, the agent iterates over your open stacks, runsgt_sync, and reports which ones now have conflicts. - Conflict triage. Agent reads the conflict markers, attempts trivial resolutions (imports, renames, formatting), and hands non-trivial ones back with a clear summary.
- CI babysitter. After
gt_submit, the agent polls PR statuses viagh/glaband surfaces failures the moment they happen.
Full walkthrough in Using stkd with Claude Code.
MCP FAQ
Agent-integration questions.
stkd-mcp exposes every stkd command as an MCP tool, so AI agents like Claude Code and Cursor can manage stacked pull requests without shelling out to the CLI. The agent sees structured input/output schemas and can chain operations safely.
Wire it up in under five minutes.
cargo install stkd-mcp, add 5 lines of JSON, restart Claude. That's the whole setup.