Cover image
Try Now
2025-03-05

MCP server for local git repositories

3 years

Works with Finder

1

Github Watches

2

Github Forks

0

Github Stars

Git MCP

smithery badge MCP server for managing Git operations on local repositories.

Installation

Installing via Smithery

To install Git MCP for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @kjozsa/git-mcp --client claude

Installing Manually

uvx install git-mcp

Configuration

Add the MCP server using the following JSON configuration snippet:

{
  "mcpServers": {
    "git-mcp": {
      "command": "uvx",
      "args": ["git-mcp"],
      "env": {
        "GIT_REPOS_PATH": "/path/to/your/git/repositories"
      }
    }
  }
}

Features and Usage

Environment Variables

  • GIT_REPOS_PATH: Path to the directory containing your Git repositories (required)

You can set this in your environment or create a .env file in the directory where you run the server.

Available Methods

list_repositories

Lists all Git repositories in the configured path.

  • Parameters: None
  • Returns: List of repository names

get_last_git_tag

Finds the last Git tag in the specified repository.

  • Parameters: repo_name (Name of the Git repository)
  • Returns: Dictionary with version (tag name) and date (tag creation date)

list_commits_since_last_tag

Lists commit messages between the last Git tag and HEAD.

  • Parameters:
    • repo_name: Name of the Git repository
    • max_count (optional): Maximum number of commits to return
  • Returns: List of dictionaries with hash, author, date, and message

create_git_tag

Creates a new git tag in the specified repository.

  • Parameters:
    • repo_name: Name of the git repository
    • tag_name: Name of the tag to create
    • message (optional): Message for annotated tag (if not provided, creates a lightweight tag)
  • Returns: Dictionary with status, version (tag name), date (tag creation date), and type (annotated or lightweight)

push_git_tag

Pushes an existing git tag to the default remote repository.

  • Parameters:
    • repo_name: Name of the git repository
    • tag_name: Name of the tag to push
  • Returns: Dictionary with status, remote (name of the remote), tag (name of the tag), and message (success message)

refresh_repository

Refreshes a repository by checking out the main branch (or master as fallback) and pulling from all remotes.

  • Parameters:
    • repo_name: Name of the git repository
  • Returns: Dictionary with status, repository, branch, and pull_results (results for each remote)

Troubleshooting

  • Repository Not Found: Ensure GIT_REPOS_PATH is set correctly and the repository exists
  • No Tags Found: The repository doesn't have any tags yet

Development

# Install dependencies
uv pip install -r requirements.txt

# Run in dev mode with Inspector
mcp dev git_mcp/server.py

Testing

The project includes two test scripts:

  1. test_git_mcp.py - Tests the underlying Git command functionality directly, without using the MCP server.
  2. test_mcp_server.py - Tests the MCP server functionality by starting a server instance and making calls to it.

To run the tests:

# Test the Git command functionality
python test_git_mcp.py

# Test the MCP server (requires the git-mcp package to be installed)
python test_mcp_server.py

相关推荐

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

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • 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.

  • 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.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • OffchainLabs
  • Go implementation of Ethereum proof of stake

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

    Reviews

    2 (1)
    Avatar
    user_kZQpXtwb
    2025-04-18

    As a dedicated user of Git-MCP, I must say it's an incredibly useful tool for managing multiple Git repositories simultaneously. The intuitive interface and efficient performance streamline my workflow, saving me a lot of time and effort. Kudos to kjozsa for developing such a helpful application. Highly recommend it to any developer managing numerous repositories!