Git MCP Server

Git MCP Server

git-mcp-server-wty0512•bywty0512

An MCP server that exposes Git repository operations and data as tools and resources for AI assistants and LLM agents.

License: Apache License 2.0•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides repository tools to initialize, clone, and check the status of Git repositories.
  • •Exposes branch operations including creating, listing, checking out, deleting, and merging branches.
  • •Supports working directory operations such as staging files, committing changes, and creating diffs.
  • •Offers remote operations and advanced commands like tags, stash, cherry-pick, and rebase.

BEST FOR

  • •AI assistants that need to manage Git repositories without direct filesystem or command-line access.
  • •LLM agents performing branch, commit, and remote operations through MCP tools.
  • •Clients that need to read repository information, file content, diffs, and commit history via MCP resources.

ABOUT GIT-MCP-SERVER-WTY0512

Git MCP Server is cataloged as an MCP server attributed to wty0512. An MCP server that exposes Git repository operations and data as tools and resources for AI assistants and LLM agents. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Apache License 2.0. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Git MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What transports does the Git MCP Server use to communicate?

It communicates through stdin/stdout using the Model Context Protocol, making it compatible with any MCP client.

What Git data can be accessed as MCP resources?

Resources cover repository info, branches, remotes, tags, file content, directory listings, diffs, commit history, file blame, and commit details.

Does the server require Git to be installed?

Yes, the prerequisites list Git installed and available in the PATH along with Node.js 16 or higher.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0a7dd20481cc · 采集于 2026-11-13 12:57:29 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

GIT MCP Server

TypeScript Model Context Protocol Version License Status GitHub

A Model Context Protocol (MCP) server that provides tools for interacting with Git repositories. This server allows AI assistants and LLM agents to manage repositories, branches, commits, and files through a standardized interface without requiring direct filesystem or command-line access. It exposes Git operations as MCP resources and tools while maintaining proper security boundaries.

Table of Contents

Overview

Key capabilities:

  • Repository Management: Initialize, clone, and check repository status
  • Branch Operations: Create, list, checkout, delete, and merge branches
  • Working Directory: Stage files, commit changes, create diffs
  • Remote Operations: Add remotes, fetch, pull, push
  • Advanced Git Commands: Manage tags, stash changes, cherry-pick, rebase

Architecture & Components

Core system architecture:

Click to expand Mermaid diagram
flowchart TB
    subgraph API["API Layer"]
        direction LR
        MCP["MCP Protocol"]
        Val["Validation"]

        MCP --> Val
    end

    subgraph Core["Core Services"]
        direction LR
        GitService["Git Service"]
        ErrorService["Error Service"]

        GitService <--> ErrorService
    end

    subgraph Resources["Resource Layer"]
        direction LR
        Repo["Repository Resources"]
        Diff["Diff Resources"]
        File["File Resources"]
        History["History Resources"]

        Repo <--> Diff
        Repo <--> File
        Repo <--> History
    end

    subgraph Tools["Tool Layer"]
        direction LR
        RepoTools["Repository Tools"]
        BranchTools["Branch Tools"]
        WorkdirTools["Working Directory Tools"]
        RemoteTools["Remote Tools"]
        AdvancedTools["Advanced Tools"]

        RepoTools <--> BranchTools
        BranchTools <--> WorkdirTools
        WorkdirTools <--> RemoteTools
        RemoteTools <--> AdvancedTools
    end

    Val --> GitService
    GitService --> Resources
    GitService --> Tools

    classDef layer fill:#2d3748,stroke:#4299e1,stroke-width:3px,rx:5,color:#fff
    classDef component fill:#1a202c,stroke:#a0aec0,stroke-width:2px,rx:3,color:#fff
    classDef api fill:#3182ce,stroke:#90cdf4,stroke-width:2px,rx:3,color:#fff
    classDef core fill:#319795,stroke:#81e6d9,stroke-width:2px,rx:3,color:#fff
    classDef resource fill:#2f855a,stroke:#9ae6b4,stroke-width:2px,rx:3,color:#fff
    classDef tool fill:#805ad5,stroke:#d6bcfa,stroke-width:2px,rx:3,color:#fff

    class API,Core,Resources,Tools layer
    class MCP,Val api
    class GitService,ErrorService core
    class Repo,Diff,File,History resource
    class RepoTools,BranchTools,WorkdirTools,RemoteTools,AdvancedTools tool

