git-mcp-server

mxxx222/git-mcp-server

3.2

If you are the rightful owner of git-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A comprehensive Model Context Protocol (MCP) server that provides Git operations through a standardized interface.

Tools
14
Resources
0
Prompts
0

Git MCP Server

A comprehensive Model Context Protocol (MCP) server that provides Git operations through a standardized interface. This server enables AI assistants to interact with Git repositories programmatically.

Features

  • Complete Git Operations: Status, log, branch management, commit operations
  • Remote Repository Management: Clone, push, pull, remote configuration
  • Advanced Git Features: Stash, tag management, reset operations, diff viewing
  • Working Directory Control: Operate on any Git repository path
  • Type-Safe Implementation: Built with TypeScript for reliability

Installation

  1. Clone or download this repository
  2. Install dependencies:
    npm install
    
  3. Build the TypeScript code:
    npm run build
    
  4. Start the server:
    npm start
    

Available Tools

Repository Status

  • git_status - Get git status of a repository
  • git_log - Show commit history with configurable formatting
  • git_branch - List all branches (local and remote)
  • git_diff - Show changes between commits or working tree

Staging and Committing

  • git_add - Stage files for commit (specific files or all changes)
  • git_commit - Create new commits with messages
  • git_stash - Save/apply/drop changes temporarily

Repository Management

  • git_init - Initialize new repositories
  • git_clone - Clone remote repositories
  • git_push - Push commits to remote branches
  • git_pull - Fetch and merge changes from remote
  • git_remote - Add/remove/rename remote repositories
  • git_reset - Reset current HEAD to specified state
  • git_tag - Create/delete/list tags

Usage Examples

Check Repository Status

{
  "tool": "git_status",
  "arguments": {
    "cwd": "/path/to/repository"
  }
}

Create a Commit

{
  "tool": "git_commit",
  "arguments": {
    "message": "Add new feature implementation",
    "cwd": "/path/to/repository"
  }
}

Clone a Repository

{
  "tool": "git_clone",
  "arguments": {
    "url": "https://github.com/user/repo.git",
    "cwd": "/local/path",
    "depth": 1
  }
}

Configuration

The server automatically detects the current working directory but allows specifying alternative paths for repository operations.

Requirements

  • Node.js 18+ (for ES modules support)
  • Git installed and available in PATH
  • TypeScript 5.0+ (for building)

Development

For development mode with automatic rebuilding:

npm run dev

License

MIT License - feel free to use in your projects.