git-context-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> An MCP server that answers the one question every developer has: **"why does this code exist?"**
git blame tells you *who* wrote a line. This tells you *why*.
Given a file and line range, git-context-mcp traces back through the commit, finds the pull request that landed it, reads the PR description, and surfaces every linked GitHub issue — all in one shot, directly inside Claude.
---
Demo
No more digging through git log, searching GitHub, and cross-referencing issue trackers. Claude does it in one step.
---
Tools
| Tool | What it does |
|------|-------------|
| blame_context | File + line range → commit + PR description + linked issues |
| commit_story | Commit hash → full narrative (message, diff stat, PR, issues) |
| file_history | File → last N commits, each annotated with PR and issues |
| search_commits | Keyword → matching commits with PR/issue context |
| file_contributors | File → ranked author table (commits, lines owned, active dates) |
---
Installation
Option 1 — npx (no install)
Option 2 — global install
Option 3 — manual config
Add to ~/.claude/claude_mcp_config.json:
Then restart Claude Code.
---
Requirements
- Claude Code (or any MCP-compatible client)
- git in PATH
- gh CLI (install) + gh auth login for GitHub PR/issue lookups
- Works without gh — just skips PR/issue context
---
Usage examples
Once installed, talk to Claude naturally in any git repo:
---
How it works
1. **blame_context** runs git blame -p on your lines to find the commit hash(es)
2. For each commit it calls git show for the full message and diff stat
3. It hits the GitHub API (gh api /repos/:owner/:repo/commits/:hash/pulls) to find the PR
4. It parses #NNN and /issues/NNN refs from the PR body and fetches each issue
5. Everything is returned as structured markdown for Claude to reason over
No tokens stored. No data sent anywhere except GitHub's own API (same as gh CLI).