Git Prompts
STDIOMCP server generating Git repository-based prompts for Zed Editor
MCP server generating Git repository-based prompts for Zed Editor
This repository provides a Model Context Protocol (MCP) server that offers several commands to generate prompts based on the Git repository's content.
uv sync --frozenAdd the following to your settings.json:
"context_servers": { "git_prompt_mcp": { "source": "custom", "command": "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 (the server use fnmatch in the backend) "*/uv.lock", "--excludes", "uv.lock", "--excludes", ".gitignore", "--format", // format for diff results "json" // options: json, text ], "env": {} } }
"context_servers": { "git_prompt_mcp": { "source": "custom", // This is required for Zed version 0.193.x. "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 (the server use fnmatch in the backend) "*/uv.lock", "--excludes", "uv.lock", "--excludes", ".gitignore", "--format", // format for diff results "json" // options: json, text ] }, "settings": {} } }
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.Examples:
/generate-pr-desc main/git-diff dev/git-cached-diff/git-commit-messages mainThe 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.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 be json (default) or text.git-diff, generate-pr-desc, and git-cached-diff. This allows for a more integrated experience with MCP-compatible clients./git-commit-messages to get commit messages between a specified ancestor and HEAD.MIT License. See LICENSE for details.