G

Git Context Mcp

muhannad-hash
💻 Developer Tools
0 Views
0 Installs

📇 🏠 🍎 🪟 🐧 - Answers "why does this code exist?" by tracing any line back through the commit, GitHub PR description, and linked issues. Five tools: blame context, commit story, file history, commit search, and file contributors. npx git-context-mcp

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "muhannad-hash-git-context-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "muhannad-hash-git-context-mcp"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

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

ToolWhat it does
blame_contextFile + line range → commit + PR description + linked issues
commit_storyCommit hash → full narrative (message, diff stat, PR, issues)
file_historyFile → last N commits, each annotated with PR and issues
search_commitsKeyword → matching commits with PR/issue context
file_contributorsFile → 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)
  • 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:

"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

  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).


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

Related MCP Servers

Moxie Docs MCP
★ Featured

MCP & Agent Skills for Automated Documentation, and codebase conventions + context

💻 Developer Tools2 views
C
Codebeamer Mcp

📇 ☁️ 🍎 🪟 🐧 - Codebeamer ALM integration for managing work items, trackers, and projects. Provides 17 tools for reading and writing items, associations, references, comments, and risk management data via Codebeamer REST API v3.

💻 Developer Tools1 views
M
Magic MCP

Create crafted UI components inspired by the best 21st.dev design engineers.

💻 Developer Tools0 views
I
Ios Mcp Code Quality Server

📇 🏠 🍎 - iOS code quality analysis and test automation server. Provides comprehensive Xcode test execution, SwiftLint integration, and detailed failure analysis. Operates in both CLI and MCP server modes for direct developer usage and AI assistant integration.

💻 Developer Tools0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it →
★ Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.