MCP Server to Auto commit changes 🛠️
LocalAbout MCP Server to Auto commit changes 🛠️
This MCP server analyzes staged and unstaged Git changes and uses OpenAI's GPT-4o-mini to produce conventional commit messages. It is for developers who want a structured change summary and a commit message with an auto-commit signature.
Key features
- 01Analyze staged and unstaged changes
- 02Summarize modified, added, and deleted files
- 03Include up to 10 change lines per file
- 04Generate conventional commit messages
- 05Add an auto-commit signature
Use cases
- 01Review repository changes before committing
- 02Draft a conventional commit message from a diff
MCP support
Exposes a Git change analysis and commit-message generation tool to MCP clients. The tool can analyze a specified path or the current working directory.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP 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
mcp-server-auto-commit/
├── index.ts # Main server implementation with git analysis tool
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── build/ # Compiled JavaScript output
Prerequisites
- Node.js installed
- OpenAI API key
- Git repository to analyze
- pnpm package manager
Getting Started
- Clone this repository:
git clone https://github.com/jatinsandilya/mcp-server-auto-commit.git
cd mcp-server-auto-commit
- Install dependencies:
pnpm install
-
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
.envfile in the project root
- Set as an environment variable:
-
Build the project:
pnpm run build
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-keywith your actual OpenAI API key if not set in environment)
Using with Claude Desktop
Add the following MCP config to your Claude Desktop configuration:
{
"mcpServers": {
"git-auto-commit": {
"command": "node",
"args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js", "--key", "your-api-key"]
}
}
}
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:
const server = new McpServer({
name: "git-auto-commit",
version: "0.0.1",
});
-
The tool is defined using
server.tool()with proper parameter validation using Zod schema. -
Build and test your changes:
pnpm run build
Contributing
Feel free to submit issues and enhancement requests!
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.