modelcontextprotocol / modelcontextprotocol/servers
mcp-server-git: add `git_merge` tool
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Is your feature request related to a problem? Please describe.
I've been using mcp-server-git for local development, it's freakin' awesome, great job everyone. But I don't see git_merge as a tool, I'm wondering if there is any good reason why it's not included at the moment? I can do checkout, status, commit, etc. so it seems like it would be a great thing for my local workflow.
Describe the solution you'd like
Add a git_merge tool that takes these inputs:
repo_path (string): Path to Git repository
source_branch (string): Name of branch to merge FROM. (git merge foo) if source_branch = foo
target_branch (string): Name of the branch to merge INTO (by default, the current working branch)
ff-only (boolean): Whether to require the merge to be ff-only (true by default)
squash (boolean): Whether the merge should be a squash (false by default)
Returns: Confirmation of git merge <source_branch> --ff-only command, or a message describing why the merge failed (merge conflict encountered, merge is not fast-forward when ff-only = true, source_branch does not exist), etc.
If any of these conditions are not met, or there are conflicts, the merge will be aborted with git merge --abort.
Describe alternatives you've considered
None (or just do it manually).
Additional context
For an initial implementation, due to the nuances of merging, the tool can be configured to ONLY allow ff-only from source_branch to target_branch, where target_branch is the current checked-out branch, and will fail if there are any conflicts, if the merge is not fast-forward, if target_branch is not the current branch (as revealed by git_status), etc. Basically, this will ONLY succeed if I have a local branch dev and I am on main and I can successfully run git merge dev --ff-only. I can imagine a lot of ways to enhance this tool, but this would still be a really useful addition, even in this primitive form.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the existing mcp-server-git tools, especially checkout, status, and commit, to understand their inputs, current-branch handling, and failure reporting. Implement the initial current-branch-only, ff-only merge behavior described here, including aborting unsuccessful merges, and verify success and failure messages for missing branches, non-fast-forward merges, conflicts, and an invalid target branch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100