Logotipo de Git MCP Server (Go)

Git MCP Server (Go)

Comunidad
geropl

Git MCP based on mcp-go

Editorgeropl
Repositoriogit-mcp-go
IdiomaGo
Forks
9
Estrellas
37
Herramientas disponibles
0
Tipo de transportestdio
Categorías
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Git MCP Server (Go) ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    37 estrellas y 9 forks en el repositorio enlazado.

Git MCP Server (Go)

A Model Context Protocol (MCP) server for Git repository interaction and automation, written in Go. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.

Features

This MCP server provides the following Git operations as tools:

  • git_status: Shows the working tree status
  • git_diff_unstaged: Shows changes in the working directory that are not yet staged
  • git_diff_staged: Shows changes that are staged for commit
  • git_diff: Shows differences between branches or commits
  • git_commit: Records changes to the repository
  • git_add: Adds file contents to the staging area
  • git_reset: Unstages all staged changes
  • git_log: Shows the commit logs
  • git_create_branch: Creates a new branch from an optional base branch
  • git_checkout: Switches branches
  • git_show: Shows the contents of a commit
  • git_init: Initialize a new Git repository
  • git_push: Pushes local commits to a remote repository (requires --write-access flag)
  • git_list_repositories: Lists all available Git repositories

Installation

Prerequisites

  • Go 1.18 or higher
  • Git installed on your system

Download Prebuilt Binaries

You can download prebuilt binaries for your platform from the GitHub Releases page.

Building from Source

bash
# Clone the repository
git clone https://github.com/geropl/git-mcp-go.git
cd git-mcp-go

# Build the server
go build -o git-mcp-go .

Install with go install

bash
go install github.com/geropl/git-mcp-go@latest

Usage

Command Line Structure

The Git MCP Server uses a command-line structure with subcommands:

git-mcp-go
├── serve [flags] [repository-paths...]
│   ├── --repository, -r <paths>                  # Repository paths (multiple ways to specify)
│   ├── --mode <shell|go-git>
│   ├── --write-access
│   └── --verbose, -v
└── setup [flags] [repository-paths...]
    ├── --repository, -r <paths>                  # Repository paths (multiple ways to specify)
    ├── --mode <shell|go-git>
    ├── --write-access
    ├── --auto-approve <tool-list|allow-read-only|allow-local-only>
    └── --tool <cline,roo-code>

Multi-Repository Support

The Git MCP Server can now monitor and operate on multiple repositories simultaneously. You can specify repositories in several ways:

  1. Using the -r/--repository flag:
    • With comma-separated paths: -r=/path/to/repo1,/path/to/repo2
    • With multiple flag instances: -r=/path/to/repo1 -r=/path/to/repo2
  2. As positional arguments: serve /path/to/repo1 /path/to/repo2
  3. A combination of both approaches

When using multiple repositories, the server will default to the first repository for operations where a specific repository is not specified.

serve Command

The serve command starts the Git MCP server:

bash
# Run with verbose logging
./git-mcp-go serve -v /path/to/repo1 /path/to/repo2 /path/to/repo3

# Run with go-git implementation
./git-mcp-go serve --mode go-git -r=/path/to/repo1,/path/to/repo2

# Enable write access for remote operations
./git-mcp-go serve -r=/path/to/repo1,/path/to/repo2 --write-access

The --mode flag allows you to choose between two different implementations:

  • shell: Uses the Git CLI commands via shell execution (default)
  • go-git: Uses the go-git library for Git operations where possible

The --write-access flag enables operations that modify remote state (currently only the push operation). By default, this is disabled for safety.

setup Command

The setup command sets up the Git MCP server for use with an AI assistant. It copies itself to ~/mcp-servers/git-mcp-go and modifies the tools config (cline: cline_mcp_settings.json) to use that binary.

bash
# Set up for Cline with a single repository
./git-mcp-go setup -r /path/to/git/repository

# Set up with repositories as arguments
./git-mcp-go setup /path/to/repo1 /path/to/repo2 /path/to/repo3

# Set up with write access enabled
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --write-access

# Set up with auto-approval for read-only tools
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --auto-approve=allow-read-only

# Set up with specific tools auto-approved
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --auto-approve=git_status,git_log

# Set up with write access and auto-approval for read-only tools
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --write-access --auto-approve=allow-read-only

The --auto-approve flag allows you to specify which tools should be auto-approved (not require explicit user approval):

  • allow-read-only: Auto-approve all read-only tools (git_status, git_diff_unstaged, git_diff_staged, git_log, git_show, git_diff)
  • allow-local-only: Auto-approve all local-only tools (incl. git_commit, git_add, git_reset, but not git_push)
  • comma-separated list: Auto-approve specific tools (e.g., git_status,git_log)

