git-context-mcp
git blame tells you who wrote a line. This tells you why.
README
git-context-mcp
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
You: Why does line 87 of src/auth/session.ts exist?
Claude (using blame_context):
Commit `a3f9c12` by Sarah Chen on 2024-08-14
Message: "fix: rotate session tokens on privilege escalation"
PR #441 — "Security: fix session fixation vulnerability"
Merged: 2024-08-15 | Labels: security, critical
PR Description:
> After the pen test in sprint 22, we found that session tokens
> weren't being rotated when a user's role changed. This allows
> a stolen low-priv token to be used after the account is promoted.
Linked Issue #389 — "Session token not rotated on role change" (closed)
> Reported by @contractor-red: "I was able to reuse a captured
> token after my account was upgraded to admin..."
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)
claude mcp add git-context -- npx git-context-mcp
Option 2 — global install
npm install -g git-context-mcp
claude mcp add git-context -- git-context-mcp
Option 3 — manual config
Add to ~/.claude/claude_mcp_config.json:
{
"mcpServers": {
"git-context": {
"command": "npx",
"args": ["git-context-mcp"]
}
}
}
Then restart Claude Code.
Requirements
- Claude Code (or any MCP-compatible client)
gitin PATHghCLI (install) +gh auth loginfor GitHub PR/issue lookups- Works without
gh— just skips PR/issue context
- Works without
Usage examples
Once installed, talk to Claude naturally in any git repo:
"Why does line 42 of src/db/connection.ts exist?"
"What's the story behind commit d4a8f91?"
"Who owns the most of src/payments/stripe.ts?"
"When was the rate limiting added? Search commits for 'rate limit'"
"Show me the last 5 changes to src/api/auth.ts and why each was made"
How it works
blame_contextrunsgit blame -pon your lines to find the commit hash(es)- For each commit it calls
git showfor the full message and diff stat - It hits the GitHub API (
gh api /repos/:owner/:repo/commits/:hash/pulls) to find the PR - It parses
#NNNand/issues/NNNrefs from the PR body and fetches each issue - 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).
Contributing
PRs welcome. The entire server lives in src/index.ts.
git clone https://github.com/muhannad-hash/git-context-mcp
cd git-context-mcp
npm install
npm run dev # watch mode
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。