
Git
STDIO本地Git仓库操作管理服务器
本地Git仓库操作管理服务器
MCP server for managing Git operations on local repositories.
To install Git MCP for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @kjozsa/git-mcp --client claude
uvx install git-mcp
Add the MCP server using the following JSON configuration snippet:
{ "mcpServers": { "git-mcp": { "command": "uvx", "args": ["git-mcp"], "env": { "GIT_REPOS_PATH": "/path/to/your/git/repositories" } } } }
GIT_REPOS_PATH
: Path to the directory containing your Git repositories (required)You can set this in your environment or create a .env
file in the directory where you run the server.
Lists all Git repositories in the configured path.
Finds the last Git tag in the specified repository.
repo_name
(Name of the Git repository)version
(tag name) and date
(tag creation date)Lists commit messages between the last Git tag and HEAD.
repo_name
: Name of the Git repositorymax_count
(optional): Maximum number of commits to returnhash
, author
, date
, and message
Creates a new git tag in the specified repository.
repo_name
: Name of the git repositorytag_name
: Name of the tag to createmessage
(optional): Message for annotated tag (if not provided, creates a lightweight tag)status
, version
(tag name), date
(tag creation date), and type
(annotated or lightweight)Pushes an existing git tag to the default remote repository.
repo_name
: Name of the git repositorytag_name
: Name of the tag to pushstatus
, remote
(name of the remote), tag
(name of the tag), and message
(success message)Refreshes a repository by checking out the main branch (or master as fallback) and pulling from all remotes.
repo_name
: Name of the git repositorystatus
, repository
, branch
, and pull_results
(results for each remote)GIT_REPOS_PATH
is set correctly and the repository exists# Install dependencies uv pip install -r requirements.txt # Run in dev mode with Inspector mcp dev git_mcp/server.py
The project includes two test scripts:
test_git_mcp.py
- Tests the underlying Git command functionality directly, without using the MCP server.test_mcp_server.py
- Tests the MCP server functionality by starting a server instance and making calls to it.To run the tests:
# Test the Git command functionality python test_git_mcp.py # Test the MCP server (requires the git-mcp package to be installed) python test_mcp_server.py