Git Tools

by lileeei

2 Not rated yet MIT
GitHub

About

Integrates with Git to enable version control operations, repository management, and change tracking for collaborative development environments.

Details

Repository
lileeei/mcp-git-tools
License
MIT

Explore

This library provides a set of Git operations that can be called through the Model Context Protocol:

- git_status - Get the status of a repository
- git_branches - List branch information
- git_log - Get commit history with flexible filtering options (by time, author, branch, count)
- git_commit - Create a new commit
- git_pull - Pull changes from remote
- git_push - Push changes to remote
- git_diff - View file differences
- git_add - Add file contents to the staging area
- git_reset - Reset the staging area or working tree to a specified state
- git_worktree_list - List all worktrees
- git_worktree_add - Create a new worktree
- git_worktree_remove - Remove a worktree
- git_worktree_prune - Prune expired worktree files

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 Tools
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    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

Clone The Repository

git clone https://gitcode.com/lileeei/mcp-git-tools.git

git_status

Get the status of a repository. Parameters: repo_path (string) - Path to the Git repository.

git_branches

List branch information. Parameters: repo_path (string) - Path to the Git repository.

git_log

Get commit history with flexible filtering options. Parameters: repo_path (string) - Path to Git repository, max_count (optional integer) - Maximum number of commits to return, branch (optional string) - Branch name, since (optional string) - Start date, until (optional string) - End date, author (optional string) - Filter by specific author.

git_commit

Create a new commit. Parameters: repo_path (string) - Path to the Git repository, message (string) - Commit message, all (optional boolean) - Whether to automatically stage modified files.

git_pull

Pull changes from remote. Parameters: repo_path (string) - Path to the Git repository, remote (optional string) - Remote name, defaults to 'origin', branch (optional string) - Branch name.

git_push

Push changes to remote. Parameters: repo_path (string) - Path to the Git repository, remote (optional string) - Remote name, defaults to 'origin', branch (optional string) - Branch name, force (optional boolean) - Whether to force push.

git_diff

View file differences. Parameters: repo_path (string) - Path to the Git repository, path (optional string) - Path to file or directory, staged (optional boolean) - Whether to show staged changes, commit (optional string) - Commit to compare against.

git_add

Add file contents to the staging area. Parameters: repo_path (string) - Path to the Git repository, path (string) - Path(s) to add, or patterns to match, update (optional boolean) - Whether to update, rather than add, all (optional boolean) - Whether to add all changes, including untracked files.

git_reset

Reset the staging area or working tree to a specified state. Parameters: repo_path (string) - Path to the Git repository, path (string) - Path(s) to reset, or patterns to match, hard (optional boolean) - Whether to perform a hard reset, target (optional string) - The commit or branch to reset to.

git_worktree_list

List all worktrees in a repository. Parameters: repo_path (string) - Path to the Git repository.

git_worktree_add

Create a new worktree. Parameters: repo_path (string) - Path to the Git repository, path (string) - Path for the new worktree, branch (optional string) - Branch name to create, commit_ref (optional string) - Commit reference to check out, checkout (optional boolean) - Whether to check out files.

git_worktree_remove

Remove a worktree. Parameters: repo_path (string) - Path to the Git repository, path (string) - Path to the worktree to remove, force (optional boolean) - Force removal even if worktree is dirty.

git_worktree_prune

Prune working tree files in $GIT_DIR/worktrees. Parameters: repo_path (string) - Path to the Git repository, verbose (optional boolean) - Report all removals, dry_run (optional boolean) - Do not remove, show only.

Git tools implementation for the Model Context Protocol (MCP).

中文文档

Each tool is implemented as a method on GitToolsHandler:

impl GitToolsHandler {
    #[tool(description = "Get the status of a git repository")]
    pub async fn git_status(
        &self,
        repo_path: String,
    ) -> Result<CallToolResult> {
        // Implementation
    }
}

To add a new Git tool:

1. Add the parameter struct in src/lib.rs:

#[derive(serde::Deserialize, schemars::JsonSchema)]
struct GitMyToolParams {
repo_path: String,
// other parameters...
}

2. Add the method in the GitToolsHandler impl block:

#[tool(description = "Description of your tool")]
pub async fn git_my_tool(
&self,
repo_path: String,
// other parameters...
) -> Result<CallToolResult> {
// Implementation
}

3. Update the list_tools() method to include your new tool in the returned list

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "git tools": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

MCP Git Tools

Git tools implementation for the Model Context Protocol (MCP).

中文文档

Features

This library provides a set of Git operations that can be called through the Model Context Protocol:

- git_status - Get the status of a repository
- git_branches - List branch information
- git_log - Get commit history with flexible filtering options (by time, author, branch, count)
- git_commit - Create a new commit
- git_pull - Pull changes from remote
- git_push - Push changes to remote
- git_diff - View file differences
- git_add - Add file contents to the staging area
- git_reset - Reset the staging area or working tree to a specified state
- git_worktree_list - List all worktrees
- git_worktree_add - Create a new worktree
- git_worktree_remove - Remove a worktree
- git_worktree_prune - Prune expired worktree files

Installation

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