# muhannad-hash/git-context-mcp [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/muhannad-hash/git-context-mcp  
**GitHub Stars:** 2  
**npm Downloads (last month):** 36  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/muhannad-hash-git-context-mcp

## Description
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

## Tools
Capabilities this server exposes over MCP:

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

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "git-context-mcp": {
    "command": "npx",
    "args": ["-y","git-context-mcp"]
  }
}
```

## Documentation

## What muhannad-hash/git-context-mcp does

The muhannad-hash/git-context-mcp MCP server helps an agent move from code ownership or history to the reasoning behind a change. It accepts repository-oriented questions through MCP and combines local Git data with related GitHub pull requests and issues.

The main entry point for line-level investigation is `blame_context`. Given a file and line range, it identifies the commit responsible for those lines, retrieves the commit message and diff statistics, finds the associated pull request, and includes linked issue information when available. This is useful when a line is difficult to understand from the current file alone.

Other tools cover commit narratives, file history, keyword-based commit discovery, and contributor information. Results are returned as structured Markdown for the connected client to interpret.

## How it works

For `blame_context`, the server runs `git blame -p` against the requested lines to obtain one or more commit hashes. It then uses `git show` to collect each commit's full message and diff statistics. To add collaboration context, it calls the GitHub API through `gh`, checks for the pull request associated with the commit, and parses references such as `#NNN` or `/issues/NNN` from the pull request body. Referenced issues are fetched individually.

The server does not store tokens. According to the project documentation, data is sent only to GitHub's API through the GitHub CLI when GitHub lookups are requested. Local Git operations continue to work without GitHub metadata.

## Setup and configuration

The muhannad-hash/git-context-mcp MCP server can run through `npx` without a global installation:

```bash
claude mcp add git-context -- npx git-context-mcp
```

Alternatively, install the package globally with `npm install -g git-context-mcp`, then register `git-context-mcp` as the MCP command. Manual Claude configuration can define an MCP server named `git-context` with `npx` as the command and `git-context-mcp` as its argument. Restart the client after changing the configuration.

The documented requirements are Claude Code or another MCP-compatible client, Git available on `PATH`, and the `gh` CLI for pull request and issue lookups. Run `gh auth login` to authenticate GitHub access. The server still works without `gh`, but omits pull request and issue context.

## Tools and capabilities

- `blame_context`: maps a file and line range to its commit, pull request description, and linked issues.
- `commit_story`: builds a narrative for a commit hash using its message, diff statistics, pull request, and issues.
- `file_history`: lists the last requested number of commits for a file and annotates them with pull requests and issues.
- `search_commits`: finds commits matching a keyword and includes available pull request or issue context.
- `file_contributors`: produces a ranked author table for a file, including commit counts, lines owned, and active dates.

These tools support questions such as why a line exists, what motivated a commit, when a change was introduced, and which authors have contributed most to a file.

## Limitations and notes

GitHub enrichment depends on the `gh` CLI and its authentication. Without it, local commit and file information remains available, but pull request and issue details are not returned. The server is intended to operate in a Git repository and uses the repository's Git history as its source for blame, commits, and file changes.

_Full upstream README: https://allmcps.com/mcp/muhannad-hash-git-context-mcp/readme_