Repository Management

The git_list_repositories Tool

This tool lists all available Git repositories that the server is monitoring. It shows:

  • The total number of repositories
  • The path to each repository
  • The repository name (derived from the directory name)

Example output:

Available repositories (3):

1. repo1 (/path/to/repo1)
2. repo2 (/path/to/repo2)
3. another-project (/path/to/another-project)

Repository Selection

When running commands that require a repository path:

  1. If a specific repo_path is provided in the command, it will be used.
  2. If no repo_path is provided and multiple repositories are configured, the first repository will be used as the default.
  3. Each command output will indicate which repository was used for the operation.

Installation

Automatic Installation and Configuration

The easiest way to install and register the Git MCP server with Cline is to use the setup command:

bash
# Download linux binary for the latest release
RELEASE="$(curl -s https://api.github.com/repos/geropl/git-mcp-go/releases/latest)"
DOWNLOAD_URL="$(echo $RELEASE | jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url')"
curl -L -o ./git-mcp-go $DOWNLOAD_URL
chmod +x ./git-mcp-go

# Setup the mcp server with a single repository
./git-mcp-go setup -r /path/to/git/repository --tool=cline --auto-approve=allow-local-only

# Setup the mcp server with multiple repositories
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --tool=cline --auto-approve=allow-local-only

rm -f ./git-mcp-go

The setup command will:

  1. Copy the executable to the Cline MCP directory
  2. Create a registration script that configures Cline to use the Git MCP server

Manual Configuration

Alternatively, you can manually add this to your claude_desktop_config.json:

json
"mcpServers": {
  "git": {
    "command": "/path/to/git-mcp-go",
    "args": ["serve", "-r=/path/to/repo1,/path/to/repo2", "--mode", "shell"]
  }
}
json
"mcpServers": {
  "git": {
    "command": "/path/to/git-mcp-go",
    "args": ["serve", "-r", "/path/to/git/repository"]
  }
}

Implementation Details

This server is implemented using:

  • mcp-go: Go SDK for the Model Context Protocol
  • go-git: Pure Go implementation of Git (used for the go-git mode)

For operations not supported by go-git, the server falls back to using the Git CLI.

Development

Testing

The server includes comprehensive tests for all Git operations. The tests are designed to run against both implementation modes:

bash
# Run all tests
go test ./pkg -v

# Run specific tests
go test ./pkg -v -run TestGitOperations/push

The test suite creates temporary repositories for each test case and verifies that the operations work correctly in both modes.

Continuous Integration

This project uses GitHub Actions for continuous integration and deployment:

  • Automated tests run on every pull request to the main branch
  • Releases are created when a tag with the format v* is pushed
  • Each release includes binaries for multiple platforms:
    • Linux (amd64, arm64)
    • macOS (amd64, arm64)
    • Windows (amd64)

To create a new release:

bash
# 1. Update the version in pkg/server.go (line ~26)
# Edit the version string in NewGitServer function

# 2. Commit the version change
git add pkg/server.go
git commit -m "Bump version to v1.3.1"

# 3. Push the commit
git push origin main

# 4. Tag the current commit
git tag v1.3.1

# 5. Push the tag to GitHub (this triggers the release)
git push origin v1.3.1

License

This project is licensed under the MIT License.

Instalación

TypingMind
Requisitos:

Node.js 18+

{
  "mcpServers": {
    "geropl-git-mcp-go": {
      "command": "npx",
      "args": [
        "-y",
        "git-mcp-go"
      ]
    }
  }
}

Usa el MCP de Git MCP Server (Go) con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Git MCP Server (Go), puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Git MCP Server (Go) como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Git MCP Server (Go).
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "geropl-git-mcp-go": {
      "command": "npx",
      "args": [
        "-y",
        "git-mcp-go"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Git MCP Server (Go) y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Git MCP Server (Go).
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Git MCP Server (Go) para ayudarme con esta tarea?
Git MCP Server (Go)
Claro. Lo he leído.
Esto he encontrado usando Git MCP Server (Go).

Preguntas frecuentes

¿Para qué sirve el servidor MCP Git MCP Server (Go)?

Git MCP Server (Go) es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Git MCP Server (Go) con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Git MCP Server (Go) con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Git MCP Server (Go) con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Git MCP Server (Go) conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Git MCP Server (Go) a TypingMind?

Git MCP Server (Go) funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Git MCP Server (Go) en TypingMind?

Git MCP Server (Go) ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Git MCP Server (Go)?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Git MCP Server (Go) requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