modelcontextprotocol / modelcontextprotocol/servers
mcp-server-git: when performing git-add, it seems that git config is ignored
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Desciption
When performing the git add command from terminal line, the changes are correctly identified and added for future commit. If a single line is added to a file, only that line is recognised as a change and added for later commit.
However if the git-add is performed via the mcp-server-git, all the line endings are modified (in particular, a special character ^M is added at the end of each line of the added files). My guess is that Mcp-server-git is not taking into account the git config in my machine (in particular, the config that avoids bad behaviours with line endings, git config --global core.autocrlf true).
To Reproduce
Steps to reproduce the behavior:
-
I am using Windows 11 Enterprise (version 24H2). In order to test the MCP server, I installed it with Python (pip install mcp-server-git) and I use it from the GitHub Copilot plugin inside IntelliJ (version of the plugin 1.5.44.10400-243). All this stack just to simplify my activities, it should not affect the result with the MCP server itself.
-
I made a change (edited one line) in the codebase then asked Copilot to perform a git-add, the proposed command is a simple git add with the following parameters:
{ "files": [ "src/main/resources/application.properties" ], "repo_path": "c:\\my_project" }
However, when checking with an external tool what has been done (SourceTree, in my case) I see that all the lines have actually changed. Looking further, I see that all the lines now end with "^M" character -
Unstaging the file then doing the same
git add src/main/resources/application.propertiesfrom the terminal, only my edited line is recognised as changed and staged for commit, as it should be
Expected behavior
The mcp-server-git/mcp-server-git_git_add command should perform exactly the same as the git add command in the terminal. In particular, I expect the MCP server command to use my git config
Logs
I don't have useful logs and actually I'm not able to collect them. If needed, please explain how I can collect them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mcp-server-git_git_add command and compare its behavior with git add from a terminal on Windows 11. Reproduce the case using core.autocrlf true and src/main/resources/application.properties, then verify that only the edited line is staged and no line endings are changed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100