Integrations
Provides Git-related functionality, specifically a tool to generate the diff for a Git merge commit against its first parent by running 'git show -m --first-parent' on a specified commit hash.
Git Stuff Server
This repository contains a Node.js application that acts as an MCP (Model Context Protocol) server to provide Git-related functionalities. Currently, it offers a tool to generate the diff for a Git merge commit against its first parent.
Features
- MCP Server: Runs as a standard MCP server using stdio for communication.
get_git_merge_diff
Tool:- Accepts a Git merge commit hash.
- Executes the
GenerateMergeDiff.ps1
PowerShell script. - Returns the textual diff content generated by
git show -m --first-parent <commitHash>
.
Prerequisites
- Node.js (Version supporting ES Modules, check
engines
in package.json if specified, otherwise checktsconfig.json
target - ES2022) - npm (usually comes with Node.js)
- Git installed and accessible in the system's PATH.
- PowerShell (Windows) or
pwsh
(Linux/macOS) installed and accessible in the system's PATH.
Installation
- Clone the repository:Copy
- Install dependencies:Copy
Usage
- Build the TypeScript code:This compiles the TypeScript code fromCopy
src/
to JavaScript inbuild/
. - Run the server:
- To run the compiled code:Copy
- To build and run in development mode:Copy
- To run the compiled code:
The server will start and listen for MCP requests on standard input/output.
Using the get_git_merge_diff
Tool
When connected via an MCP client, you can call the get_git_merge_diff
tool with the following input:
commitHash
(string): The Git commit hash (SHA) of the merge commit you want to diff.
The tool will return the diff content as text.
How it Works
- The MCP server (
src/index.ts
) receives a request for theget_git_merge_diff
tool. - It validates the
commitHash
input. - It executes the
GenerateMergeDiff.ps1
PowerShell script, passing thecommitHash
. - The PowerShell script runs
git show -m --first-parent <commitHash>
and saves the output (including any errors) to a temporary file namedmerge_changes.diff
in the server's current working directory. - The Node.js server reads the content of
merge_changes.diff
. - The server deletes the temporary
merge_changes.diff
file. - The server returns the diff content (or an error message) to the MCP client.
Configuration
Key configuration points are defined as constants within src/index.ts
:
SERVER_NAME
: The name registered by the MCP server.SCRIPT_NAME
: The filename of the PowerShell script to execute.OUTPUT_DIFF_FILE
: The name of the temporary diff file created by the script.
License
This project is licensed under the MIT License - see the package.json file for details.
You must be authenticated.
local-only server
The server can only run on the client's local machine because it depends on local resources.
MCP server providing Git-related functionalities, primarily a tool to generate diffs for Git merge commits against their first parent.
Related MCP Servers
- AsecurityFlicenseAqualityMCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.Last updated -1841TypeScript
- -securityAlicense-qualityA specialized MCP server for in-depth analysis of git repositories, offering tools for branch overview, time period analysis, file changes, and merge recommendations.Last updated -41JavaScriptApache 2.0
- AsecurityAlicenseAqualityMCP Tool Server for Gitee, supporting the management of repository files/branches, Issues, and Pull Requests.Last updated -20104TypeScriptMIT License
- AsecurityFlicenseAqualityMCP server for managing Git operations on local repositories, allowing users to list repositories, get and create tags, list commits, push tags, and refresh repositories through a standardized interface.Last updated -6Python