Git Workflow Automation MCP Server

Git Workflow Automation MCP Server

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.

Category
访问服务器

README

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 to
  • workingDir (string, optional): Working directory path
  • dryRun (boolean, optional): Preview without executing

Example:

use_mcp_tool("git-workflow", "git_commit_and_push", {
  "files": ["src/app.ts", "README.md"],
  "commitMessage": "feat: add new authentication system",
  "branch": "feature/auth-system",
  "dryRun": true
})

2. create_pull_request

Creates a GitHub pull request with proper authentication handling.

Parameters:

  • title (string, required): Pull request title
  • body (string, required): Pull request description
  • baseBranch (string, optional): Base branch (default: "main")
  • headBranch (string, optional): Head branch (defaults to current)
  • workingDir (string, optional): Working directory path
  • dryRun (boolean, optional): Preview without executing

Example:

use_mcp_tool("git-workflow", "create_pull_request", {
  "title": "Feature: User Authentication System",
  "body": "Implements comprehensive user authentication with JWT tokens and OAuth2 support",
  "baseBranch": "main",
  "headBranch": "feature/auth-system"
})

3. merge_pull_request

Merges a GitHub pull request.

Parameters:

  • prNumber (string, required): Pull request number
  • mergeMethod (string, optional): "merge", "squash", or "rebase" (default: "merge")
  • deleteBranch (boolean, optional): Delete branch after merge (default: true)
  • workingDir (string, optional): Working directory path
  • dryRun (boolean, optional): Preview without executing

Example:

use_mcp_tool("git-workflow", "merge_pull_request", {
  "prNumber": "42",
  "mergeMethod": "squash",
  "deleteBranch": true
})

4. complete_git_workflow

Executes the complete Git workflow: commit, push, create PR, and optionally merge.

Parameters:

  • files (array, optional): Files to commit
  • commitMessage (string, required): Commit message (conventional format)
  • prTitle (string, required): Pull request title
  • prBody (string, required): Pull request description
  • branch (string, optional): Feature branch name
  • baseBranch (string, optional): Base branch (default: "main")
  • autoMerge (boolean, optional): Automatically merge PR (default: false)
  • workingDir (string, optional): Working directory path
  • dryRun (boolean, optional): Preview without executing

Example:

use_mcp_tool("git-workflow", "complete_git_workflow", {
  "files": ["src/**/*.ts", "docs/**/*.md"],
  "commitMessage": "feat(auth): implement OAuth2 authentication",
  "prTitle": "Feature: OAuth2 Authentication System",
  "prBody": "Adds comprehensive OAuth2 authentication with Google and GitHub providers",
  "branch": "feature/oauth2-auth",
  "autoMerge": false,
  "dryRun": true
})

Installation

Quick Setup

  1. Clone the Repository

    git clone https://github.com/Arcia125/git-workflow-mcp-server.git
    cd git-workflow-mcp-server
    
  2. Install Dependencies

    npm install
    
  3. Build the Server

    npm run build
    
  4. Add to MCP Configuration

    Add the server to your MCP client settings file:

    {
      "mcpServers": {
        "git-workflow": {
          "command": "node",
          "args": ["/path/to/git-workflow-mcp-server/build/index.js"],
          "disabled": false,
          "alwaysAllow": [],
          "disabledTools": []
        }
      }
    }
    

Alternative: NPM Global Install (Coming Soon)

Future versions will support global npm installation:

npm install -g git-workflow-mcp-server

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:

use_mcp_tool("git-workflow", "git_commit_and_push", {
  "files": ["README.md"],
  "commitMessage": "test: verify MCP server installation",
  "dryRun": true
})

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:

  1. Clearing problematic environment tokens (GITHUB_TOKEN, GH_TOKEN)
  2. Using PowerShell commands for reliable token management
  3. Relying on GitHub CLI keyring authentication
  4. Providing detailed error messages for authentication failures

Best Practices

1. Always Use Dry Run First

// Test the operation first
use_mcp_tool("git-workflow", "complete_git_workflow", {
  "commitMessage": "feat: add new feature",
  "prTitle": "New Feature",
  "prBody": "Description",
  "dryRun": true
})

// Then execute after confirmation
use_mcp_tool("git-workflow", "complete_git_workflow", {
  "commitMessage": "feat: add new feature",
  "prTitle": "New Feature",
  "prBody": "Description",
  "dryRun": false
})

2. Use Conventional Commits

// Good commit messages:
"feat(auth): add OAuth2 integration"
"fix(ui): resolve button alignment issue"
"docs(api): update endpoint documentation"
"refactor(utils): simplify date formatting"

3. Meaningful PR Titles and Descriptions

{
  "prTitle": "Feature: OAuth2 Authentication System",
  "prBody": "## Changes\n- Implements OAuth2 with Google/GitHub\n- Adds JWT token management\n- Updates user authentication flow\n\n## Testing\n- All auth tests pass\n- Manual testing completed"
}

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 framework
  • simple-git: Git operations
  • axios: HTTP requests (if needed)
  • zod: Schema validation

Development

To modify the server:

  1. Edit src/index.ts
  2. Run npm run build
  3. 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选