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

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.1.0.tar.gz (4.0 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.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c38c68c2c9ebf4f5c41d073aa41594f88193b81e8e720ce7f727813f036b6fdd
MD5 70527469b23226f843d851fd4000e86c
BLAKE2b-256 27adba198f7c3838edd81083943b38459a9237266722213c1c3ad71e41cad8d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a039e6e8cd76dfe81cb570b74984bb2d9db723e8ab186a6957cf134ca5590dd
MD5 77c28a49f58822451af82d0ab63be484
BLAKE2b-256 b51919fd50fe015bb60218b33b198ab3af9ffb37d1d0a7b009b2c10faec76fd0

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