MCP Cursor

Enhance your development workflow with AI-powered MCP tools and extensions for Cursor IDE.

Product

  • MCP Servers
  • Getting Started
  • Documentation
  • Open Source

Resources

  • MCP Specification
  • Cursor IDE
  • MCP GitHub
  • Contributing

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
Made withfor the developer community
© 2025 MCP Cursor. All rights reserved.
MCP Logo
MCP Cursor
IntroductionMCPs
IntroductionMCPs
3D MCP Cursor Visualization
  1. Home
  2. Servers
  3. Git Tools MCP
Git Tools MCP Logo

Git Tools MCP

Model Context Protocol Integration

Overview

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

Git Tools

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

Installation Instructions


README: https://github.com/lileeei/mcp-git-tools

MCP Git Tools

Git tool integration library 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
  • git_time_filtered_log - Get commits within a specific time range
  • 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

Installation

# Clone the repository
git clone https://github.com/lileeei/mcp-git-tools.git

# Navigate to the directory
cd mcp-git-tools

# Build
cargo build

Usage

Run as a standalone server

cargo run --bin mcp-git-server

This starts an MCP server that interacts with clients through standard input/output.

Use in an MCP client

use mcp_client::{
    client::{ClientCapabilities, ClientInfo, McpClient},
    StdioTransport, Transport, McpService,
};
use std::collections::HashMap;
use std::time::Duration;

// Create a connection to the Git tools server
let transport = StdioTransport::new(
    "path/to/mcp-git-server", 
    vec![], 
    HashMap::new()
);

// Start the transport
let handle = transport.start().await?;
let service = McpService::with_timeout(handle, Duration::from_secs(10));
let mut client = McpClient::new(service);

// Initialize the client
client.initialize(
    ClientInfo {
        name: "my-client".into(),
        version: "1.0.0".into(),
    },
    ClientCapabilities::default(),
).await?;

// Call the git_status tool
let status = client
    .call_tool("git_status", serde_json::json!({ "repo_path": "/path/to/repo" }))
    .await?;

println!("Git status: {:?}", status);

Integrate into your own MCP server

use mcp_git_tools::register_git_tools;
use mcp_server::McpServerBuilder;

// Create a server
let mut builder = McpServerBuilder::new("my-server", "1.0.0");

// Register Git tools
register_git_tools(&mut builder);

// Add other tools...

// Build the server
let server = builder.build();

Tool Details

git_status

Get the status of a repository.

Parameters:

  • repo_path - Path to the Git repository

Returns:

{
  "status": ["M file1.txt", "?? file2.txt"],
  "is_clean": false
}

git_branches

List all branches.

Parameters:

  • repo_path - Path to the Git repository

Returns:

{
  "branches": ["* main", "develop", "feature/new-feature"],
  "current": "main"
}

git_log

Get commit history.

Parameters:

  • repo_path - Path to the Git repository
  • max_count - (optional) Maximum number of commits to return
  • branch - (optional) Branch name

Returns:

{
  "commits": [
    {
      "hash": "abcd1234",
      "author": "User Name",
      "date": "Mon Aug 1 10:00:00 2023 +0800",
      "message": "Initial commit"
    }
  ]
}

git_time_filtered_log

Get commits within a specified time range, optionally filtered by author and branch.

Parameters:

  • repo_path - Path to the Git repository
  • since - Start date (e.g., "2023-01-01", "1 week ago", "yesterday")
  • until - (optional) End date (e.g., "2023-01-31", "today")
  • author - (optional) Filter by specific author
  • branch - (optional) Branch name

Returns:

{
  "commits": [
    {
      "hash": "abcd1234",
      "author": "User Name",
      "date": "Mon Aug 1 10:00:00 2023 +0800",
      "message": "Initial commit"
    }
  ],
  "filters": {
    "since": "1 week ago",
    "until": "today",
    "author": "User Name",
    "branch": "main"
  }
}

git_commit

Create a new commit.

Parameters:

  • repo_path - Path to the Git repository
  • message - Commit message
  • all - (optional) Whether to automatically stage modified files

Returns:

{
  "success": true,
  "hash": "abcd1234",
  "message": "feat: Add new feature",
  "output": "[main abcd1234] feat: Add new feature\n 1 file changed, 10 insertions(+), 2 deletions(-)"
}

git_pull

Pull changes from remote.

Parameters:

  • repo_path - Path to the Git repository
  • remote - (optional) Remote name, defaults to "origin"
  • branch - (optional) Branch name

Returns:

{
  "success": true,
  "remote": "origin",
  "output": "Updating abcd1234..efgh5678\nFast-forward\n file1.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)"
}

git_push

Push changes to remote.

Parameters:

  • repo_path - Path to the Git repository
  • remote - (optional) Remote name, defaults to "origin"
  • branch - (optional) Branch name
  • force - (optional) Whether to force push

Returns:

{
  "success": true,
  "remote": "origin",
  "output": "To github.com:user/repo.git\n   abcd1234..efgh5678  main -> main"
}

git_diff

View file differences.

Parameters:

  • repo_path - Path to the Git repository
  • path - (optional) Path to file or directory
  • staged - (optional) Whether to show staged changes
  • commit - (optional) Commit to compare against

Returns:

{
  "diff": "diff --git a/file.txt b/file.txt\nindex 1234567..abcdefg 100644\n--- a/file.txt\n+++ b/file.txt\n@@ -1,3 +1,4 @@\n Line 1\n Line 2\n+New line\n Line 3"
}

git_add

Add file contents to the staging area.

Parameters:

  • repo_path - Path to the Git repository
  • path - Path(s) to add, or patterns to match. Use '.' for all files.
  • update - (optional) Whether to update, rather than add
  • all - (optional) Whether to add all changes, including untracked files

Returns:

{
  "success": true,
  "message": "Files staged successfully",
  "status": ["M file1.txt", "A file2.txt"]
}

git_reset

Reset the staging area or working tree to a specified state.

Parameters:

  • repo_path - Path to the Git repository
  • path - Path(s) to reset, or patterns to match. Use '.' for all files.
  • hard - (optional) Whether to perform a hard reset (WARNING: discards all local changes)
  • target - (optional) The commit or branch to reset to (defaults to HEAD)

Returns:

{
  "success": true,
  "message": "Files unstaged successfully",
  "status": ["?? file1.txt", "?? file2.txt"]
}

License

MIT License

Featured MCPs

Github MCP - Model Context Protocol for Cursor IDE

Github

This server provides integration with Github's issue tracking system through MCP, allowing LLMs to interact with Github issues.

Sequential Thinking MCP - Model Context Protocol for Cursor IDE

Sequential Thinking

An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process. Break down complex problems into manageable steps, revise and refine thoughts as understanding deepens, and branch into alternative paths of reasoning.

Puppeteer MCP - Model Context Protocol for Cursor IDE

Puppeteer

A Model Context Protocol server that provides browser automation capabilities using Puppeteer. This server enables LLMs to interact with web pages, take screenshots, execute JavaScript, and perform various browser-based operations in a real browser environment.