Cover image
Try Now
2024-12-17

Espejo dehttps: //github.com/cyanheads/git-mcp-server

3 years

Works with Finder

0

Github Watches

1

Github Forks

0

Github Stars

Git MCP Server

TypeScript Model Context Protocol License Status

A Model Context Protocol server that provides comprehensive Git functionality to Large Language Models, enabling them to perform version control operations through a secure and standardized interface.

Table of Contents

Overview

Model Context Protocol Server

The Git MCP Server implements the Model Context Protocol (MCP), created by Anthropic, which provides a standardized communication protocol between LLMs and external systems. The architecture consists of:

  • Clients (Claude Desktop, IDEs) that maintain server connections
  • Servers that provide tools and resources to clients
  • LLMs that interact with servers through client applications

This architecture creates a secure boundary between LLMs and external systems while enabling controlled access to Git functionality. Through the MCP protocol, the Git server empowers LLMs to perform version control operations, manage repositories, and handle complex Git workflows — all within a secure and validated environment.

Features

Core Git Operations

  • Repository initialization and cloning
  • File staging and committing
  • Branch management
  • Remote operations
  • Tag handling
  • Stash management

Bulk Operations

  • Sequential operation execution
  • Atomic commits
  • Smart defaults
  • Error resilience

Safety Features

  • Path validation
  • Repository state verification
  • Embedded repository handling
  • Comprehensive error reporting

Installation

Setup Steps

  1. Clone the repository:
git clone https://github.com/cyanheads/git-mcp-server.git
  1. Navigate to the project directory:
cd git-mcp-server
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

The server is now ready to be configured and used with your MCP client.

Configuration

The Git MCP Server requires configuration in your MCP client settings:

{
  "mcpServers": {
    "git": {
      "command": "node",
      "args": ["/path/to/git-mcp-server/build/index.js"],
      "env": {
        "GIT_DEFAULT_PATH": "/optional/default/path/for/git/operations"
      }
    }
  }
}

Environment Variables

Variable Description Required
GIT_DEFAULT_PATH Default path for Git operations No

Path Requirements

All paths must be absolute. For example:

  • Repository path: /Users/username/projects/my-repo
  • File paths: /Users/username/projects/my-repo/src/file.js

Tools

Basic Operations

init

Initializes a new Git repository.

{
  "path": string  // Path to initialize
}

clone

Clones a repository.

{
  "url": string,  // Repository URL (required)
  "path": string  // Clone destination
}

status

Gets repository status.

{
  "path": string  // Repository path
}

Bulk Operations

bulk_action

Executes multiple Git operations in sequence. This is the preferred way to execute multiple operations.

{
  "path": string,     // Repository path
  "actions": [        // Array of operations to execute
    {
      "type": "stage",
      "files": string[]  // Optional - if omitted, stages all changes
    },
    {
      "type": "commit",
      "message": string
    },
    {
      "type": "push",
      "branch": string,
      "remote": string   // Optional - defaults to "origin"
    }
  ]
}

Branch Operations

branch_list, branch_create, branch_delete, checkout

Manage branches and working tree.

Tag Operations

tag_list, tag_create, tag_delete

Manage repository tags.

Remote Operations

remote_list, remote_add, remote_remove

Manage remote repositories.

Stash Operations

stash_list, stash_save, stash_pop

Manage working directory changes.

Best Practices

Path Management

  • Always use absolute paths
  • Validate paths before operations
  • Handle embedded repositories properly

Bulk Operations

  • Use bulk_action for multiple operations
  • Handle operation dependencies correctly
  • Provide clear commit messages

Error Handling

  • Check operation results
  • Handle partial success scenarios
  • Validate repository state

Development

# Build the project
npm run build

# Watch for changes
npm run watch

# Run MCP inspector
npm run inspector

Error Handling

The server provides detailed error information:

  • Invalid paths or arguments
  • Git command failures
  • Repository state errors
  • Permission issues

Contributing

I welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

For bugs and feature requests, please create an issue.

License

Apache License 2.0


Built with the Model Context Protocol

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Andris Teikmanis
  • Latvian GPT assistant for developing GPT applications

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Navid RezaeiSarchoghaei
  • Professional Flask/SQLAlchemy code guide. Follow: https://x.com/navid_re

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • https://cantaspinar.com
  • Summarizes videos and answers related questions.

  • Jan Meindl
  • Builds new GPTs

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • OffchainLabs
  • Implementación de la prueba de estaca Ethereum

  • huahuayu
  • Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.

  • deemkeen
  • Controle su MBOT2 con un combo de potencia: MQTT+MCP+LLM

    Reviews

    1 (1)
    Avatar
    user_aHwqQsMU
    2025-04-15

    QuickBooks is an excellent accounting software that has streamlined my financial management process. The interface is user-friendly and its robust features make tax filing and bookkeeping effortless. I appreciate the accessibility and comprehensive support provided by the product. Highly recommend it for businesses of all sizes looking to simplify their accounting needs.