mcp server auto commit
Analyzes git changes in repositories and generates conventional commit messages using OpenAI's GPT models, supporting both staged and unstaged changes with detailed summaries.
Analyzes git changes in repositories and generates conventional commit messages using OpenAI's GPT models, supporting both staged and unstaged changes with detailed summaries.
This implementation provides a Git changes analyzer that generates commit messages using OpenAI's GPT models.
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
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:
OPENAI_API_KEY=your-api-key
--key your-api-key
Add to a .env
file in the project root
Build the project:
pnpm run build
This will generate the /build/index.js
file - your compiled MCP server script.
node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js --key your-api-key
(Replace your-api-key
with your actual OpenAI API key if not set in environment)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"]
}
}
}
This tool analyzes the current git changes in your repository and generates a commit message using OpenAI's GPT-4o-mini model. It provides:
Usage parameters:
- autoCommitPath
: Optional path to analyze specific directory/file. If not provided, uses current working directory.
The implementation in index.ts
showcases:
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
Feel free to submit issues and enhancement requests!
MIT
[
{
"description": "Analyzes current git changes and provides a commit message",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"autoCommitPath": {
"description": "Optional path to analyze specific directory/file",
"type": "string"
}
},
"required": [
"autoCommitPath"
],
"type": "object"
},
"name": "git-changes-commit-message"
}
]