mcp-server-git 2026.1.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ __pycache__
2
+ .venv
@@ -0,0 +1 @@
1
+ 3.10
@@ -0,0 +1,39 @@
1
+ # Use a Python image with uv pre-installed
2
+ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
3
+
4
+ # Install the project into `/app`
5
+ WORKDIR /app
6
+
7
+ # Enable bytecode compilation
8
+ ENV UV_COMPILE_BYTECODE=1
9
+
10
+ # Copy from the cache instead of linking since it's a mounted volume
11
+ ENV UV_LINK_MODE=copy
12
+
13
+ # Install the project's dependencies using the lockfile and settings
14
+ RUN --mount=type=cache,target=/root/.cache/uv \
15
+ --mount=type=bind,source=uv.lock,target=uv.lock \
16
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
17
+ uv sync --locked --no-install-project --no-dev --no-editable
18
+
19
+ # Then, add the rest of the project source code and install it
20
+ # Installing separately from its dependencies allows optimal layer caching
21
+ ADD . /app
22
+ RUN --mount=type=cache,target=/root/.cache/uv \
23
+ uv sync --locked --no-dev --no-editable
24
+
25
+ FROM python:3.12-slim-bookworm
26
+
27
+ RUN apt-get update && apt-get install -y git git-lfs && rm -rf /var/lib/apt/lists/* \
28
+ && git lfs install --system
29
+
30
+ WORKDIR /app
31
+
32
+ COPY --from=uv /root/.local /root/.local
33
+ COPY --from=uv --chown=app:app /app/.venv /app/.venv
34
+
35
+ # Place executables in the environment at the front of the path
36
+ ENV PATH="/app/.venv/bin:$PATH"
37
+
38
+ # when running the container, add --db-path and a bind mount to the host's db file
39
+ ENTRYPOINT ["mcp-server-git"]
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2024 Anthropic, PBC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,365 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-git
3
+ Version: 2026.1.14
4
+ Summary: A Model Context Protocol server providing tools to read, search, and manipulate Git repositories programmatically via LLMs
5
+ Author: Anthropic, PBC.
6
+ Maintainer-email: David Soria Parra <davidsp@anthropic.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Keywords: automation,git,llm,mcp
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: click>=8.1.7
17
+ Requires-Dist: gitpython>=3.1.45
18
+ Requires-Dist: mcp>=1.0.0
19
+ Requires-Dist: pydantic>=2.0.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # mcp-server-git: A git MCP server
23
+
24
+ <!-- mcp-name: io.github.modelcontextprotocol/server-git -->
25
+
26
+ ## Overview
27
+
28
+ A Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.
29
+
30
+ 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.
31
+
32
+ ### Tools
33
+
34
+ 1. `git_status`
35
+ - Shows the working tree status
36
+ - Input:
37
+ - `repo_path` (string): Path to Git repository
38
+ - Returns: Current status of working directory as text output
39
+
40
+ 2. `git_diff_unstaged`
41
+ - Shows changes in working directory not yet staged
42
+ - Inputs:
43
+ - `repo_path` (string): Path to Git repository
44
+ - `context_lines` (number, optional): Number of context lines to show (default: 3)
45
+ - Returns: Diff output of unstaged changes
46
+
47
+ 3. `git_diff_staged`
48
+ - Shows changes that are staged for commit
49
+ - Inputs:
50
+ - `repo_path` (string): Path to Git repository
51
+ - `context_lines` (number, optional): Number of context lines to show (default: 3)
52
+ - Returns: Diff output of staged changes
53
+
54
+ 4. `git_diff`
55
+ - Shows differences between branches or commits
56
+ - Inputs:
57
+ - `repo_path` (string): Path to Git repository
58
+ - `target` (string): Target branch or commit to compare with
59
+ - `context_lines` (number, optional): Number of context lines to show (default: 3)
60
+ - Returns: Diff output comparing current state with target
61
+
62
+ 5. `git_commit`
63
+ - Records changes to the repository
64
+ - Inputs:
65
+ - `repo_path` (string): Path to Git repository
66
+ - `message` (string): Commit message
67
+ - Returns: Confirmation with new commit hash
68
+
69
+ 6. `git_add`
70
+ - Adds file contents to the staging area
71
+ - Inputs:
72
+ - `repo_path` (string): Path to Git repository
73
+ - `files` (string[]): Array of file paths to stage
74
+ - Returns: Confirmation of staged files
75
+
76
+ 7. `git_reset`
77
+ - Unstages all staged changes
78
+ - Input:
79
+ - `repo_path` (string): Path to Git repository
80
+ - Returns: Confirmation of reset operation
81
+
82
+ 8. `git_log`
83
+ - Shows the commit logs with optional date filtering
84
+ - Inputs:
85
+ - `repo_path` (string): Path to Git repository
86
+ - `max_count` (number, optional): Maximum number of commits to show (default: 10)
87
+ - `start_timestamp` (string, optional): Start timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')
88
+ - `end_timestamp` (string, optional): End timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')
89
+ - Returns: Array of commit entries with hash, author, date, and message
90
+
91
+ 9. `git_create_branch`
92
+ - Creates a new branch
93
+ - Inputs:
94
+ - `repo_path` (string): Path to Git repository
95
+ - `branch_name` (string): Name of the new branch
96
+ - `base_branch` (string, optional): Base branch to create from (defaults to current branch)
97
+ - Returns: Confirmation of branch creation
98
+ 10. `git_checkout`
99
+ - Switches branches
100
+ - Inputs:
101
+ - `repo_path` (string): Path to Git repository
102
+ - `branch_name` (string): Name of branch to checkout
103
+ - Returns: Confirmation of branch switch
104
+ 11. `git_show`
105
+ - Shows the contents of a commit
106
+ - Inputs:
107
+ - `repo_path` (string): Path to Git repository
108
+ - `revision` (string): The revision (commit hash, branch name, tag) to show
109
+ - Returns: Contents of the specified commit
110
+
111
+ 12. `git_branch`
112
+ - List Git branches
113
+ - Inputs:
114
+ - `repo_path` (string): Path to the Git repository.
115
+ - `branch_type` (string): Whether to list local branches ('local'), remote branches ('remote') or all branches('all').
116
+ - `contains` (string, optional): The commit sha that branch should contain. Do not pass anything to this param if no commit sha is specified
117
+ - `not_contains` (string, optional): The commit sha that branch should NOT contain. Do not pass anything to this param if no commit sha is specified
118
+ - Returns: List of branches
119
+
120
+ ## Installation
121
+
122
+ ### Using uv (recommended)
123
+
124
+ When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
125
+ use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-git*.
126
+
127
+ ### Using PIP
128
+
129
+ Alternatively you can install `mcp-server-git` via pip:
130
+
131
+ ```
132
+ pip install mcp-server-git
133
+ ```
134
+
135
+ After installation, you can run it as a script using:
136
+
137
+ ```
138
+ python -m mcp_server_git
139
+ ```
140
+
141
+ ## Configuration
142
+
143
+ ### Usage with Claude Desktop
144
+
145
+ Add this to your `claude_desktop_config.json`:
146
+
147
+ <details>
148
+ <summary>Using uvx</summary>
149
+
150
+ ```json
151
+ "mcpServers": {
152
+ "git": {
153
+ "command": "uvx",
154
+ "args": ["mcp-server-git", "--repository", "path/to/git/repo"]
155
+ }
156
+ }
157
+ ```
158
+ </details>
159
+
160
+ <details>
161
+ <summary>Using docker</summary>
162
+
163
+ * Note: replace '/Users/username' with the a path that you want to be accessible by this tool
164
+
165
+ ```json
166
+ "mcpServers": {
167
+ "git": {
168
+ "command": "docker",
169
+ "args": ["run", "--rm", "-i", "--mount", "type=bind,src=/Users/username,dst=/Users/username", "mcp/git"]
170
+ }
171
+ }
172
+ ```
173
+ </details>
174
+
175
+ <details>
176
+ <summary>Using pip installation</summary>
177
+
178
+ ```json
179
+ "mcpServers": {
180
+ "git": {
181
+ "command": "python",
182
+ "args": ["-m", "mcp_server_git", "--repository", "path/to/git/repo"]
183
+ }
184
+ }
185
+ ```
186
+ </details>
187
+
188
+ ### Usage with VS Code
189
+
190
+ For quick installation, use one of the one-click install buttons below...
191
+
192
+ [![Install with UV in VS Code](https://img.shields.io/badge/VS_Code-UV-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=git&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-git%22%5D%7D) [![Install with UV in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-UV-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=git&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-git%22%5D%7D&quality=insiders)
193
+
194
+ [![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Docker-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=git&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22--rm%22%2C%22-i%22%2C%22--mount%22%2C%22type%3Dbind%2Csrc%3D%24%7BworkspaceFolder%7D%2Cdst%3D%2Fworkspace%22%2C%22mcp%2Fgit%22%5D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Docker-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=git&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22--rm%22%2C%22-i%22%2C%22--mount%22%2C%22type%3Dbind%2Csrc%3D%24%7BworkspaceFolder%7D%2Cdst%3D%2Fworkspace%22%2C%22mcp%2Fgit%22%5D%7D&quality=insiders)
195
+
196
+ For manual installation, you can configure the MCP server using one of these methods:
197
+
198
+ **Method 1: User Configuration (Recommended)**
199
+ Add the configuration to your user-level MCP configuration file. Open the Command Palette (`Ctrl + Shift + P`) and run `MCP: Open User Configuration`. This will open your user `mcp.json` file where you can add the server configuration.
200
+
201
+ **Method 2: Workspace Configuration**
202
+ Alternatively, you can add the configuration to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
203
+
204
+ > For more details about MCP configuration in VS Code, see the [official VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).
205
+
206
+ ```json
207
+ {
208
+ "servers": {
209
+ "git": {
210
+ "command": "uvx",
211
+ "args": ["mcp-server-git"]
212
+ }
213
+ }
214
+ }
215
+ ```
216
+
217
+ For Docker installation:
218
+
219
+ ```json
220
+ {
221
+ "mcp": {
222
+ "servers": {
223
+ "git": {
224
+ "command": "docker",
225
+ "args": [
226
+ "run",
227
+ "--rm",
228
+ "-i",
229
+ "--mount", "type=bind,src=${workspaceFolder},dst=/workspace",
230
+ "mcp/git"
231
+ ]
232
+ }
233
+ }
234
+ }
235
+ }
236
+ ```
237
+
238
+ ### Usage with [Zed](https://github.com/zed-industries/zed)
239
+
240
+ Add to your Zed settings.json:
241
+
242
+ <details>
243
+ <summary>Using uvx</summary>
244
+
245
+ ```json
246
+ "context_servers": [
247
+ "mcp-server-git": {
248
+ "command": {
249
+ "path": "uvx",
250
+ "args": ["mcp-server-git"]
251
+ }
252
+ }
253
+ ],
254
+ ```
255
+ </details>
256
+
257
+ <details>
258
+ <summary>Using pip installation</summary>
259
+
260
+ ```json
261
+ "context_servers": {
262
+ "mcp-server-git": {
263
+ "command": {
264
+ "path": "python",
265
+ "args": ["-m", "mcp_server_git"]
266
+ }
267
+ }
268
+ },
269
+ ```
270
+ </details>
271
+
272
+ ### Usage with [Zencoder](https://zencoder.ai)
273
+
274
+ 1. Go to the Zencoder menu (...)
275
+ 2. From the dropdown menu, select `Agent Tools`
276
+ 3. Click on the `Add Custom MCP`
277
+ 4. Add the name (i.e. git) and server configuration from below, and make sure to hit the `Install` button
278
+
279
+ <details>
280
+ <summary>Using uvx</summary>
281
+
282
+ ```json
283
+ {
284
+ "command": "uvx",
285
+ "args": ["mcp-server-git", "--repository", "path/to/git/repo"]
286
+ }
287
+ ```
288
+ </details>
289
+
290
+ ## Debugging
291
+
292
+ You can use the MCP inspector to debug the server. For uvx installations:
293
+
294
+ ```
295
+ npx @modelcontextprotocol/inspector uvx mcp-server-git
296
+ ```
297
+
298
+ Or if you've installed the package in a specific directory or are developing on it:
299
+
300
+ ```
301
+ cd path/to/servers/src/git
302
+ npx @modelcontextprotocol/inspector uv run mcp-server-git
303
+ ```
304
+
305
+ Running `tail -n 20 -f ~/Library/Logs/Claude/mcp*.log` will show the logs from the server and may
306
+ help you debug any issues.
307
+
308
+ ## Development
309
+
310
+ If you are doing local development, there are two ways to test your changes:
311
+
312
+ 1. Run the MCP inspector to test your changes. See [Debugging](#debugging) for run instructions.
313
+
314
+ 2. Test using the Claude desktop app. Add the following to your `claude_desktop_config.json`:
315
+
316
+ ### Docker
317
+
318
+ ```json
319
+ {
320
+ "mcpServers": {
321
+ "git": {
322
+ "command": "docker",
323
+ "args": [
324
+ "run",
325
+ "--rm",
326
+ "-i",
327
+ "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
328
+ "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
329
+ "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
330
+ "mcp/git"
331
+ ]
332
+ }
333
+ }
334
+ }
335
+ ```
336
+
337
+ ### UVX
338
+ ```json
339
+ {
340
+ "mcpServers": {
341
+ "git": {
342
+ "command": "uv",
343
+ "args": [
344
+ "--directory",
345
+ "/<path to mcp-servers>/mcp-servers/src/git",
346
+ "run",
347
+ "mcp-server-git"
348
+ ]
349
+ }
350
+ }
351
+ }
352
+ ```
353
+
354
+ ## Build
355
+
356
+ Docker build:
357
+
358
+ ```bash
359
+ cd src/git
360
+ docker build -t mcp/git .
361
+ ```
362
+
363
+ ## License
364
+
365
+ This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.