ceshine/git-prompts-mcp-server
If you are the rightful owner of git-prompts-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Git Prompts MCP Server is a Model Context Protocol server that generates prompts based on the content of a Git repository.
Git Prompts MCP Server
This repository provides a Model Context Protocol (MCP) server that offers several commands to generate prompts based on the Git repository's content.
Acknowledgements
- This repository draws heavy inspiration from MarkItDown MCP server and the example Git MCP server.
- The was adapted from the example sin this blog post: Getting Good Results from Claude Code.
Usage
Prerequisites: Python 3.12+ and uv
As a MCP Server for Zed Editor
Add the following to your settings.json:
"context_servers": {
"git_prompt_mcp": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/ceshine/git-prompts-mcp-server.git",
"git-prompts-mcp-server",
"/path/to/repo/", // parent folder of the .git directory
"--excludes", // exclude files and directories from diff results (the server use fnmatch in the backend)
"*/uv.lock",
"--excludes",
"uv.lock",
"--excludes",
".gitignore",
"--format", // format for diff results
"json" // options: json, text
],
"env": {}
}
}
As a Gemini CLI Extension
To enable the commands and tools provided by this server in your Gemini CLI:
- Install the extension:
This command will install the
gemini extension install https://github.com/ceshine/git-prompts-mcp-server.git --auto-updategit-prompts-mcp-serveras a Gemini CLI extension, making its prompts and tools available for use. - Usage:
Once installed, the prompts (e.g.,
/git-diff,/generate-pr-desc) and tools (e.g.,git_diff,git_cached_diff) will be automatically available to your Gemini CLI sessions when run within a Git repository.
Important Caveat: This extension relies on the current working directory being part of a Git repository (i.e., containing a .git subfolder). If the Gemini CLI is not run from the root of a Git project, the extension's commands and tools may not function as expected.
Commands
The server responds to the following commands:
/git-diff <ancestor_branch_or_commit>: Populate the diff results between HEAD and the specified ancestor branch or commit./generate-pr-desc <ancestor_branch_or_commit>: Generate a pull request description based on the diff results and commit history between HEAD and the specified ancestor branch or commit./git-cached-diff: Populate the diff results for the staged changes and HEAD./git-commit-messages <ancestor_branch_or_commit>: Get commit messages between the ancestor and HEAD./generate-commit-message [num_commits]: Generate commit message based on the diff between the files in the staging area (the index) and the HEAD. Additionally, it points out any potential issues in the changes at the end of the output.num_commitsdefaults to 5. Set to 0 to exclude commit history.
Examples:
/generate-pr-desc main/git-diff dev/git-cached-diff/git-commit-messages main/generate-commit-messageor/generate-commit-message 3
Tools
The server also provides the following tools for MCP-compatible clients:
git-diff: Get a diff between the HEAD and the ancestor branch or commit.git-cached-diff: Get a diff between the files in the staging area (the index) and the HEAD.git-commit-messages: Get commit messages between the ancestor and HEAD.
Environment Variables
The server can be configured with the following environment variables, which can be set in the env section of the Zed settings.json:
GIT_REPOSITORY: The path to the Git repository. This is automatically passed by Zed.GIT_EXCLUDES: A comma-separated list of file patterns to exclude from the diff results (e.g.,"*/uv.lock,*.log").GIT_OUTPUT_FORMAT: The output format for the diff results. Can bejson(default) ortext.
Development
- Clone this repository
- Install dependencies:
uv sync --frozen
Release Notes
0.3.1 (2025-12-10)
- Added a new prompt
/generate-commit-messageto generate commit messages based on staged changes and recent commit history. It also highlights potential issues in the changes. - Added
gemini-extension.jsonto support direct installation as a Gemini CLI extension. - Added support for
.pre-commit-config.yamlfor development.
0.3.0 (2025-09-05)
- Implemented the MCP tool version of the three MCP prompts:
git-diff,generate-pr-desc, andgit-cached-diff. This allows for a more integrated experience with MCP-compatible clients. - Added a new command
/git-commit-messagesto get commit messages between a specified ancestor and HEAD.
License
MIT License. See for details.