Git Prompts MCP Server
Git 提示 MCP 服务器
该存储库提供了一个模型上下文协议 (MCP) 服务器,该服务器提供了多个命令来根据 Git 存储库的内容生成提示。
(该存储库从MarkItDown MCP 服务器和示例Git MCP 服务器中汲取了大量灵感。)
安装
手动安装
克隆此存储库
安装依赖项:
uv sync --frozen
Related MCP server: GitHub MCP Server
用法
作为 Zed Editor 的 MCP 服务器
将以下内容添加到您的settings.json :
"context_servers": {
"git_prompt_mcp": {
"command": {
"path": "uv",
"args": [
"--directory",
"/path/to/local/git_prompts_mcp_server",
"run",
"git-prompts-mcp-server",
"/path/to/repo/", // parent folder of the .git directory
"--excludes", // exclude files and directories from diff results
"**/uv.lock",
"--excludes",
"**/.gitignore",
"--format", // format for diff results
"json" // options: json, text
]
},
"settings": {}
}
}命令
服务器响应以下命令:
/git-diff <ancestor_branch_or_commit>:填充 HEAD 与指定祖先分支或提交之间的差异结果。/generate-pr-desc <ancestor_branch_or_commit>:根据 HEAD 与指定祖先分支或提交之间的差异结果生成拉取请求描述。
注意:这与
/git-diff大致相同,但它包含在输出末尾生成拉取请求描述的说明。
/git-cached-diff:填充阶段性变更和 HEAD 的差异结果。
例子:
/generate-pr-desc main/git-diff dev/git-cached-diff
执照
MIT 许可证。详情请参阅许可证。
Available Tools
3 toolsgit-cached-diffA
Get a diff between the files in the staging area (the index) and the HEAD
| 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?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but does not describe behavioral traits such as output format, error handling, or side effects. This is a significant gap for a tool with no annotation coverage.
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 a single, clear sentence that efficiently conveys the tool's purpose without unnecessary details. It is front-loaded and wastes no words, making it highly concise and well-structured.
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 no annotations, the description covers the basic purpose adequately. However, it lacks details on behavioral aspects like output format or usage context, which could be more complete despite the simplicity of the tool.
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 information is needed. The description appropriately does not discuss parameters, which is sufficient for a parameterless tool, earning a baseline score of 4.
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 ('Get a diff') and the resources involved ('files in the staging area (the index) and the HEAD'), making the purpose explicit. It distinguishes from sibling tools like git-diff by specifying the staging area vs. HEAD comparison, which is a precise scope.
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 context by specifying 'staging area (the index) vs. HEAD', which helps differentiate it from general git-diff. However, it does not explicitly state when to use this tool versus alternatives like git-diff or git-commit-messages, nor does it provide exclusions or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
git-commit-messagesB
Get commit messages between the ancestor and HEAD
| Name | Required | Description | Default |
|---|---|---|---|
| ancestor | Yes | The ancestor commit hash or branch name |
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 of behavioral disclosure. It states the tool retrieves commit messages but doesn't describe key behaviors like whether it's read-only, safe to use, how it handles errors, or what the output format entails. For a tool with no annotations, this leaves significant gaps in understanding its operational 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 a single, efficient sentence that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for the task, making it easy for an agent to parse quickly.
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, no nested objects) and the presence of an output schema (which handles return values), the description is reasonably complete. However, it lacks behavioral details and usage guidelines, which are needed for full contextual understanding, especially with no annotations provided.
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 input schema has 100% description coverage, fully documenting the 'ancestor' parameter. The description adds no additional meaning beyond the schema, such as examples or constraints, but since the schema is comprehensive, the baseline score of 3 is appropriate as it doesn't need to compensate for gaps.
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 a specific verb ('Get') and resource ('commit messages'), and specifies the scope ('between the ancestor and HEAD'). However, it doesn't explicitly differentiate from sibling tools like git-cached-diff or git-diff, which might also involve commit history or comparisons.
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, such as the sibling tools git-cached-diff or git-diff. It mentions the scope but doesn't clarify use cases, prerequisites, or exclusions, leaving the agent to infer usage from context alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
git-diffB
Get a diff between the HEAD and the ancestor branch or commit
| Name | Required | Description | Default |
|---|---|---|---|
| ancestor | Yes | The ancestor commit hash or branch name |
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 states the tool gets a diff, implying a read-only operation, but doesn't disclose behavioral traits like whether it requires Git repository access, error handling, output format details, or performance considerations. The description is minimal and lacks context beyond the basic action.
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 a single, clear sentence that efficiently conveys the core functionality without unnecessary words. It's front-loaded and appropriately sized for the tool's purpose.
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 complexity (simple diff operation), high schema coverage, and presence of an output schema, the description is minimally adequate. However, with no annotations and lack of usage guidance, it leaves gaps in understanding the tool's full context and behavior.
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 input schema has 100% description coverage, with the 'ancestor' parameter well-documented. The description adds no additional meaning beyond the schema, such as examples or constraints, but since the schema is comprehensive, the baseline score of 3 is appropriate.
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 ('Get a diff') and the target ('between the HEAD and the ancestor branch or commit'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'git-cached-diff' or 'git-commit-messages', which might have overlapping or related functionality in a Git context.
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, prerequisites, or specific contexts for usage, leaving the agent to infer based on tool names alone.
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.
3 tool updates
v1.0.0- Changed
git-cached-diff1 field changed- changed
Output schema / properties / result / items / additionalPropertiesPrevious value: -trueNew value: +{ + "type": "string" +}
- Changed
git-commit-messages1 field changed- changed
Output schema / properties / result / items / additionalPropertiesPrevious value: -trueNew value: +{ + "type": "string" +}
- Changed
git-diff1 field changed- changed
Output schema / properties / result / items / additionalPropertiesPrevious value: -trueNew value: +{ + "type": "string" +}
3 tool updates
- First observed
git-cached-diff - First observed
git-commit-messages - First observed
git-diff
TDQS
Scored across 3 tools
The three tools have overlapping purposes focused on git diffs and commit history, which could cause confusion. git-cached-diff and git-diff both produce diffs but target different git states, while git-commit-messages retrieves commit messages. The descriptions help clarify the distinctions, but the domain overlap is significant.
All tool names follow a consistent 'git-' prefix with hyphenated descriptive terms (cached-diff, commit-messages, diff). This pattern is predictable and readable throughout the set, with no deviations in style or convention.
With only 3 tools, the server feels thin for a git-related domain, which typically involves more operations like status, log, branch, or push. While the tools cover specific diff and commit message scenarios, the scope appears limited and potentially incomplete for general git workflows.
For a git server, there are significant gaps in the tool surface. It lacks basic operations such as viewing status, checking out branches, pushing/pulling changes, or creating commits. The tools only cover diff and commit message retrieval, leaving most git workflows unsupported and likely to cause agent failures.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- AlicenseBqualityAmaintenanceA 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.1232,924 PyPI90,399MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants like Claude to interact with GitHub repositories, issues, and pull requests.16 npmMIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch management.12MIT
- AlicenseCqualityBmaintenanceA Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch operations.224MIT