mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-17 23:53:24 +02:00
feat(mcp_server_git): Add support for configurable GIT_DIFF_CONTEXT_LINES
- Introduced `GIT_DIFF_CONTEXT_LINES` environment variable to customize the number of context lines shown in git diff output. - Updated `git_diff_unstaged`, `git_diff_staged`, and `git_diff` functions to utilize the new context line setting. - Enhanced README.md to document the new environment variable and its implications.
This commit is contained in:
@@ -6,6 +6,12 @@ A Model Context Protocol server for Git repository interaction and automation. T
|
||||
|
||||
Please note that mcp-server-git is currently in early development. The functionality and available tools are subject to change and expansion as we continue to develop and improve the server.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
- `GIT_DIFF_CONTEXT_LINES`: Number of context lines to show in git diff output (default: 3). Increasing this value shows more surrounding code in diffs.
|
||||
|
||||
> **⚠️ Warning:** Large context line values will consume more tokens and may reduce response relevance. Set this value carefully to balance context needs with token limits.
|
||||
|
||||
### Tools
|
||||
|
||||
1. `git_status`
|
||||
@@ -119,7 +125,10 @@ Add this to your `claude_desktop_config.json`:
|
||||
"mcpServers": {
|
||||
"git": {
|
||||
"command": "uvx",
|
||||
"args": ["mcp-server-git", "--repository", "path/to/git/repo"]
|
||||
"args": ["mcp-server-git", "--repository", "path/to/git/repo"],
|
||||
"env": {
|
||||
"GIT_DIFF_CONTEXT_LINES": "10"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user