Provides automated Git workflow tools for committing staged changes, pushing to remote repositories, and managing branches with comprehensive error handling and rollback capabilities.
Enables automated GitHub operations including creating pull requests, merging PRs with different merge strategies, and managing branch lifecycle with proper authentication handling through GitHub CLI.
Git Workflow Automation MCP Server
A Model Context Protocol (MCP) server that provides automated Git workflow tools for committing, creating pull requests, and merging with proper GitHub authentication handling.
Features
- Automated Git Operations: Commit, push, create PRs, and merge in one command
- GitHub Authentication Handling: Automatically clears problematic environment tokens
- Dry Run Support: Test operations before executing them
- Conventional Commits: Supports proper commit message formatting
- Branch Management: Automatic branch creation and switching
- Error Handling: Comprehensive error reporting and rollback capabilities
Available Tools
1. git_commit_and_push
Commits staged changes and pushes to remote repository.
Parameters:
files
(array, optional): File paths to commit (empty for all changes)commitMessage
(string, required): Commit message (use conventional format)branch
(string, optional): Branch name to create/switch toworkingDir
(string, optional): Working directory pathdryRun
(boolean, optional): Preview without executing
Example:
2. create_pull_request
Creates a GitHub pull request with proper authentication handling.
Parameters:
title
(string, required): Pull request titlebody
(string, required): Pull request descriptionbaseBranch
(string, optional): Base branch (default: "main")headBranch
(string, optional): Head branch (defaults to current)workingDir
(string, optional): Working directory pathdryRun
(boolean, optional): Preview without executing
Example:
3. merge_pull_request
Merges a GitHub pull request.
Parameters:
prNumber
(string, required): Pull request numbermergeMethod
(string, optional): "merge", "squash", or "rebase" (default: "merge")deleteBranch
(boolean, optional): Delete branch after merge (default: true)workingDir
(string, optional): Working directory pathdryRun
(boolean, optional): Preview without executing
Example:
4. complete_git_workflow
Executes the complete Git workflow: commit, push, create PR, and optionally merge.
Parameters:
files
(array, optional): Files to commitcommitMessage
(string, required): Commit message (conventional format)prTitle
(string, required): Pull request titleprBody
(string, required): Pull request descriptionbranch
(string, optional): Feature branch namebaseBranch
(string, optional): Base branch (default: "main")autoMerge
(boolean, optional): Automatically merge PR (default: false)workingDir
(string, optional): Working directory pathdryRun
(boolean, optional): Preview without executing
Example:
Installation
Quick Setup
- Clone the Repository
- Install Dependencies
- Build the Server
- Add to MCP ConfigurationAdd the server to your MCP client settings file:
Alternative: NPM Global Install (Coming Soon)
Future versions will support global npm installation:
Configuration Paths
Common MCP Settings Locations:
- Roo-Code:
%APPDATA%/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json
- Claude Desktop:
%APPDATA%/Claude/claude_desktop_config.json
- Other MCP Clients: Check your client's documentation for settings location
Verify Installation
Test the installation with a dry run:
Prerequisites
- Node.js installed
- Git configured with remote repository
- GitHub CLI (
gh
) installed and authenticated - Proper GitHub repository permissions
Authentication
The server automatically handles GitHub authentication issues by:
- Clearing problematic environment tokens (
GITHUB_TOKEN
,GH_TOKEN
) - Using PowerShell commands for reliable token management
- Relying on GitHub CLI keyring authentication
- Providing detailed error messages for authentication failures
Best Practices
1. Always Use Dry Run First
2. Use Conventional Commits
3. Meaningful PR Titles and Descriptions
Error Handling
The server provides comprehensive error handling:
- Git Repository Errors: Validates repository state
- Authentication Failures: Handles GitHub CLI auth issues
- Network Issues: Provides clear error messages
- Branch Conflicts: Manages branch creation/switching
- Merge Conflicts: Reports merge issues clearly
Dependencies
@modelcontextprotocol/sdk
: MCP server frameworksimple-git
: Git operationsaxios
: HTTP requests (if needed)zod
: Schema validation
Development
To modify the server:
- Edit
src/index.ts
- Run
npm run build
- Restart your MCP client
Support
For issues or questions:
- Check GitHub CLI authentication:
gh auth status
- Verify repository permissions
- Review error messages for specific guidance
- Test with dry run mode first
Version
Version 0.1.0 - Initial release with core Git workflow automation features.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Provides automated Git workflow tools for committing, creating pull requests, and merging with proper GitHub authentication handling. Supports complete Git workflows from commit to merge with dry run capabilities and conventional commit formatting.
Related MCP Servers
- -securityFlicense-qualityEnables interaction with GitHub through the GitHub API, supporting file operations, repository management, advanced search, and issue tracking with comprehensive error handling and automatic branch creation.Last updated -94631TypeScript
- AsecurityFlicenseAqualityEnables comprehensive GitHub operations through natural language including file management, repository administration, issue tracking, and advanced code searching.Last updated -4701TypeScript
- -securityAlicense-qualityEnables interaction with GitHub repositories through the GitHub API, allowing file operations, repository management, issue tracking, and code search through natural language commands.Last updated -32TypeScriptMIT License
- -securityAlicense-qualityProvides a comprehensive API wrapper for GitHub operations through a FastMCP-based server, simplifying repository management, pull requests, issues, and other GitHub interactions with secure authentication.Last updated -4PythonGPL 3.0