Git

by kjozsa

3 stars
9.9k downloads
Not rated
GitHub

About

Provides Git operations for local repositories, enabling repository management, tag handling, and repository refreshing without direct shell access.

Details

Author
kjozsa
Repository
kjozsa/git-mcp
GitHub stars
3
Downloads
9,887
Categories
Productivity, Design, Developer Tools, AI, Infrastructure

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Git
    Command (node, npx, python, etc.) uvx
    Arguments
    • Argument 1 git-mcp
    Environment
    • GIT_REPOS_PATH /path/to/your/git/repositories

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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"
      }
    }
  }
}

To install Git MCP for Claude Desktop automatically via Smithery:

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

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

uv pip install -r requirements.txt

python test_mcp_server.py

list_repositories

Lists all Git repositories in the configured path. Parameters: None

get_last_git_tag

Finds the last Git tag in the specified repository. Parameters: `repo_name` (Name of the Git repository)

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

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

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)

refresh_repository

Refreshes a repository by checking out the main branch and pulling from all remotes. Parameters: `repo_name` (Name of the git repository)

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

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

Macos

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

Windows

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

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

```bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.