Add git_push tool to Git MCP server #2961
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves Feature Request: Add push to git mcp #618
Description
This PR implements the
git_pushtool for the Git MCP server, enabling users to push branches to remote repositories. This addresses issue #618 where users need the ability to push branches remotely to support integration with other MCPs that create pull requests.Server Details
Motivation and Context
Users working with multiple MCPs need the ability to push branches to remote repositories before creating pull requests through other tools. The Git MCP server previously lacked this functionality, limiting its utility in CI/CD and automation workflows. This feature enables seamless integration with other MCPs that depend on remote branch existence.
How Has This Been Tested?
test_git_push_no_remote()unit test to verify error handling when pushing to a non-existent remoteBreaking Changes
No breaking changes. This is a new tool addition that does not affect existing functionality.
Types of changes
Checklist
Additional context
The implementation uses GitPython's
repo.git.push()method with dynamic argument construction to support:-uflagAll parameters are optional with sensible defaults, making the tool flexible for various use cases.
Built with Zencoder