Core Components:

  • MCP Server: Uses the Model Context Protocol SDK to create a server that exposes resources and tools
  • Git Service: Abstraction layer over simple-git to provide clean interfaces for Git operations
  • Resources: Expose Git data through MCP resources with consistent URI templates
  • Tools: Expose Git operations through MCP tools with well-defined schemas
  • Error Handling: Standardized error handling and reporting

Features

Resource Access

Expose Git repository information through MCP resources:

  • Repository Information: Access basic Git repository information including current branch, status, and reference details
  • Repository Branches: List all branches in the repository with current branch indicator
  • Repository Remotes: List all configured remote repositories with their URLs
  • Repository Tags: List all tags in the repository with their references
  • File Content: Access content of specific files at a given Git reference
  • Directory Listing: View lists of files and directories at a specific path and reference
  • Diffs: Get differences between references, unstaged changes, or staged changes
  • Commit History: View detailed commit logs with author, date, and message information
  • File Blame: See line-by-line attribution showing which commit last modified each line
  • Commit Details: Access detailed information about specific commits including diff changes

Git Operations

Execute Git commands through MCP tools:

  • Repository Operations: Initialize repositories, clone from remotes, check repository status
  • Branch Operations: Create branches, list branches, checkout, delete branches, merge
  • Working Directory Operations: Stage files, unstage files, commit changes, create diffs
  • Remote Operations: Add remotes, list remotes, fetch, pull, push
  • Advanced Operations: Manage tags, stash changes, cherry-pick commits, rebase branches, reset, clean

Installation

Prerequisites

  • Node.js 16 or higher
  • Git installed and available in the PATH

Install from NPM

npm install -g git-mcp-server

Install from Source

git clone https://github.com/cyanheads/git-mcp-server.git
cd git-mcp-server
npm install
npm run build

Usage

Running the Server

git-mcp-server

The server communicates through stdin/stdout using the Model Context Protocol, making it compatible with any MCP client.

Integration with Claude

Add to your Claude configuration file:

{
  "mcpServers": {
    "git": {
      "command": "git-mcp-server",
      "args": [],
      "env": {},
      "disabled": false
    }
  }
}

Integration with Other MCP Clients

Use the MCP inspector to test the server:

npx @modelcontextprotocol/inspector git-mcp-server

Project Structure

The codebase follows a modular structure:

git-mcp-server/
├── src/
│   ├── index.ts           # Entry point
│   ├── server.ts          # MCP server implementation
│   ├── resources/         # Resource implementations
│   │   ├── descriptors.ts # Resource URI templates
│   │   ├── diff.ts        # Diff-related resources
│   │   ├── file.ts        # File-related resources
│   │   ├── history.ts     # History-related resources
│   │   ├── index.ts       # Resource registration
│   │   └── repository.ts  # Repository resources
│   ├── services/          # Service implementations
│   │   ├── error-service.ts # Error handling
│   │   └── git-service.ts   # Git operations abstraction
│   ├── tools/             # Tool implementations
│   │   ├── advanced.ts    # Advanced Git operations
│   │   ├── branch.ts      # Branch operations
│   │   ├── index.ts       # Tool registration
│   │   ├── remote.ts      # Remote operations
│   │   ├── repository.ts  # Repository operations
│   │   └── workdir.ts     # Working directory operations
│   ├── types/             # Type definitions
│   │   └── git.ts         # Git-related types
│   └── utils/             # Utility functions
│       └── validation.ts  # Input validation
└── scripts/               # Development scripts

Tools

