Skip to main content

MCP server for managing Git operations

Project description

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)

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_mcp-0.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_mcp-0.2.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file git_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: git_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for git_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e34f702c12f8011e46a9bffbaad91a9a932e763413682479afb40cbf830fe1c3
MD5 10e0f81c3172be7c08e7bc476f715894
BLAKE2b-256 ebf29f248a2338683a5366fc598b21ce9de998fbfd139dd92b518dcbede6042a

See more details on using hashes here.

File details

Details for the file git_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: git_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for git_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 299c7daab4b1cc82f42933308f6400917ecd99941511615247858293f097a14d
MD5 c3c673087f14993b5293d020bd4034f3
BLAKE2b-256 86b1480bb6dd52c56100fcee9ebed64e96d27bac9c2087fe40edb5cf49afe09e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page