mait.sh1.69.2

Private beta: features and content may change. No warranty; use at your own risk.

Docs / Agent tools (MCP)

MCP Git

Give an assistant structured Git operations and keep the checkout's changes available for human review.

For engineering agents and reviewers working across repositories and worktrees.

Read from the top for the basics; the later sections go deeper.

Beta

What it doesBasics

  • Status, diff, log, and branch inspection
  • Scoped staging and commits
  • Remote synchronization
  • Worktree-aware repository discovery
  • Structured bounded evidence for review

First useBasics

  1. Inspect the intended checkout and a bounded diff before staging or committing anything.
  2. Preview the exact files and operation.
  3. Mutate only after the surrounding workflow authorizes it.

Everyday tasksEveryday use

Create a reviewed agent commit

An agent has changed approved files and needs to commit without sweeping unrelated work into the result.

  1. Inspect branch, worktree, and staged state.
  2. Review bounded diffs for the intended paths.
  3. Commit only those paths with a conventional-commit subject.
  4. Inspect the resulting commit and remaining worktree changes.

What you getThe intended change is committed while unrelated files remain visible and untouched.

How to check: Pre-commit status and diff, returned commit identifier, and post-commit status.

Plan and complete a feature-branch rebase

A feature branch must be reconciled with the expected develop baseline without hiding conflicts.

  1. Inspect the branch and require a clean worktree.
  2. Request the rebase plan against the supported baseline.
  3. Start the reviewed plan.
  4. Resolve any surfaced conflicts and continue, or abort to restore the prior state.
  5. Inspect history and status before any push.

What you getHistory changes follow an explicit plan with a recoverable abort path.

How to check: Rebase plan and status, conflict details if any, final history, and clean-state inspection.

Settings to decideAdvanced

Repository context
Resolve the exact repository and worktree before inspection or mutation.
Inspection bounds
Select file, line, and byte limits appropriate to review, and treat truncation as a prompt to narrow the query.
Repository policy
Keep protected branches, clean-checkout requirements, conventional commits, and force-push prohibitions visible to callers.
Remote credentials
Use the configured SSH agent or credential-helper chain, which keeps secrets out of tool arguments.

CommandsAdvanced

$ mcp-git version
$ mcp-git serve
$ git_inspect({"with_diff":false})
$ git_diff({"from":"develop","to":"HEAD"})
$ git_commit({"message":"fix(scope): describe change","paths":["path/to/file"]})
$ git_inspect({"with_diff":false})

Problems and fixesHelp

What you seeCheckFix
A branch checkout is refused.Inspect staged, unstaged, untracked, stash, and rebase state.Finish or safely preserve outstanding work, then retry from a clean non-rebasing state.
A push is blocked before contacting the remote.Inspect the target branch and whether force was requested.Use an allowed feature-branch target and a non-force workflow; protected-branch policy is intentional.
A rebase pauses with conflicts.Inspect rebase status and the exact conflicting paths.Resolve and continue only after review, or abort the rebase to return to the prior state.
Fetch or push cannot authenticate.Inspect remote URL and the configured SSH-agent or credential-helper availability.Repair credentials outside tool arguments, then retry the same bounded remote operation.
What you see
A branch checkout is refused.
Check
Inspect staged, unstaged, untracked, stash, and rebase state.
Fix
Finish or safely preserve outstanding work, then retry from a clean non-rebasing state.
What you see
A push is blocked before contacting the remote.
Check
Inspect the target branch and whether force was requested.
Fix
Use an allowed feature-branch target and a non-force workflow; protected-branch policy is intentional.
What you see
A rebase pauses with conflicts.
Check
Inspect rebase status and the exact conflicting paths.
Fix
Resolve and continue only after review, or abort the rebase to return to the prior state.
What you see
Fetch or push cannot authenticate.
Check
Inspect remote URL and the configured SSH-agent or credential-helper availability.
Fix
Repair credentials outside tool arguments, then retry the same bounded remote operation.

All MCP Git problems and fixes →

Good to knowHelp

  • The tool works alongside your repository policy and approval gates.
  • Credentials stay in the configured Git environment.
  • Repository mutations are serialized.