Git MCP
Git MCP
MCP 服务器用于管理本地存储库上的 Git 操作。
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Git MCP:
npx -y @smithery/cli install @kjozsa/git-mcp --client claude手动安装
uvx install git-mcpRelated MCP server: Git MCP Server
配置
使用以下 JSON 配置片段添加 MCP 服务器:
{
"mcpServers": {
"git-mcp": {
"command": "uvx",
"args": ["git-mcp"],
"env": {
"GIT_REPOS_PATH": "/path/to/your/git/repositories"
}
}
}
}特点和用途
环境变量
GIT_REPOS_PATH:包含 Git 存储库的目录的路径(必需)
您可以在您的环境中设置此项,或者在运行服务器的目录中创建一个.env文件。
可用方法
列出存储库
列出配置路径中的所有 Git 存储库。
参数:无
返回:存储库名称列表
获取最后一个 git 标签
查找指定存储库中的最后一个 Git 标签。
参数:
repo_name(Git 存储库的名称)返回:带有
version(标签名称)和date(标签创建日期)的字典
list_commits_since_last_tag
列出最后一个 Git 标签和 HEAD 之间的提交消息。
参数:
repo_name:Git 存储库的名称max_count(可选):返回的最大提交数
返回:包含
hash、author、date和message字典列表
创建 git 标签
在指定的存储库中创建一个新的 git 标签。
参数:
repo_name:git 存储库的名称tag_name:要创建的标签的名称message(可选):注释标签的消息(如果未提供,则创建轻量级标签)
返回:包含
status、version(标签名称)、date(标签创建日期)和type(带注释或轻量级)的字典
推送_git_标签
将现有的 git 标签推送到默认远程存储库。
参数:
repo_name:git 存储库的名称tag_name:要推送的标签名称
返回:包含
status、remote(远程名称)、tag(标签名称)和message(成功消息)的字典
刷新存储库
通过检出主分支(或主分支作为后备)并从所有远程拉取来刷新存储库。
参数:
repo_name:git 存储库的名称
返回:包含
status、repository、branch和pull_results(每个远程的结果)的字典
故障排除
未找到存储库:确保
GIT_REPOS_PATH设置正确且存储库存在未找到标签:存储库尚无任何标签
发展
# Install dependencies
uv pip install -r requirements.txt
# Run in dev mode with Inspector
mcp dev git_mcp/server.py测试
该项目包括两个测试脚本:
test_git_mcp.py- 直接测试底层 Git 命令功能,无需使用 MCP 服务器。test_mcp_server.py- 通过启动服务器实例并对其进行调用来测试 MCP 服务器功能。
运行测试:
# 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.pyAvailable Tools
6 toolscreate_git_tagB
Create a new git tag in the repository
Args:
repo_name: Name of the git repository
tag_name: Name of the tag to create
message: Optional message for annotated tag
Returns:
Dictionary containing status and tag information
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | ||
| repo_name | Yes | ||
| tag_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions creating a tag and that the message is optional for annotated tags, but fails to cover critical aspects like whether this requires write permissions, if it's a local or remote operation, error conditions (e.g., duplicate tags), or side effects. This leaves significant gaps for safe and effective tool invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections for Args and Returns, and each sentence adds value without redundancy. It could be slightly more front-loaded by moving the return statement earlier, but overall it's efficient and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is minimally adequate. The output schema likely covers return values, reducing the need for detailed return explanations. However, it lacks sufficient behavioral and usage context, making it incomplete for safe operation without additional inference.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context beyond the input schema, which has 0% description coverage. It clarifies that 'message' is optional and for annotated tags, and implies 'repo_name' and 'tag_name' are required. However, it doesn't detail constraints (e.g., tag naming rules) or provide examples, leaving some ambiguity for the agent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Create a new git tag') and resource ('in the repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'push_git_tag' or 'get_last_git_tag', which would require more specific context about when each is appropriate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'push_git_tag' or 'get_last_git_tag'. It lacks context about prerequisites (e.g., whether the repository must exist locally) or typical use cases (e.g., tagging releases vs. lightweight tags), leaving the agent to infer usage from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_last_git_tagA
Find the last git tag in the repository
Args:
repo_name: Name of the git repository
Returns:
Dictionary containing tag version and date
| Name | Required | Description | Default |
|---|---|---|---|
| repo_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns a dictionary with tag version and date, which is useful, but does not cover potential errors (e.g., if the repository has no tags), performance aspects, or authentication needs. This leaves gaps for a tool that interacts with a repository.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose in the first sentence, followed by structured sections for Args and Returns. Each sentence earns its place by providing essential information without redundancy, making it highly efficient and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, parameter meaning, and return structure. However, it could improve by addressing error cases or dependencies, slightly reducing completeness for real-world use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful context for the single parameter 'repo_name' by specifying it as the 'Name of the git repository', which clarifies its purpose beyond the schema's basic title 'Repo Name'. With 0% schema description coverage and only one parameter, this compensation is effective, though it could detail format expectations (e.g., path vs. name).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Find the last git tag') and resource ('in the repository'), distinguishing it from siblings like 'list_commits_since_last_tag' (which focuses on commits) and 'create_git_tag' (which creates rather than retrieves). The verb 'Find' precisely indicates a retrieval operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when needing the most recent tag, but does not explicitly state when to use this tool versus alternatives like 'list_repositories' or 'refresh_repository'. It provides basic context but lacks explicit exclusions or comparisons with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_commits_since_last_tagB
List commit messages since main HEAD and the last git tag
Args:
repo_name: Name of the git repository
max_count: Maximum number of commits to return
Returns:
List of dictionaries containing commit hash, author, date, and message
| Name | Required | Description | Default |
|---|---|---|---|
| max_count | No | ||
| repo_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions the return format ('List of dictionaries containing commit hash, author, date, and message'), which is helpful, but lacks details on error handling, rate limits, authentication needs, or whether it's read-only/destructive. For a tool with zero annotation coverage, this is insufficient behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and front-loaded with the core purpose, followed by clear sections for Args and Returns. Every sentence earns its place: the first sentence states the purpose, and the bullet points efficiently document parameters and output. There's zero waste or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is fairly complete. It covers the purpose, parameters, and return values. The output schema exists, so the description doesn't need to explain return values in detail. However, it lacks behavioral context like error cases or usage guidelines, which holds it back from a perfect score.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains both parameters: 'repo_name: Name of the git repository' and 'max_count: Maximum number of commits to return', including the optional nature of max_count (implied by 'Maximum'). This compensates well for the schema's lack of descriptions, though it doesn't cover all possible nuances like format constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'List commit messages since main HEAD and the last git tag'. It specifies the verb ('List'), resource ('commit messages'), and scope ('since main HEAD and the last git tag'). However, it doesn't explicitly differentiate from siblings like 'get_last_git_tag' or 'list_repositories', which would be needed for a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_last_git_tag' (which might provide tag info) or 'list_repositories' (which lists repos), nor does it specify prerequisites or exclusions. Usage is implied but not explicitly stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_repositoriesB
List all git repositories in the configured path
Returns:
List of repository names
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states it 'list all git repositories' and returns 'list of repository names'. It doesn't disclose behavioral traits like whether it's read-only, if it requires authentication, potential rate limits, or how it handles errors, leaving significant gaps for a tool with siblings that involve mutations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose in the first sentence and adds return value details concisely. It avoids redundancy, but could be slightly more structured by separating usage notes from return details for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has no parameters, an output schema exists, and siblings include mutation tools, the description is minimally adequate. It covers purpose and return values but lacks context on when to use it versus siblings and behavioral details, making it incomplete for optimal agent guidance.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately omits parameter details, earning a high baseline score for not adding unnecessary information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'list' and resource 'git repositories' with scope 'in the configured path', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'refresh_repository' or 'list_commits_since_last_tag', which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'refresh_repository' or 'list_commits_since_last_tag'. It lacks context about prerequisites, such as whether the path must be pre-configured or if this is a read-only operation compared to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
push_git_tagB
Push a git tag to the default remote
Args:
repo_name: Name of the git repository
tag_name: Name of the tag to push
Returns:
Dictionary containing status and information about the operation
| Name | Required | Description | Default |
|---|---|---|---|
| repo_name | Yes | ||
| tag_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions the operation pushes to the 'default remote', which adds some context, but fails to disclose critical behavioral traits such as required permissions, whether it overwrites existing tags, error handling, or rate limits. For a mutation tool with zero annotation coverage, this is a significant gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose, followed by structured sections for Args and Returns. Every sentence earns its place with no redundancy, making it efficiently sized and well-organized for quick comprehension.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 2 parameters with 0% schema coverage and no annotations, the description partially compensates by listing parameters and mentioning a return dictionary. However, as a mutation tool, it lacks details on permissions, side effects, or error cases. The output schema exists, so return values needn't be explained, but overall completeness is adequate with clear gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It explicitly lists both parameters ('repo_name' and 'tag_name') with brief explanations, adding meaning beyond the bare schema. However, it doesn't detail format constraints (e.g., valid tag names) or examples, preventing a score of 5.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('push') and resource ('git tag'), specifying it pushes to the 'default remote'. It distinguishes from siblings like 'create_git_tag' (creation vs. pushing) and 'list_repositories' (listing vs. pushing). However, it doesn't explicitly differentiate from all siblings (e.g., 'refresh_repository' might involve pushing), keeping it at 4 rather than 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when a tag needs to be pushed to a remote, but lacks explicit guidance on when to use this vs. alternatives. For example, it doesn't clarify if this should follow 'create_git_tag' or when to use 'refresh_repository' instead. The context is clear but no exclusions or named alternatives are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
refresh_repositoryB
Refresh repository by checking out main branch and pulling all remotes
Args:
repo_name: Name of the git repository
Returns:
Dictionary containing status and information about the operation
| Name | Required | Description | Default |
|---|---|---|---|
| repo_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses the core behavior (checkout main, pull remotes) and return format (dictionary with status/info), which is helpful. However, it lacks details on error handling (e.g., if repo doesn't exist), side effects (e.g., overwrites local changes), or operational constraints (e.g., network dependencies). The description adds basic context but misses key behavioral traits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded: the first sentence states the core action, followed by structured Args/Returns sections. Every sentence earns its place, though the Args section is redundant with the schema. It's efficient but could be more streamlined by integrating param details into the prose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 1 parameter with 0% schema coverage, no annotations, and an output schema (implied by Returns statement), the description is moderately complete. It covers the basic operation and return format, but lacks context on errors, prerequisites, or sibling tool relationships. For a mutation tool with no annotation support, it should provide more safety and usage guidance to be fully adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the schema provides no param details. The description adds minimal semantics by naming 'repo_name' and stating it's the 'Name of the git repository', but doesn't clarify format (e.g., path, URL, alias) or constraints. It compensates slightly over the bare schema but doesn't fully address the coverage gap for this single parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('checking out main branch and pulling all remotes') and identifies the resource ('git repository'). It distinguishes from siblings like 'list_repositories' (listing) and 'create_git_tag' (tagging), though it doesn't explicitly contrast with them. The purpose is unambiguous but lacks explicit sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., repository must exist locally), exclusions (e.g., not for repositories with uncommitted changes), or compare to siblings like 'list_repositories' for discovery. Usage is implied by the action described but not explicitly framed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v1.0.0- First observed
create_git_tag - First observed
get_last_git_tag - First observed
list_commits_since_last_tag - First observed
list_repositories - First observed
push_git_tag - First observed
refresh_repository
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: creating tags, getting the last tag, listing commits since the last tag, listing repositories, pushing tags, and refreshing repositories. The descriptions reinforce these distinct functions, making misselection unlikely.
The naming follows a consistent verb_noun pattern (e.g., create_git_tag, list_commits_since_last_tag) with clear, descriptive names. The only minor deviation is 'refresh_repository' which uses 'refresh' instead of a more common verb like 'update', but it still fits the pattern and is understandable.
With 6 tools, this server is well-scoped for managing git repositories, focusing on tag operations and repository maintenance. Each tool serves a specific, useful function without bloat, making the count appropriate for the domain.
The toolset covers tag management and basic repository operations well, but there are notable gaps in the git domain, such as creating commits, branching, merging, or handling remotes beyond pushing tags. This limits agents from performing full git workflows, though the provided tools are coherent for their specific scope.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
MCP server for siGit (sigit.si): browse repos, search code, manage PRs/issues, web search.
Create, deploy, and operate MCP servers directly from your GitHub repositories.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides Git version control operations for Claude, enabling comprehensive repository management. It allows users to perform tasks such as staging files, committing changes, managing branches, and handling remote operations like pushing and pulling.164MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.4,3761Apache 2.0
- AlicenseNot gradedqualityCmaintenanceA secure, git-aware MCP server for working with local repositories, enabling file management, shell commands, and full git operations within allowed directories.661GPL 3.0
- AlicenseAqualityBmaintenanceA local MCP server that provides a safe, explicit set of Git operations for version control tasks like status, diff, branching, staging, committing, fetching, merging, and pushing.1318MIT