mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-17 15:43:24 +02:00
feat: Add git branch functionality and unit tests
This commit introduces the `git branch` tool to the MCP Git server, allowing users to list branches with various filtering options. Changes include: - Implemented `git_branch` function in `src/git/src/mcp_server_git/server.py` to support listing local, remote, and all branches, as well as filtering by `contains` and `not_contains` SHA values. - Added comprehensive unit tests for the `git branch` functionality in `src/git/tests/test_server.py`, covering different branch types and commit filtering scenarios. - Updated `src/git/README.md`.
This commit is contained in:
@@ -85,6 +85,15 @@ Please note that mcp-server-git is currently in early development. The functiona
|
||||
- `repo_path` (string): Path to directory to initialize git repo
|
||||
- Returns: Confirmation of repository initialization
|
||||
|
||||
13. `git_branch`
|
||||
- List Git branches
|
||||
- Inputs:
|
||||
- `repo_path` (string): Path to the Git repository.
|
||||
- `branch_type` (string): Whether to list local branches ('local'), remote branches ('remote') or all branches('all').
|
||||
- `contains` (string, optional): The commit sha that branch should contain. Do not pass anything to this param if no commit sha is specified
|
||||
- `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
|
||||
- Returns: List of branches
|
||||
|
||||
## Installation
|
||||
|
||||
### Using uv (recommended)
|
||||
|
||||
Reference in New Issue
Block a user