The Git Auto Commit MCP Server analyzes Git repository changes and generates AI-powered commit messages using OpenAI's GPT-4o-mini model.
Analyzes both staged and unstaged Git changes
Generates conventional commit messages with detailed summaries including:
Modified files 📝
Newly added files ✨
Deleted files 🗑️
Detailed changes per file (up to 10 lines) 📄
Supports optional path analysis for specific directories or files
Adds auto-commit signature to each commit
Can be integrated with tools like Cursor and Claude Desktop via MCP configuration
MCP Server to Auto commit changes 🛠️
This implementation provides a Git changes analyzer that generates commit messages using OpenAI's GPT models.
Demo
Features
Analyzes git changes in your repository (both staged and unstaged)
Generates conventional commit messages using GPT-4o-mini
Provides detailed summaries of:
📝 Modified files
✨ Newly added files
🗑️ Deleted files
📄 Detailed changes (up to 10 lines per file)
Built with @modelcontextprotocol/sdk
Adds an auto-commit signature to each commit
Project Structure
Prerequisites
Node.js installed
OpenAI API key
Git repository to analyze
pnpm package manager
Getting Started
Clone this repository:
Install dependencies:
Set up your OpenAI API key using one of these methods:
Set as an environment variable:
OPENAI_API_KEY=your-api-key
Pass as a command line argument:
--key your-api-key
Add to a
.env
file in the project root
Build the project:
This will generate the /build/index.js
file - your compiled MCP server script.
Using with Cursor
Go to Cursor Settings -> MCP -> Add new MCP server
Configure your MCP:
Name: git-auto-commit
Type: command
Command:
node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js --key your-api-key
(Replaceyour-api-key
with your actual OpenAI API key if not set in environment)
Using with Claude Desktop
Add the following MCP config to your Claude Desktop configuration:
Available Tools
git-changes-commit-message
This tool analyzes the current git changes in your repository and generates a commit message using OpenAI's GPT-4o-mini model. It provides:
List of modified files with status indicators
List of newly added files
List of deleted files
Detailed changes for each file (limited to 10 lines per file for readability)
A generated commit message following conventional commits format
An auto-commit signature
Usage parameters:
autoCommitPath
: Optional path to analyze specific directory/file. If not provided, uses current working directory.
Development
The implementation in index.ts
showcases:
Setting up the MCP server with proper configuration
Handling command line arguments and environment variables
Integrating with OpenAI's API using GPT-4o-mini model
Git operations using child processes
Error handling and fallback mechanisms
Detailed change analysis and formatting
To modify or extend the implementation:
Update the server configuration in
index.ts
:
The tool is defined using
server.tool()
with proper parameter validation using Zod schema.Build and test your changes:
Contributing
Feel free to submit issues and enhancement requests!
License
MIT
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Analyzes git changes in repositories and generates conventional commit messages using OpenAI's GPT models, supporting both staged and unstaged changes with detailed summaries.
- Demo
- Features
- Project Structure
- Prerequisites
- Getting Started
- Using with Cursor
- Using with Claude Desktop
- Available Tools
- Development
- Contributing
- License
Related Resources
Related MCP Servers
- AsecurityFlicenseAqualityGenerates comprehensive and formatted release notes from GitHub repositories, efficiently organizing commits by type and including detailed statistics using smart API usage.Last updated -2
- AsecurityAlicenseAqualityA 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 -42Apache 2.0
- AsecurityAlicenseAqualityProvides comprehensive Git operations as tools for AI assistants and applications. This server enables AI systems to interact with Git repositories, allowing to initialize, fetch, commit, log, status, etc..Last updated -1011MIT License
- AsecurityAlicenseAqualityAutomatically generates conventional commit messages from staged git changes and checks repository status. Analyzes git diffs to create properly formatted commit messages following conventional commit standards.Last updated -28MIT License