Git MCP Server provides a comprehensive suite of tools for Git operations:

Repository Operations

ToolDescription
git_initInitialize a new Git repository at the specified path with options for bare repositories.
git_cloneClone a Git repository from a remote URL to a local path with branch and depth options.
git_statusGet the current status of a Git repository including working directory and staging area changes.

Branch Operations

ToolDescription
git_branch_listList all branches in a repository with options to include remote branches.
git_branch_createCreate a new branch with options for specifying the starting point and automatic checkout.
git_checkoutCheckout a branch, tag, or commit with options to create a new branch during checkout.
git_branch_deleteDelete a branch with options for force deletion of unmerged branches.
git_mergeMerge a branch into the current branch with customizable commit messages and merge strategies.

Working Directory Operations

ToolDescription
git_addStage files for commit with support for individual files or entire directories.
git_resetUnstage files from the staging area with options for specific files or all staged changes.
git_commitCommit staged changes with customizable commit messages, author information, and amend options.
git_diff_unstagedGet a diff of all unstaged changes in the working directory with options for specific files.
git_diff_stagedGet a diff of all staged changes in the index with options for specific files.
git_reset_commitReset the repository to a specific reference with options for hard, soft, or mixed mode.
git_cleanRemove untracked files from the working tree with options for directories and force cleaning.

Remote Operations

ToolDescription
git_remote_addAdd a new remote repository with a name and URL.
git_remote_listList all configured remote repositories and their URLs.
git_fetchFetch updates from a remote repository with options for specific branches.
git_pullPull changes from a remote repository with options for rebase strategy.
git_pushPush local changes to a remote repository with options for force push and upstream tracking.

Advanced Operations

ToolDescription
git_tag_createCreate a new tag with options for annotated tags with messages.
git_tag_listList all tags in the repository with their references.
git_stash_createStash changes in the working directory with options for untracked files and descriptions.
git_stash_listList all stashes in the repository with their descriptions.
git_stash_applyApply a stashed change without removing it from the stash list.
git_stash_popApply a stashed change and remove it from the stash list.
git_cherry_pickApply changes from specific commits to the current branch.
git_rebaseRebase the current branch onto another branch with interactive mode options.
git_logGet commit history with customizable output format and depth.
git_showShow detailed information about a specific commit including diff changes.

Resources

Git MCP Server exposes Git data through standard MCP resources:

Repository Resources

ResourceDescription
git://repo/{repoPath}/infoBasic Git repository information including current branch, status, and reference details
git://repo/{repoPath}/branchesList of all branches in the repository with current branch indicator
git://repo/{repoPath}/remotesList of all configured remote repositories with their URLs
git://repo/{repoPath}/tagsList of all tags in the repository with their references
git://repo/{repoPath}/file/{filePath}?ref={ref}Returns the content of a specific file at a given Git reference
git://repo/{repoPath}/ls/{dirPath}?ref={ref}Returns a list of files and directories at a specific path and reference
git://repo/{repoPath}/diff/{fromRef}/{toRef}?path={path}Returns a diff between two Git references (commits, branches, tags)
git://repo/{repoPath}/diff-unstaged?path={path}Returns a diff of all unstaged changes in the working directory
git://repo/{repoPath}/diff-staged?path={path}Returns a diff of all staged changes in the index
git://repo/{repoPath}/log?maxCount={maxCount}&file={file}Returns the commit history log with author, date, and message details
git://repo/{repoPath}/blame/{filePath}Returns line-by-line attribution showing which commit last modified each line
git://repo/{repoPath}/commit/{commitHash}Returns detailed information about a specific commit including diff changes

Development

Build and Test

# Build the project
npm run build

# Watch for changes
npm run watch

# Test with MCP inspector
npm run inspector

# Clean build artifacts
npm run clean

# Rebuild completely
npm run rebuild

License

Apache License 2.0 - See LICENSE for details.


Built with the Model Context Protocol

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Git MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/git-mcp-server-wty0512)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools