git-context-mcp
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.
Related MCP server: Selvedge
Tools
Tool | What it does |
| File + line range → commit + PR description + linked issues |
| Commit hash → full narrative (message, diff stat, PR, issues) |
| File → last N commits, each annotated with PR and issues |
| Keyword → matching commits with PR/issue context |
| File → ranked author table (commits, lines owned, active dates) |
Installation
Option 1 — npx (no install)
claude mcp add git-context -- npx git-context-mcpOption 2 — global install
npm install -g git-context-mcp
claude mcp add git-context -- git-context-mcpOption 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 lookupsWorks without
gh— just skips PR/issue context
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 statIt hits the GitHub API (
gh api /repos/:owner/:repo/commits/:hash/pulls) to find the PRIt parses
#NNNand/issues/NNNrefs from the PR body and fetches each issueEverything 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 modeLicense
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceThe shared AI context engine for git — save, search, and share the reasoning behind code changes. Captures the why behind every commit and slide on PRs for coding agents.Last updated34MIT
- AlicenseAqualityBmaintenanceChange tracking for AI-era codebases. AI agents call it to log structured change events (entity + diff + reasoning) before the session ends, then query history with diff, blame, history, changeset, and search. Captures the intent that would otherwise evaporate.Last updated817MIT
- AlicenseAqualityAmaintenanceSemantic git queries via MCP. Beyond git log — answer who/what/why about any line, file, or branch with blame, co-change, PR linkage.Last updated6152MIT
- Alicense-qualityBmaintenanceIndexes commit history to create a queryable expert, providing insights into code evolution, developer intent, and hidden patterns beyond static code analysis.Last updatedMIT
Related MCP Connectors
Individual-analyst context layer: recall, remember, and reconcile your data and engineering context.
Independent static verification for exact immutable public GitHub commits.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/muhannad-hash/git-context-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server