This server automates Git commits with AI attribution by:
- Committing staged changes in a Git repository with a specific message
- Automatically appending "(aider)" to the committer's name to track AI contributions
- Optionally specifying a working directory for the git command
- Using environment variables for committer name and email, or falling back to git config
- Enabling tracking of AI contribution using
aider --stats
or custom scripts
Allows committing staged changes to a Git repository with AI attribution by automatically appending '(aider)' to the committer's name, enabling tracking of AI contributions in codebases.
git-commit-aider MCP Server
Make git commits on behalf of AI, so that you can track AI contribution in your codebase.
This is a TypeScript-based MCP server that provides a tool to commit staged changes in a Git repository while appending "(aider)" to the committer's name.
Features
This MCP server provides only one tool:
commit_staged
- Commit staged changes with a specific message.
- Takes
message
(string, required) as the commit message. - Takes
cwd
(string, optional) to specify the working directory for the git command. - Appends "(aider)" to the committer name automatically.
- Reads committer name and email from environment variables (
GIT_COMMITTER_NAME
,GIT_COMMITTER_EMAIL
) if set, otherwise falls back togit config user.name
andgit config user.email
.
With this tool installed in your code editor, you can prompt the AI by something like:
Commit the changes for me
This usually happens after the AI has made some changes to your codebase, so often times AI is able to provide a good commit message from the context.
Installation
To use this server, add its configuration to your MCP settings file.
The committer information is retrieved from:
- Environment variables
GIT_COMMITTER_NAME
andGIT_COMMITTER_EMAIL
, which follows git's convention. - Output of
git config user.name
andgit config user.email
commands.
Alternative: amend author after commit
If you don't want to use this MCP server, you can also use the git
command directly in your terminal.
You can proceed with normal commit first, and then use the following git command to change the author of the last commit:
This will change the author of the last commit to your name with "(aider)" appended.
To simplify the process, you can set up a Git alias. Run the following command in your terminal:
Once set up, you can use the alias by running:
Calculating AI contribution
Commits with "(aider)" can be picked up by aider --stats
command, which will show you the contribution of AI in your codebase.
Alternatively, you can use the following script to calculate the contribution of AI in your codebase, measured in lines of code (added, deleted, and total changes).
Usage example:
Output Fields Description
The JSON output contains the following fields:
ai_percentage
: (Number) The percentage of total lines changed (sum of added and deleted lines) that were contributed by AI authors (identified byAI_MATCHER
).ai_changes
: (Object) An object detailing the aggregated line changes (linesadded
,deleted
, and theirtotal
) made by AI authors.human_changes
: (Object) An object detailing the aggregated line changes (linesadded
,deleted
, and theirtotal
) made by human authors.details
: (Array of Objects) Provides a detailed breakdown of changes. Each object in the array represents the contribution of a specificauthor
to a particularfileName
, including linesadded
,deleted
, and thetotal
changes for that file by that author.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
Makes git commits on behalf of AI by appending "(aider)" to the committer's name, allowing tracking of AI contributions in your codebase.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityEnables AI assistants to interact with GitHub through the PyGithub library, providing tools for managing issues, repositories, pull requests, and other GitHub operations with intelligent parameter handling and error management.Last updated -191PythonMIT License
- -securityFlicense-qualityA custom server implementation that allows AI assistants to interact with GitLab repositories, providing capabilities for searching, fetching files, creating/updating content, and managing issues and merge requests.Last updated -JavaScript
- -securityFlicense-qualityA set of tools allowing AI assistants to interact directly with GitHub, enabling automation of tasks like fetching user profiles, creating repositories, and managing pull requests.Last updated -Python
- 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 -102TypeScriptMIT License