Skip to content

mcp-server-git: add git_merge tool #659

Open
@hesreallyhim

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions