You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 98845dc
Browse filesBrowse the repository at this point in the historyBrowse files
Merges a branch, tag or commit into the current branch. Fast-forward only
by default; fast_forward_only=false allows a merge commit. Refuses a
detached HEAD, a dirty working tree and a merge already in progress, and
aborts a merge that stops on conflicts (naming the files) or fails to
commit, so a failed call leaves the repository as it was. Keeps the
flag-injection guard and repository confinement of the other tools.
Closesmodelcontextprotocol#659
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
Copy file name to clipboardExpand all lines: src/git/README.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,14 +84,22 @@ Please note that mcp-server-git is currently in early development. The functiona
84
84
-`repo_path` (string): Path to Git repository
85
85
-`branch_name` (string): Name of branch to checkout
86
86
- Returns: Confirmation of branch switch, or `HEAD is now detached at <short sha>` when `branch_name` is not a branch (a sha, tag or other revision)
87
-
11.`git_show`
87
+
11.`git_merge`
88
+
- Merges a branch into the current branch, or changes nothing
89
+
- Inputs:
90
+
-`repo_path` (string): Path to Git repository
91
+
-`source_branch` (string): Branch, tag or commit to merge into the current branch (check out the branch to merge into first with `git_checkout`)
92
+
-`fast_forward_only` (boolean, optional): Only fast-forward, failing if the branches have diverged (default `true`). `false` lets Git create a merge commit when they have
93
+
- Returns: `Fast-forwarded`, `Merged ... with merge commit <short sha>`, or `Already up to date`
94
+
- Refuses a detached HEAD, a working tree with uncommitted changes, and a merge already in progress. A merge that stops on conflicts is aborted (`git merge --abort`) and the error names the conflicting files, so the repository is left as it was
95
+
12.`git_show`
88
96
- Shows the contents of a commit, or of a file or directory at a revision
89
97
- Inputs:
90
98
-`repo_path` (string): Path to Git repository
91
99
-`revision` (string): The revision (commit hash, branch name, tag) or object spec (`HEAD:path/to/file`) to show
92
100
- Returns: Contents of the specified commit, file content, or directory listing
93
101
94
-
12.`git_branch`
102
+
13.`git_branch`
95
103
- List Git branches
96
104
- Inputs:
97
105
-`repo_path` (string): Path to the Git repository.
@@ -135,7 +143,7 @@ python -m mcp_server_git
135
143
## Configuration
136
144
137
145
> [!IMPORTANT]
138
-
> **Without `--repository`, the server reads and writes any Git repository the server process can reach.** Each tool call names its own `repo_path`, and that holds for the tools that change a repository too (`git_add`, `git_commit`, `git_reset`, `git_create_branch`, `git_checkout`). `--repository` is the only confinement the server offers: it never asks the client for Roots, in either protocol era. Set `--repository` whenever the server is used with prompts or content that are not fully trusted. It admits the whole enclosing repository, not only the directory you name, as the next paragraph describes.
146
+
> **Without `--repository`, the server reads and writes any Git repository the server process can reach.** Each tool call names its own `repo_path`, and that holds for the tools that change a repository too (`git_add`, `git_commit`, `git_reset`, `git_create_branch`, `git_checkout`, `git_merge`). `--repository` is the only confinement the server offers: it never asks the client for Roots, in either protocol era. Set `--repository` whenever the server is used with prompts or content that are not fully trusted. It admits the whole enclosing repository, not only the directory you name, as the next paragraph describes.
139
147
140
148
`--repository` (`-r`) accepts any path inside a Git working tree. At startup the server walks up to the enclosing repository root, the way `git rev-parse --show-toplevel` does, so `--repository .` works when a shared config is launched from any subdirectory of the repository. A path inside the repository therefore allows tool calls anywhere in that repository, not only under the subdirectory given. A path that does not exist, or is not inside a Git repository, is logged as a one-line error at startup.
Copy file name to clipboardExpand all lines: src/git/tests/snapshots/list_tools.json
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -318,6 +318,41 @@
318
318
"openWorldHint": false
319
319
}
320
320
},
321
+
{
322
+
"name": "git_merge",
323
+
"description": "Merges a branch into the current branch. Fast-forward only unless fast_forward_only is false; refuses a dirty working tree, and aborts a merge that conflicts, leaving the repository unchanged",
324
+
"inputSchema": {
325
+
"properties": {
326
+
"repo_path": {
327
+
"title": "Repo Path",
328
+
"type": "string"
329
+
},
330
+
"source_branch": {
331
+
"description": "Branch, tag or commit to merge into the current branch",
332
+
"title": "Source Branch",
333
+
"type": "string"
334
+
},
335
+
"fast_forward_only": {
336
+
"default": true,
337
+
"description": "Only fast-forward, failing if the branches have diverged. False allows a merge commit",
338
+
"title": "Fast Forward Only",
339
+
"type": "boolean"
340
+
}
341
+
},
342
+
"required": [
343
+
"repo_path",
344
+
"source_branch"
345
+
],
346
+
"type": "object",
347
+
"title": "mergeArguments"
348
+
},
349
+
"annotations": {
350
+
"readOnlyHint": false,
351
+
"destructiveHint": false,
352
+
"idempotentHint": true,
353
+
"openWorldHint": false
354
+
}
355
+
},
321
356
{
322
357
"name": "git_show",
323
358
"description": "Shows the contents of a commit, or of a file or directory given as <revision>:<path>",
0 commit comments