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
git clone https://github.com/jatinsandilya/mcp-server-auto-commit.git
cd mcp-server-auto-commit
pnpm install
Set up your OpenAI API key using one of these methods:
OPENAI_API_KEY=your-api-key
--key your-api-key
.env
file in the project rootBuild 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:
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
{
"mcpServers": {
"git-auto-commit": {
"env": {},
"args": [
"ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js",
"--key",
"your-api-key"
],
"command": "node"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.